summaryrefslogtreecommitdiff
path: root/js/dict.js
blob: d85b75ca4939924b79d22d86053c0a300633737d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'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();
			});
		}
	});
});