Skip to content

Instantly share code, notes, and snippets.

@item4
Created May 13, 2021
Embed
What would you like to do?
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