site/content/assets/js/protect.js
g_it ad11cc9401
Some checks are pending
lint / runner / vale (push) Waiting to run
Lint / MegaLinter (push) Waiting to run
.
2026-03-15 14:27:24 +01:00

29 lines
793 B
JavaScript
Executable file

// PROTECT.js
// Protect the site's content
// Prevent right-click context menu
document.addEventListener('contextmenu', function (e) {
e.preventDefault();
});
// Prevent text selection
document.addEventListener('selectstart', function (e) {
e.preventDefault();
});
// Block Ctrl+C and other keyboard shortcuts for copying
document.addEventListener('keydown', function (e) {
if (e.ctrlKey && e.key === 'c') { // Blocks Ctrl+C
e.preventDefault();
}
if (e.ctrlKey && e.shiftKey && e.key === 'v') { // Blocks Ctrl+Shift+V
e.preventDefault();
}
});
// Additional measures for image protection
document.addEventListener('contextmenu', function (e) {
if (e.target.tagName.toLowerCase() === 'img') {
e.preventDefault();
}
});