Skip to content

Instantly share code, notes, and snippets.

@onejar99
Last active August 8, 2019 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onejar99/d8c78e89123f7a4e209764bcd70a55d3 to your computer and use it in GitHub Desktop.
Save onejar99/d8c78e89123f7a4e209764bcd70a55d3 to your computer and use it in GitHub Desktop.
瀏覽器書籤小工具:右鍵解鎖 / 網頁標題網址快速複製
// format: `onejar99 (OneJar) · GitHub(https://github.com/onejar99)`
javascript:(function() {const copyToClipboard = str => {const el = document.createElement('textarea');el.value = str;el.setAttribute('readonly', '');el.style.position = 'absolute';el.style.left = '-9999px';document.body.appendChild(el);el.select();document.execCommand('copy');document.body.removeChild(el);};copyToClipboard(`${document.title}(${window.location.href})`);})();
javascript:(function() { function R(a){ona ="on"+a; if(window.addEventListener) window.addEventListener(a, function (e) { for(var n=e.originalTarget; n; n=n.parentNode) n[ona]=null; }, true); window[ona]=null; document[ona]=null; document.onkeydown=null; if(document.body) document.body[ona]=null; document.body.oncopy=null; } R("contextmenu"); R("click"); R("mousedown"); R("mouseup"); R("selectstart");})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment