summaryrefslogtreecommitdiff
path: root/js/dict.js
blob: 35e72231fafdd158978830194bc457a6ff5f8592 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'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() {
				getSelection().removeAllRanges();
			});
		}
	});
});