-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
22 lines (19 loc) · 875 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
document.addEventListener('DOMContentLoaded', function () {
const enableExtensionCheckbox = document.getElementById('enableExtension');
const reloadPageButton = document.getElementById('reloadPage');
chrome.storage.sync.get(['extensionEnabled'], function (result) {
enableExtensionCheckbox.checked = result.extensionEnabled || false;
});
enableExtensionCheckbox.addEventListener('change', function () {
chrome.storage.sync.set({ 'extensionEnabled': this.checked }, function () {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.reload(tabs[0].id);
});
});
});
reloadPageButton.addEventListener('click', function () {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.reload(tabs[0].id);
});
});
});