Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@item4
Created May 13, 2021 05:44
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 item4/83db7b09340be6e12e72e3632f75aab5 to your computer and use it in GitHub Desktop.
Save item4/83db7b09340be6e12e72e3632f75aab5 to your computer and use it in GitHub Desktop.
Unlock preventing drag, select, right click
// add this to your bookmark
javascript:(() => {
const events = ['contextmenu', 'drag', 'dragstart', 'selectstart', 'copy', 'cut'];
const styles = ['user-select', '-webkit-user-select', '-moz-user-select', '-ms-user-select', 'pointer-events', '-webkit-pointer-events', '-moz-pointer-events', '-ms-pointer-events'];
events.forEach(event => { window.addEventListener(event, e => {e.stopImmediatePropagation();}, true) });
document.querySelectorAll('body, body *').forEach(el => { styles.forEach(style => { el.style[style] = 'auto !important'; }); });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment