.
Some checks are pending
lint / runner / vale (push) Waiting to run
Lint / MegaLinter (push) Waiting to run

This commit is contained in:
g_it 2026-03-15 14:27:24 +01:00
commit ad11cc9401
Signed by untrusted user who does not match committer: g_it
GPG key ID: A2B0A7C06A054627
2 changed files with 30 additions and 28 deletions

29
content/assets/js/protect.js Executable file
View file

@ -0,0 +1,29 @@
// 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();
}
});

View file

@ -49,33 +49,6 @@
{{ super() }}
<!-- Script to protect content on the website -->
<script>
// 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();
}
});
</script>
<script src="../assets/js/protect.js"></script>
{% endblock %}