From da48ba7f831d0b9472a90f379fe5a0ddd8e8390f Mon Sep 17 00:00:00 2001 From: difegue Date: Tue, 11 Dec 2018 17:53:10 +0100 Subject: [PATCH] (#68) Add reader pref to disable bookmarking + autoreset to page 1 on archive end --- public/js/reader.js | 8 ++++++++ templates/reader.html.tt2 | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/public/js/reader.js b/public/js/reader.js index 068a48f49..6e8f4214d 100755 --- a/public/js/reader.js +++ b/public/js/reader.js @@ -162,6 +162,10 @@ function goToPage(page) { //store page number in localStorage localStorage.setItem(id + "-reader", currentPage); + //if we made it to the last page, reset the page number + if (currentPage === pageNumber-1) + localStorage.setItem(id + "-reader", 0); + //scroll to top window.scrollTo(0, 0); } @@ -196,6 +200,9 @@ function initSettingsOverlay() { if (localStorage.hidetop === 'true') $("#hidetop").prop("checked", true); + if (localStorage.nobookmark === 'true') + $("#nobookmark").prop("checked", true); + } function saveSettings() { @@ -203,6 +210,7 @@ function saveSettings() { localStorage.doublepage = $("#doublepage").prop("checked"); localStorage.scaletoview = $("#scaletoview").prop("checked"); localStorage.hidetop = $("#hidetop").prop("checked"); + localStorage.nobookmark = $("#nobookmark").prop("checked"); closeOverlay(); goToPage(currentPage); diff --git a/templates/reader.html.tt2 b/templates/reader.html.tt2 index 4a4139537..808d35fda 100755 --- a/templates/reader.html.tt2 +++ b/templates/reader.html.tt2 @@ -85,7 +85,11 @@ id = "[%id%]"; //Go straight to page number in localStorage if it exists - currentPage = parseInt(localStorage[id + "-reader"] || 0); + if (localStorage.nobookmark === 'true') + currentPage = 0; + else + currentPage = parseInt(localStorage[id + "-reader"] || 0); + pageNumber = pages.pages.length; //canvas variables @@ -153,6 +157,12 @@
If enabled, every element that comes before images at the top will be hidden. + +
+

Disable Automatic Bookmarking

+ +
Check this to start over from the first page every time you open the reader. +