diff --git a/cps/services/SyncToken.py b/cps/services/SyncToken.py index c44841c1..bf31a7bc 100644 --- a/cps/services/SyncToken.py +++ b/cps/services/SyncToken.py @@ -19,10 +19,8 @@ import sys from base64 import b64decode, b64encode -from jsonschema import validate, exceptions, __version__ -from datetime import datetime, timezone - -from urllib.parse import unquote +from jsonschema import validate, exceptions +from datetime import datetime from flask import json from .. import logger diff --git a/cps/static/js/kthoom.js b/cps/static/js/kthoom.js index d955dfb1..072abcc0 100644 --- a/cps/static/js/kthoom.js +++ b/cps/static/js/kthoom.js @@ -177,12 +177,31 @@ kthoom.ImageFile = function(file) { } }; +function updateDirectionButtons(){ + $("#right").show(); + $("#left").show(); + if (currentImage == 0 ) { + if (settings.direction === 0) { + $("#left").hide(); + } else { + $("#right").hide(); + } + } + if ((currentImage + 1) >= Math.max(totalImages, imageFiles.length)) { + if (settings.direction === 0) { + $("#right").hide(); + } else { + $("#left").hide(); + } + } +} function initProgressClick() { $("#progress").click(function(e) { var offset = $(this).offset(); var x = e.pageX - offset.left; var rate = settings.direction === 0 ? x / $(this).width() : 1 - x / $(this).width(); currentImage = Math.max(1, Math.ceil(rate * totalImages)) - 1; + updateDirectionButtons(); updatePage(); }); } @@ -222,6 +241,11 @@ function loadFromArrayBuffer(ab) { // display first page if we haven't yet if (imageFiles.length === currentImage + 1) { + if (settings.direction === 0) { + $("#right").show(); + } else { + $("#left").show(); + } updatePage(); } } else { @@ -427,6 +451,7 @@ function showPrevPage() { } else { updatePage(); } + updateDirectionButtons(); } function showNextPage() { @@ -437,6 +462,7 @@ function showNextPage() { } else { updatePage(); } + updateDirectionButtons(); } function scrollCurrentImageIntoView() { @@ -677,6 +703,7 @@ function init(filename) { if(["hflip", "vflip", "rotateTimes"].includes(this.name)) { reloadImages(); } else if(this.name === "direction") { + updateDirectionButtons(); return updateProgress(); } @@ -726,7 +753,7 @@ function init(filename) { }, }); $(".mainImage").click(function(evt) { - // Firefox does not support offsetX/Y so we have to manually calculate + // Firefox does not support offsetX/Y, so we have to manually calculate // where the user clicked in the image. var mainContentWidth = $("#mainContent").width(); var mainContentHeight = $("#mainContent").height(); diff --git a/cps/templates/readcbr.html b/cps/templates/readcbr.html index a4ac3722..8b42cb79 100644 --- a/cps/templates/readcbr.html +++ b/cps/templates/readcbr.html @@ -77,8 +77,8 @@
-
- + +