summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-01-25 13:03:34 +0300
committerAndrew Dolgov <[email protected]>2018-01-25 13:03:34 +0300
commit45ce79df00cafe732d69d615fc210fadaaf6744d (patch)
tree1cb3b5b48d53574fcc9e24aafb538e6cfa9c2151
parent7d748ca94cf15af46ebc2a3c0a738e850a3a9987 (diff)
add disable swipes options
-rw-r--r--js/read.js4
-rw-r--r--read.html37
2 files changed, 32 insertions, 9 deletions
diff --git a/js/read.js b/js/read.js
index e028229..0852d0a 100644
--- a/js/read.js
+++ b/js/read.js
@@ -208,6 +208,10 @@ function toggle_transitions(elem) {
localforage.setItem("epube.disable-transitions", elem.checked);
}
+function toggle_swipes(elem) {
+ localforage.setItem("epube.disable-swipes", elem.checked);
+}
+
function dict_lookup(word, callback) {
$.post("backend.php", {op: 'define', word: word}, function(data) {
if (data) {
diff --git a/read.html b/read.html
index 6b9ef4e..47bae11 100644
--- a/read.html
+++ b/read.html
@@ -61,10 +61,18 @@
<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="checkbox">
<label>
<input class="transition_checkbox" onchange="toggle_transitions(this)"
- type="checkbox"> Disable transitions (needs page reload)
+ type="checkbox"> Disable transitions
+ </label>
+ </div>
+ <div class="checkbox">
+ <label>
+ <input class="swipe_checkbox" onchange="toggle_swipes(this)"
+ type="checkbox"> Disable swipes
</label>
</div>
</div>
@@ -346,19 +354,26 @@
EPUBJS.core.addScripts([baseUrl + "lib/bootstrap/v3/js/jquery.js",
baseUrl + "lib/jquery.mobile.custom.js",
- baseUrl + "js/dict.js",
- baseUrl + "js/swipes.js" ], null, renderer.doc.head);
+ baseUrl + "js/dict.js" ], null, renderer.doc.head);
EPUBJS.core.addCss(baseUrl + "css/reader.css", null, renderer.doc.head);
- localforage.getItem("epube.disable-transitions").then(function(disable) {
- if (!disable) {
- EPUBJS.core.addCss(baseUrl + "css/transitions.css", null, renderer.doc.head);
+ localforage.getItem("epube.disable-swipes").then(function(noswipes) {
- EPUBJS.Render.Iframe.prototype.setLeft = function(leftPos){
- this.docEl.style[this.transform] = 'translate('+ (-leftPos) + 'px, 0)';
- }
+ if (!noswipes) {
+ EPUBJS.core.addScripts([baseUrl + "js/swipes.js" ], null, renderer.doc.head);
}
+
+ localforage.getItem("epube.disable-transitions").then(function(notransitions) {
+ if (!notransitions) {
+ EPUBJS.core.addCss(baseUrl + "css/transitions.css", null, renderer.doc.head);
+
+ EPUBJS.Render.Iframe.prototype.setLeft = function(leftPos){
+ this.docEl.style[this.transform] = 'translate('+ (-leftPos) + 'px, 0)';
+ }
+ }
+ });
+
});
if (callback) callback();
@@ -420,6 +435,10 @@
$(".transition_checkbox").attr("checked", disable);
});
+ localforage.getItem("epube.disable-swipes").then(function(disable) {
+ $(".swipe_checkbox").attr("checked", disable);
+ });
+
localforage.getItem("epube.fontFamily").then(function(font) {
if (!font) font = DEFAULT_FONT_FAMILY;