50 lines
1.9 KiB
JavaScript
50 lines
1.9 KiB
JavaScript
// ==UserScript==
|
|
// @name Force Enable Right Click, Copy & Paste
|
|
// @version 3.0
|
|
// @description Re-enables right click, text selection, and copying/pasting on all sites
|
|
// @author You
|
|
// @match https://www.netacad.com/*
|
|
// @match https://*ucertify.com/*
|
|
// @grant none
|
|
// @run-at document-start
|
|
// ==/UserScript==
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
// Re-enable text selection and right-click
|
|
const styles = `* { user-select: auto !important; -webkit-user-select: auto !important; pointer-events: auto !important; }`;
|
|
const styleSheet = document.createElement('style');
|
|
styleSheet.textContent = styles;
|
|
document.head.appendChild(styleSheet);
|
|
|
|
// Prevent right-click blocking
|
|
document.addEventListener('contextmenu', e => e.stopPropagation(), true);
|
|
|
|
// Prevent text selection blocking
|
|
document.addEventListener('selectstart', e => e.stopPropagation(), true);
|
|
|
|
// Prevent dragstart blocking
|
|
document.addEventListener('dragstart', e => e.stopPropagation(), true);
|
|
|
|
// Stop blocking copy and cut events
|
|
document.addEventListener('copy', e => e.stopPropagation(), true);
|
|
document.addEventListener('cut', e => e.stopPropagation(), true);
|
|
|
|
// Prevent scripts from blocking pasting
|
|
document.addEventListener('paste', e => e.stopPropagation(), true);
|
|
|
|
// Optional: Override any inline scripts that may be preventing user actions
|
|
const scriptOverride = setInterval(() => {
|
|
const blockers = document.querySelectorAll('script');
|
|
blockers.forEach(script => {
|
|
if (script.innerHTML.includes('event.preventDefault()') || script.innerHTML.includes('return false;')) {
|
|
script.innerHTML = script.innerHTML.replace(/event.preventDefault\(\)/g, '').replace(/return false;/g, '');
|
|
}
|
|
});
|
|
}, 1000);
|
|
|
|
// Stop the interval once all blockers are cleared
|
|
setTimeout(() => clearInterval(scriptOverride), 5000);
|
|
})();
|