website/web/static/js/right-click.js

18 lines
550 B
JavaScript
Raw Normal View History

2023-11-28 05:23:31 +00:00
// Right-click button handler, to dissuade downloading.
document.addEventListener('DOMContentLoaded', () => {
const $modal = document.querySelector("#rightclick-modal"),
$button = $modal.querySelector("button"),
cls = 'is-active';
console.log("register right clicks");
console.log($modal, $button);
document.addEventListener('contextmenu', (e) => {
$modal.classList.add(cls);
e.preventDefault();
});
$button.addEventListener('click', () => {
$modal.classList.remove(cls);
});
});