-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpopup.js
40 lines (35 loc) · 1.56 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
document.addEventListener('DOMContentLoaded', function () {
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
var currTab = tabs[0];
if (currTab) {
var tabkey = get_tabkey(currTab.id);
chrome.storage.local.get(['settings', tabkey], function (result) {
var settings = result.settings;
var tabinfo = result[tabkey];
var flag = {"is_change": false};
container.style.width = settings.popup_width + "px";
highlightWords.style.minHeight = settings.popup_height + "px";
instant.checked = settings.isInstant;
saveWords.checked = settings.isSaveKws;
if (settings.isSaveKws && tabinfo.isNewPage) {
flag.is_change = true;
}
tabinfo.isNewPage = false;
chrome.storage.local.set({[tabkey]: tabinfo}, function () {
if (flag.is_change) {
handle_highlightWords_change(tabkey);
}
});
$("#highlightWords").on("input", function () {
handle_highlightWords_change(tabkey);
})
$("#instant").on("input", function () {
handle_instant_mode_change(settings);
})
$("#saveWords").on("input", function () {
handle_saveWords_mode_change(settings);
})
});
}
});
});