Created
July 23, 2024 11:46
-
-
Save ganqqwerty/4f76fc50ca5010e5f6c89910a7239f52 to your computer and use it in GitHub Desktop.
Allows right click button to work normally on any website
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
// some websites stupidly block the right click action on their websites fearing that their little petty secrects | |
// will be copied. Of course, we copy them all the same by going to developer tools, but it's just less handy. | |
// Copy and paste this script into your console and you will be able to select and copy anything you want. | |
(function() { | |
// Utility function to remove all event listeners of a specific type | |
function removeAllEventListeners(type) { | |
const allElements = document.querySelectorAll('*'); // Select all elements | |
allElements.forEach(element => { | |
const clone = element.cloneNode(true); // Clone the element | |
element.parentNode.replaceChild(clone, element); // Replace the original element with the cloned one, effectively removing all event listeners | |
}); | |
} | |
// Remove all contextmenu event listeners | |
removeAllEventListeners('contextmenu'); | |
console.log('All contextmenu event listeners have been removed.'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment