Skip to content

Instantly share code, notes, and snippets.

View xsynaptic's full-sized avatar

Alexander S. xsynaptic

View GitHub Profile
@xsynaptic
xsynaptic / restore-selection.js
Created November 18, 2019 15:26
Bookmarklet: Restore text selection and context menu
javascript:function restoreSelection(){console.log('Attempting to restore text selection!');var style=document.createElement("style");style.type="text/css",style.innerHTML="*, p, div { -moz-user-select: text !important;-webkit-user-select:text !important;user-select: text !important; }",document.head.appendChild(style),document.querySelectorAll("*").forEach(el=>{el.onselectstart=el.ondragstart=el.ondrag=el.oncontextmenu=el.onmousedown=el.onmouseup=function(){return!0}})}restoreSelection();