-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
26 lines (19 loc) · 826 Bytes
/
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
document.addEventListener('DOMContentLoaded', () => {
const blurSwitch = document.querySelector("#blur-input")
// Checks if there's already a "checked" property in storage
chrome.storage.sync.get(['checked'], result => {
chrome.tabs.query({currentWindow: true, active: true}, (tabs) => {
if (result !== null) {
chrome.tabs.sendMessage(tabs[0].id, result)
blurSwitch.checked = result.checked
}
})
})
blurSwitch.addEventListener('click', () => {
chrome.storage.sync.set({checked: blurSwitch.checked}, () => {
chrome.tabs.query({currentWindow: true, active: true}, (tabs) => {
chrome.tabs.sendMessage(tabs[0].id, blurSwitch.checked)
})
})
}, false)
}, false)