diff options
author | Andrew Dolgov <[email protected]> | 2020-10-08 16:05:18 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2020-10-08 16:05:18 +0300 |
commit | cf1d643376d4f18cd5cfa9075a21b11fb5713daf (patch) | |
tree | 15eedecef0f052368709dc74c5ee4c5eb41d9664 /js | |
parent | 0add899fa4e15e1f0a872f03805a63886e999ca7 (diff) |
some more gulp-related stuff
Diffstat (limited to 'js')
-rw-r--r-- | js/dict.js | 22 | ||||
-rw-r--r-- | js/reader.js | 9 | ||||
-rw-r--r-- | js/reader_iframe.js | 15 |
3 files changed, 18 insertions, 28 deletions
diff --git a/js/dict.js b/js/dict.js deleted file mode 100644 index d85b75c..0000000 --- a/js/dict.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -/* global EpubeApp */ - -$(document).ready(function() { - const Reader = parent.__get_reader(); - - $(window).on("mouseup touchend", function() { - if (!navigator.onLine) return; - - const sel = getSelection().toString().trim(); - - if (sel.match(/^[\w]+$/)) { - Reader.lookupWord(sel, function() { - if (typeof EpubeApp != "undefined") - EpubeApp.showActionBar(false); - - getSelection().removeAllRanges(); - }); - } - }); -}); diff --git a/js/reader.js b/js/reader.js index d2400a5..3947ec6 100644 --- a/js/reader.js +++ b/js/reader.js @@ -199,8 +199,7 @@ const Reader = { }); const base_url = window.location.href.match(/^.*\//)[0]; - const res_names = [ "lib/bootstrap/v3/js/jquery.js", "lib/jquery.mobile-events.min.js", - "js/reader_iframe.js", "js/dict.js" ]; + const res_names = [ "dist/app-libs.min.js", "js/reader_iframe.js" ]; const doc = contents.document; for (let i = 0; i < res_names.length; i++) { @@ -995,10 +994,8 @@ const Reader = { init: function() { // we need to preload resources for reader iframe because it can't utilize our // service worker because while offline it is created outside our base server context - const res_names = [ "lib/bootstrap/v3/js/jquery.js", "lib/jquery.mobile-events.min.js", - "css/transitions.css", "js/reader_iframe.js", "css/reader.css", "js/dict.js", - "themes/default.css", "themes/light.css", "themes/mocca.css", "themes/night.css", - "themes/plan9.css", "themes/gray.css", "themes/sepia.css" ]; + const res_names = [ "dist/app-libs.min.js", + "js/reader_iframe.js", "css/reader.css" ]; for (let i = 0; i < res_names.length; i++) { fetch(res_names[i], {credentials: 'same-origin'}).then(function(resp) { diff --git a/js/reader_iframe.js b/js/reader_iframe.js index ceef058..897be44 100644 --- a/js/reader_iframe.js +++ b/js/reader_iframe.js @@ -56,6 +56,21 @@ $(document).ready(function() { } }); + $(window).on("mouseup touchend", function() { + if (!navigator.onLine) return; + + const sel = getSelection().toString().trim(); + + if (sel.match(/^[\w]+$/)) { + Reader.lookupWord(sel, function() { + if (typeof EpubeApp != "undefined") + EpubeApp.showActionBar(false); + + getSelection().removeAllRanges(); + }); + } + }); + enable_swipes(); }); |