summaryrefslogtreecommitdiff
path: root/js/dict.js
blob: 1c802e754aa3d735c0831660c4b04e1ca458bff1 (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();
			});
		}
	});
});