-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
64 lines (52 loc) · 1.59 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//Elements:
const enableButton = document.getElementById("enable");
const disableButton = document.getElementById("disable");
const opacityDropdown = document.getElementById("opacity");
enableButton.onclick = Enable;
disableButton.onclick = Disable;
opacityDropdown.onclick = SwitchImageOpacity;
function Enable()
{
chrome.runtime.sendMessage({event: 'onEnable'})
console.log("Sending enable event");
//TODO: Connect to main.js to toggle the Images
}
function Disable()
{
chrome.runtime.sendMessage({event: 'onDisable'})
console.log("Sending disable event");
}
function SwitchImageOpacity()
{
const prefs =
{
opacity: opacityDropdown.value
}
console.log(opacityDropdown.value);
chrome.runtime.sendMessage({event: 'onSwitchOpacity', prefs})
console.log("Sending switchOpacity event");
//TODO: Connect to main.js to switch the opacity
}
chrome.storage.local.get(["opacity"], (result) =>
{
const { opacity } = result;
if(opacity)
{
opacityDropdown.value = opacity;
}
})
//document.getElementById("ToggleButton").addEventListener('click', ToggleImages);
//Outdated:
// document.addEventListener('DOMContentLoaded', function()
// {
// var checkPageButton = document.getElementById('DisableButton');
// checkPageButton.addEventListener('click', function()
// {
// chrome.tabs.getSelected(null, function(tab)
// {
// alert("Test");
// var enabledBool = document.getElementById("isEnabled");
// enabledBool = !enabledBool;
// });
// }, false);
// }, false);