diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/read.js | 17 | ||||
-rw-r--r-- | js/reader.js | 21 |
2 files changed, 14 insertions, 24 deletions
@@ -72,12 +72,18 @@ function next_page() { _store_position = 1; window.book.rendition.next(); - show_ui(false); + + localforage.getItem("epube.keep-ui-visible").then(function(keep) { + if (!keep) show_ui(false); + }); } function prev_page() { window.book.rendition.prev(); - show_ui(false); + + localforage.getItem("epube.keep-ui-visible").then(function(keep) { + if (!keep) show_ui(false); + }); } function hotkey_handler(e) { @@ -121,19 +127,18 @@ $(document).ready(function() { return; var reader = $("#reader"); - var doc = document.documentElement; + var doc = $(document); var margin_side = parseInt(reader.css("left"), 10); var margin_top = parseInt(reader.css("top"), 10); var margin_bottom = parseInt(reader.css("bottom"), 10); //console.log(margin_side, margin_top, margin_bottom); - //console.log(event.clientY + " " + doc.clientHeight); - if (evt.clientY < margin_top || evt.clientY >= doc.clientHeight - margin_bottom) { + if (evt.clientY < margin_top || evt.clientY >= doc.height() - margin_bottom) { return; } - if (evt.clientX >= doc.clientWidth - margin_side) { + if (evt.clientX >= doc.width() - margin_side) { console.log("RIGHT SIDE"); next_page(); } else if (evt.clientX <= margin_side) { diff --git a/js/reader.js b/js/reader.js index ae96a26..d7eddbe 100644 --- a/js/reader.js +++ b/js/reader.js @@ -13,31 +13,16 @@ function enable_swipes() { } $(document).ready(function() { - console.log('setting taps'); - $(window).on("mouseup", function(evt) { if (evt.button == 0) { if ($(".modal").is(":visible")) return; - var reader = $("body"); - var margin_side = parseInt(reader.css("padding-left"), 10); - - //console.log(evt, evt.screenX); - - if (evt.screenX >= reader.width() - margin_side) { - console.log("iframe: RIGHT SIDE"); - parent.next_page(); - } else if (evt.screenX <= margin_side) { - console.log("iframe: LEFT SIDE"); - parent.prev_page(); + if (parent.$(".header").is(":visible")) { + parent.show_ui(false); } else { - if (parent.$(".header").is(":visible")) { - parent.show_ui(false); - } else { - parent.show_ui(true); - } + parent.show_ui(true); } } }); |