From 7da40d1c2ee55680199f2d774f5d749c6f8354ee Mon Sep 17 00:00:00 2001 From: GarcaMan Date: Sun, 25 Apr 2021 19:59:53 +0000 Subject: [PATCH] Added option to remove Y-Scrollbar and reset page scroll --- cps/static/css/kthoom.css | 11 +++++++++++ cps/static/js/kthoom.js | 14 +++++++++++++- cps/templates/readcbr.html | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/cps/static/css/kthoom.css b/cps/static/css/kthoom.css index 267a2a84..9565cd30 100644 --- a/cps/static/css/kthoom.css +++ b/cps/static/css/kthoom.css @@ -227,3 +227,14 @@ th { .dark-theme .overlay { background-color: rgba(0, 0, 0, 0.8); } + +/* Hide scrollbar for Chrome, Safari and Opera */ +.disabled-scrollbar::-webkit-scrollbar { + display: none; +} + +/* Hide scrollbar for IE, Edge and Firefox */ +.disabled-scrollbar { + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ +} \ No newline at end of file diff --git a/cps/static/js/kthoom.js b/cps/static/js/kthoom.js index f6c1e4d7..0b4220fe 100644 --- a/cps/static/js/kthoom.js +++ b/cps/static/js/kthoom.js @@ -69,7 +69,9 @@ var settings = { rotateTimes: 0, fitMode: kthoom.Key.B, theme: "light", - direction: 0 // 0 = Left to Right, 1 = Right to Left + direction: 0, // 0 = Left to Right, 1 = Right to Left + nextPage: 0, // 0 = Reset to Top, 1 = Remember Position + scrollbar: 1 // 0 = Hide Scrollbar, 1 = Show Scrollbar }; kthoom.saveSettings = function() { @@ -282,6 +284,7 @@ function updatePage() { } $("body").toggleClass("dark-theme", settings.theme === "dark"); + $("#mainContent").toggleClass("disabled-scrollbar", settings.scrollbar === 0); kthoom.setSettings(); kthoom.saveSettings(); @@ -439,6 +442,9 @@ function showPrevPage() { currentImage++; } else { updatePage(); + if (settings.nextPage === 0) { + $("#mainContent").scrollTop(0); + } } } @@ -449,6 +455,9 @@ function showNextPage() { currentImage--; } else { updatePage(); + if (settings.nextPage === 0) { + $("#mainContent").scrollTop(0); + } } } @@ -650,6 +659,9 @@ function init(filename) { $("#thumbnails").on("click", "a", function() { currentImage = $(this).data("page") - 1; updatePage(); + if (settings.nextPage === 0) { + $("#mainContent").scrollTop(0); + } }); // Fullscreen mode diff --git a/cps/templates/readcbr.html b/cps/templates/readcbr.html index 5723947e..5df6258f 100644 --- a/cps/templates/readcbr.html +++ b/cps/templates/readcbr.html @@ -157,6 +157,24 @@ + + + {{_('Next Page')}}: + +
+ + +
+ + + + {{_('Scrollbar')}}: + +
+ + +
+