From 885d914f18645ca7c15ffe8130bc8b9ae7d36d27 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 28 Aug 2023 18:06:32 +0200 Subject: [PATCH] Update tornado to 6.2 Remove unneeded imports from jsonschema for synctoken Update optional requirements Remove invalid direction arrows in comic reader --- cps/services/SyncToken.py | 6 +- cps/static/js/kthoom.js | 29 +++++++++- cps/templates/readcbr.html | 4 +- cps/tornado_wsgi.py | 110 +++++++++++++++++++------------------ optional-requirements.txt | 24 ++++---- requirements.txt | 10 ++-- 6 files changed, 107 insertions(+), 76 deletions(-) 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 @@
-
- + +