From 0d622ef4954bc9bb8743dc17f5af34637f69ffee Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 29 Jun 2018 12:42:03 +0300 Subject: some more updates --- read.html | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'read.html') diff --git a/read.html b/read.html index e9502aa..9ca9252 100644 --- a/read.html +++ b/read.html @@ -880,26 +880,36 @@ } - $(".loading").hide(); + $(".location").click(function() { + var current = book.rendition.currentLocation().start.location; + var total = book.locations.length(); + var page = prompt("Jump to location [1-" + total + "]", current); - }); + if (page) { + book.rendition.display(book.locations._locations[page]); + } + }); - rendition.on('relocated', function(location) { + open_lastread(); - /*$("#cur_page").html(location.anchorPage); + window.setTimeout(function() { + $(".loading").hide(); + }, 1500); - var total = book.pagination.totalPages; - if (book.pagination.totalPages > 0) { - var pct = parseInt(location.anchorPage / book.pagination.totalPages * 100); - $("#page_pct").html(pct + "%"); - } */ + }); + + rendition.on('relocated', function(location) { - var currentPage = book.locations.percentageFromCfi(location.start.cfi); + var currentPage = location.start.location; var currentCfi = location.start.cfi; + var totalPages = book.locations.length(); + var pct = book.locations.percentageFromCfi(currentCfi); - $("#page_pct").html(currentPage + '%'); + $("#cur_page").html(currentPage); + $("#total_pages").html(totalPages); + $("#page_pct").html(parseInt(pct*100) + '%'); if (_store_position && new Date().getTime()/1000 - _last_position_sync > 15) { console.log("storing lastread"); @@ -921,7 +931,7 @@ } localforage.setItem(cacheId("lastread"), - {cfi: currentCfi, page: currentPage, total: 100}); + {cfi: currentCfi, page: currentPage, total: totalPages}); } }); -- cgit v1.2.3