Skip to content

Commit

Permalink
(#68) Add reader pref to disable bookmarking + autoreset to page 1 on…
Browse files Browse the repository at this point in the history
… archive end
  • Loading branch information
Difegue committed Dec 11, 2018
1 parent cd61902 commit da48ba7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions public/js/reader.js
Expand Up @@ -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);
}
Expand Down Expand Up @@ -196,13 +200,17 @@ function initSettingsOverlay() {
if (localStorage.hidetop === 'true')
$("#hidetop").prop("checked", true);

if (localStorage.nobookmark === 'true')
$("#nobookmark").prop("checked", true);

}

function saveSettings() {
localStorage.readorder = $("#readorder").prop("checked");
localStorage.doublepage = $("#doublepage").prop("checked");
localStorage.scaletoview = $("#scaletoview").prop("checked");
localStorage.hidetop = $("#hidetop").prop("checked");
localStorage.nobookmark = $("#nobookmark").prop("checked");

closeOverlay();
goToPage(currentPage);
Expand Down
12 changes: 11 additions & 1 deletion templates/reader.html.tt2
Expand Up @@ -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
Expand Down Expand Up @@ -153,6 +157,12 @@
<input id="hidetop" name="hidetop" class="fa" type="checkbox" style="float:left">
<br /> If enabled, every element that comes before images at the top will be hidden.
</div>

<div class="config-panel">
<h1 class="ih" style="display:inline"> Disable Automatic Bookmarking</h1>
<input id="nobookmark" name="nobookmark" class="fa" type="checkbox" style="float:left">
<br /> Check this to start over from the first page every time you open the reader.
</div>
</div>

<br />
Expand Down

0 comments on commit da48ba7

Please sign in to comment.