summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-07-02 12:31:52 +0300
committerAndrew Dolgov <[email protected]>2018-07-02 12:31:52 +0300
commitedbc49b9b7ad9dd4323db4a0e4ed0a7907871dd6 (patch)
treec15eb0dc8bacc471e20c0e5146e9dfa15307c398
parenta42f5887aee2560cec360845e89fe66092ec352b (diff)
add option to keep UI when turning pages, remove terrible iframe onclick hack
-rw-r--r--js/read.js17
-rw-r--r--js/reader.js21
-rw-r--r--read.html24
3 files changed, 27 insertions, 35 deletions
diff --git a/js/read.js b/js/read.js
index 38bed68..6b6a6fd 100644
--- a/js/read.js
+++ b/js/read.js
@@ -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);
}
}
});
diff --git a/read.html b/read.html
index 5cfdb1e..074a4d7 100644
--- a/read.html
+++ b/read.html
@@ -72,25 +72,19 @@
</div>
</div>
- <!-- <div class="form-group">
+ <div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
- <div class="text-muted">Options take effect after reload:</div>
+ <!-- <div class="text-muted">Options take effect after reload:</div> -->
<div class="checkbox">
<label>
- <input class="transition_checkbox"
- type="checkbox"> Disable transitions
- </label>
- </div>
- <div class="checkbox">
- <label>
- <input class="fullscreen_checkbox"
- type="checkbox"> Request fullscreen mode
+ <input class="keep_ui_checkbox"
+ type="checkbox"> Keep UI when turning pages
</label>
</div>
</div>
- </div> -->
+ </div>
<hr/>
@@ -502,6 +496,14 @@
});
});*/
+ localforage.getItem("epube.keep-ui-visible").then(function(keep) {
+ $(".keep_ui_checkbox")
+ .attr("checked", keep)
+ .on("click", function() {
+ localforage.setItem("epube.keep-ui-visible", this.checked);
+ });
+ });
+
localforage.getItem("epube.fontFamily").then(function(font) {
if (!font) font = DEFAULT_FONT_FAMILY;