summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/dict.js19
-rw-r--r--js/reader.js18
2 files changed, 20 insertions, 17 deletions
diff --git a/js/dict.js b/js/dict.js
index 7b36d78..22bbf98 100644
--- a/js/dict.js
+++ b/js/dict.js
@@ -1,12 +1,13 @@
-$(window).on("mouseup touchend", function() {
- if (!navigator.onLine) return;
+$(document).ready(function() {
+ $(window).on("mouseup touchend", function() {
+ if (!navigator.onLine) return;
- var sel = getSelection().toString().trim();
+ var sel = getSelection().toString().trim();
- if (sel.match(/^\w+$/)) {
- parent.dict_lookup(sel, function() {
- getSelection().removeAllRanges();
- });
- }
+ if (sel.match(/^\w+$/)) {
+ parent.dict_lookup(sel, function() {
+ getSelection().removeAllRanges();
+ });
+ }
+ });
});
-
diff --git a/js/reader.js b/js/reader.js
index 93a3755..453c925 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -1,10 +1,12 @@
-$(window).on("click tap", function() {
- if (parent.$(".header").is(":visible")) {
- parent.show_ui(false);
- parent.request_fullscreen();
- } else {
- parent.show_ui(true);
- parent.disable_fullscreen();
- }
+$(document).ready(function() {
+ $(window).on("click tap", function() {
+ if (parent.$(".header").is(":visible")) {
+ parent.show_ui(false);
+ parent.request_fullscreen();
+ } else {
+ parent.show_ui(true);
+ parent.disable_fullscreen();
+ }
+ });
});