diff options
author | Andrew Dolgov <[email protected]> | 2018-07-02 12:31:52 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-07-02 12:31:52 +0300 |
commit | edbc49b9b7ad9dd4323db4a0e4ed0a7907871dd6 (patch) | |
tree | c15eb0dc8bacc471e20c0e5146e9dfa15307c398 /js/read.js | |
parent | a42f5887aee2560cec360845e89fe66092ec352b (diff) |
add option to keep UI when turning pages, remove terrible iframe onclick hack
Diffstat (limited to 'js/read.js')
-rw-r--r-- | js/read.js | 17 |
1 files changed, 11 insertions, 6 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) { |