Created
November 18, 2019 15:26
-
-
Save xsynaptic/d52dc7e0d7edecd0e13f67df47778f46 to your computer and use it in GitHub Desktop.
Bookmarklet: Restore text selection and context menu
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 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I designed this to get around Xuite's annoying habit of disabling text selection with CSS and JS. Copy and paste into the URL of a bookmark.