about summary refs log tree commit diff stats
path: root/read.html
diff options
context:
space:
mode:
authorAndrew Dolgov <noreply@fakecake.org>2018-06-29 12:42:03 +0300
committerAndrew Dolgov <noreply@fakecake.org>2018-06-29 12:42:03 +0300
commit0d622ef4954bc9bb8743dc17f5af34637f69ffee (patch)
tree2ca25cdddc7a219015743768cadf75ab7e0b199d /read.html
parentd681640140604d15ef20825a2453c7918e0a02e9 (diff)
downloadthe-epube-0d622ef4954bc9bb8743dc17f5af34637f69ffee.tar.gz
the-epube-0d622ef4954bc9bb8743dc17f5af34637f69ffee.tar.xz
some more updates
Diffstat (limited to 'read.html')
-rw-r--r--read.html34
1 files changed, 22 insertions, 12 deletions
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});
 
 			}
 		});