Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorszaimen <szaimen@e.mail.de>2022-04-12 23:06:46 +0300
committerszaimen <szaimen@e.mail.de>2022-04-13 02:03:18 +0300
commit465c3c2b8625121844ee26c64fb6b701242e5bdf (patch)
treecda250aff9bcb804ef90b19dafeb7fc55db46ec9
parentdf14579173708b380f75a6f5680748e37fdbc419 (diff)
improve hidedownloadenh/noid/improve-hidedownload
Signed-off-by: szaimen <szaimen@e.mail.de>
-rw-r--r--apps/files_sharing/css/public.scss12
-rw-r--r--apps/files_sharing/js/public.js44
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 ?