diff options
-rw-r--r-- | css/read.css | 4 | ||||
-rw-r--r-- | js/read.js | 8 | ||||
-rw-r--r-- | read.html | 20 |
3 files changed, 30 insertions, 2 deletions
diff --git a/css/read.css b/css/read.css index d1cb1be..7495ad3 100644 --- a/css/read.css +++ b/css/read.css @@ -93,13 +93,13 @@ @media (max-width: 767px) { .toolbar { - width : 96px; + width : 105px; } } @media (max-width: 576px) { .toolbar { - width : 96px; + width : 105px; } #reader { left : 24px; @@ -314,4 +314,12 @@ function dict_lookup(word, callback) { }); } +function open_previous_location(elem) { + var cfi = $(elem).attr("data-location-cfi"); + if (cfi) { + window.book.rendition.display(cfi); + } + + $(elem).fadeOut(); +} @@ -191,6 +191,11 @@ </span> <span class="toolbar"> + <span class="prev_location_btn" + onclick="open_previous_location(this)" style="display : none"> + <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> + </span> + <span onclick="request_fullscreen()"> <span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span> </span> @@ -432,6 +437,21 @@ rendition.hooks.content.register(function(contents) { + contents.on("linkClicked", function(href) { + console.log('linkClicked', href); + + if (href.indexOf("://") == -1) { + $(".prev_location_btn") + .attr("data-location-cfi", book.rendition.currentLocation().start.cfi) + .show(); + + window.setTimeout(function() { + show_ui(true); + }, 50); + } + + }); + var base_url = window.location.href.match(/^.*\//)[0]; var res_names = [ "lib/bootstrap/v3/js/jquery.js", "lib/jquery.mobile.custom.js", "js/reader.js", "js/dict.js" ]; |