From f41005d3759740b08f81877e868176fe6ffb28ca Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 22 Feb 2018 12:18:59 +0300 Subject: exp: set iframe event handlers on ready --- js/dict.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'js/dict.js') 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(); + }); + } + }); }); - -- cgit v1.2.3