diff options
author | Andrew Dolgov <[email protected]> | 2018-01-25 13:03:34 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-01-25 13:03:34 +0300 |
commit | 45ce79df00cafe732d69d615fc210fadaaf6744d (patch) | |
tree | 1cb3b5b48d53574fcc9e24aafb538e6cfa9c2151 | |
parent | 7d748ca94cf15af46ebc2a3c0a738e850a3a9987 (diff) |
add disable swipes options
-rw-r--r-- | js/read.js | 4 | ||||
-rw-r--r-- | read.html | 37 |
2 files changed, 32 insertions, 9 deletions
@@ -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) { @@ -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; |