summaryrefslogtreecommitdiff
path: root/js/dict.js
blob: c42a65c49471cfe650c5d5249b462501ec15cfe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';

$(document).ready(function() {
	let 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();
			});
		}
	});
});