From 36075d3f6a1c5785f8ffe959b2a86421f3673d24 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 6 Jun 2017 13:36:17 +0300 Subject: popup dictionary window on touch events --- js/dict.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 js/dict.js (limited to 'js/dict.js') diff --git a/js/dict.js b/js/dict.js new file mode 100644 index 0000000..7b36d78 --- /dev/null +++ b/js/dict.js @@ -0,0 +1,12 @@ +$(window).on("mouseup touchend", function() { + if (!navigator.onLine) return; + + var sel = getSelection().toString().trim(); + + if (sel.match(/^\w+$/)) { + parent.dict_lookup(sel, function() { + getSelection().removeAllRanges(); + }); + } +}); + -- cgit v1.2.3