Skip to content

Instantly share code, notes, and snippets.

@xsynaptic
Created November 18, 2019 15:26
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 xsynaptic/d52dc7e0d7edecd0e13f67df47778f46 to your computer and use it in GitHub Desktop.
Save xsynaptic/d52dc7e0d7edecd0e13f67df47778f46 to your computer and use it in GitHub Desktop.
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();
@xsynaptic
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment