Skip to content

Instantly share code, notes, and snippets.

@michi10560
Last active September 2, 2017 02:55
Show Gist options
  • Save michi10560/37d6f0eb0c9b0a1b6ac5cb052f74bec2 to your computer and use it in GitHub Desktop.
Save michi10560/37d6f0eb0c9b0a1b6ac5cb052f74bec2 to your computer and use it in GitHub Desktop.
表示しているWebページを「[ページのタイトル](URL)」のマークダウン書式でクリップボードにコピーするブックマークレット
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+")");})();
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