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';
|
|
|
|
|
2023-11-28 06:07:40 +00:00
|
|
|
(document.querySelectorAll('img, video') || []).forEach(node => {
|
|
|
|
node.addEventListener('contextmenu', (e) => {
|
|
|
|
$modal.classList.add(cls);
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
2023-11-28 05:23:31 +00:00
|
|
|
});
|
2023-11-28 06:07:40 +00:00
|
|
|
|
2023-11-28 05:23:31 +00:00
|
|
|
$button.addEventListener('click', () => {
|
|
|
|
$modal.classList.remove(cls);
|
|
|
|
});
|
|
|
|
});
|