.
This commit is contained in:
parent
1514d2de7d
commit
ad11cc9401
2 changed files with 30 additions and 28 deletions
29
content/assets/js/protect.js
Executable file
29
content/assets/js/protect.js
Executable 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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -49,33 +49,6 @@
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
|
|
||||||
<!-- Script to protect content on the website -->
|
<!-- Script to protect content on the website -->
|
||||||
<script>
|
<script src="../assets/js/protect.js"></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>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue