2023-11-28 05:23:31 +00:00
|
|
|
// Right-click button handler, to dissuade downloading.
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
2023-11-28 05:53:02 +00:00
|
|
|
// Whitelist of paths to NOT engage the script on (because it's annoying)
|
|
|
|
let path = window.location.pathname;
|
|
|
|
if (path === "/") return;
|
|
|
|
let pathWhitelist = [
|
|
|
|
"/messages",
|
|
|
|
"/forum/post",
|
|
|
|
"/f/",
|
|
|
|
"/settings",
|
|
|
|
"/photo/certification",
|
|
|
|
"/notes/me",
|
|
|
|
"/notes/u/",
|
|
|
|
"/admin",
|
|
|
|
"/about",
|
|
|
|
"/faq",
|
|
|
|
"/tos",
|
|
|
|
"/privacy",
|
|
|
|
"/contact",
|
|
|
|
];
|
|
|
|
for (let prefix of pathWhitelist) {
|
|
|
|
if (path.indexOf(prefix) === 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-28 05:23:31 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|