diff --git a/web/static/js/right-click.js b/web/static/js/right-click.js index 4dd33f2..7ecfeca 100644 --- a/web/static/js/right-click.js +++ b/web/static/js/right-click.js @@ -4,6 +4,7 @@ document.addEventListener('DOMContentLoaded', () => { $button = $modal.querySelector("button"), cls = 'is-active'; + // Disable context menu on all images. (document.querySelectorAll('img, video') || []).forEach(node => { node.addEventListener('contextmenu', (e) => { $modal.classList.add(cls); @@ -11,6 +12,15 @@ document.addEventListener('DOMContentLoaded', () => { }); }); + // Make images not draggable. + (document.querySelectorAll('img') || []).forEach(node => { + node.addEventListener('dragstart', (e) => { + e.preventDefault(); + return false; + }); + node.setAttribute("draggable", "false"); + }); + $button.addEventListener('click', () => { $modal.classList.remove(cls); });