diff options
-rw-r--r-- | apps/files_sharing/css/public.scss | 12 | ||||
-rw-r--r-- | apps/files_sharing/js/public.js | 44 |
2 files changed, 55 insertions, 1 deletions
diff --git a/apps/files_sharing/css/public.scss b/apps/files_sharing/css/public.scss index aadf7d41037..2f5ca5bf0a6 100644 --- a/apps/files_sharing/css/public.scss +++ b/apps/files_sharing/css/public.scss @@ -51,6 +51,18 @@ thead { left: 0 !important; } +// blur page when focus is removed +.blur_body { + filter: blur(5px); +} + +// disable printing +@media print { + .disable_print { + display: none + } +} + #data-upload-form { position: relative; right: 0; diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index bfb035fb817..58d320625bd 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -50,13 +50,55 @@ OCA.Sharing.PublicApp = { var token = $('#sharingToken').val(); var hideDownload = $('#hideDownload').val(); - // Prevent all right-click options if hideDownload is enabled if (hideDownload === 'true') { + // Prevent all right-click options window.oncontextmenu = function(event) { event.preventDefault(); event.stopPropagation(); return false; }; + + // Prevent printing + document.body.classList.add('disable_print'); + window.addEventListener('keydown', (event) => { + if (event.key === "PrintScreen") { + event.preventDefault(); + event.stopPropagation(); + return false; + } + }); + window.addEventListener('keydown', (event) => { + if (event.key === "p" && event.ctrlKey === true) { + event.preventDefault(); + event.stopPropagation(); + return false; + } + }); + + // Prevent saving + window.addEventListener('keydown', (event) => { + if (event.key === "Save") { + event.preventDefault(); + event.stopPropagation(); + return false; + } + }); + window.addEventListener('keydown', (event) => { + if (event.key === "s" && event.ctrlKey === true) { + event.preventDefault(); + event.stopPropagation(); + return false; + } + }); + + // Blur elements when window has no focus in order to make screenshots harder + setInterval(function () { + if (document.hasFocus()) { + document.body.classList.remove('blur_body'); + } else { + document.body.classList.add('blur_body'); + } + }, 300); } // file list mode ? |