diff options
Diffstat (limited to 'read.html')
-rw-r--r-- | read.html | 34 |
1 files changed, 22 insertions, 12 deletions
@@ -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}); } }); |