-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
40 lines (27 loc) · 1.03 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
/* Tabs Removed Counter */
let tabsRemovedCounter = document.getElementById("tabs-removed-counter");
chrome.storage.sync.get("tabsRemoved", function(data) {
count = data.tabsRemoved || 0;
tabsRemovedCounter.innerHTML = "Tabs Removed: " + count;
});
/* Pause Button */
let pauseButton = document.getElementById("pause-button");
chrome.storage.sync.get('isPaused', function(data) {
pauseButton.innerHTML = data.isPaused ? "Unpause SingleTab" : "Pause SingleTab";
});
pauseButton.onclick = function(element) {
chrome.storage.sync.get('isPaused', function(data) {
chrome.storage.sync.set({isPaused: !data.isPaused}, function() {
pauseButton.innerHTML = !data.isPaused ? "Unpause SingleTab" : "Pause SingleTab";
});
});
};
/* Options Link */
let optionsLink = document.getElementById("options-link");
optionsLink.onclick = function(element) {
if (chrome.runtime.openOptionsPage) {
chrome.runtime.openOptionsPage();
} else {
window.open(chrome.runtime.getURL('options.html'));
}
};