Last active
September 2, 2017 02:55
-
-
Save michi10560/37d6f0eb0c9b0a1b6ac5cb052f74bec2 to your computer and use it in GitHub Desktop.
表示しているWebページを「[ページのタイトル](URL)」のマークダウン書式でクリップボードにコピーするブックマークレット
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){function copy(e){var t=document.createElement("span");t.style="-webkit-user-select: auto;",t.textContent=e,document.body.appendChild(t);var n=document.createRange();n.selectNode(t);var o=window.getSelection();o.removeAllRanges(),o.addRange(n),document.execCommand("copy"),setTimeout(function(){t.remove()},50)}copy("["+document.title+"]("+document.URL+")");})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copy(text){ | |
var span=document.createElement("span"); | |
span.style="-webkit-user-select: auto;"; | |
span.textContent=text; | |
document.body.appendChild(span); | |
var range=document.createRange(); | |
range.selectNode(span); | |
var selection=window.getSelection(); | |
selection.removeAllRanges(); | |
selection.addRange(range); | |
document.execCommand("copy"); | |
setTimeout( | |
function(){ | |
span.remove() | |
},50 | |
); | |
} | |
copy("["+document.title+"]("+document.URL+")") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment