Created
May 13, 2021 05:44
-
-
Save item4/83db7b09340be6e12e72e3632f75aab5 to your computer and use it in GitHub Desktop.
Unlock preventing drag, select, right click
This file contains 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
// 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