-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
52 lines (47 loc) · 2.22 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
/*
Copyright 2016 Taylor Raack.
This file is part of PageAccel.
PageAccel is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PageAccel is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PageAccel. If not, see <http://www.gnu.org/licenses/>.
*/
document.addEventListener('DOMContentLoaded', function() {
chrome.runtime.sendMessage({ sentinel: "__SIMPLIFYMESSAGE__", method: "getEnabled"}, function(enabled) {
if (enabled) {
document.getElementById('statusText').className = "enabled";
document.getElementById('statusText').innerHTML = "Status: Enabled";
document.getElementById('enabledStatus').innerHTML = "Click to disable on this site";
} else {
document.getElementById('statusText').className = "disabled";
document.getElementById('statusText').innerHTML = "Status: Disabled";
document.getElementById('enabledStatus').innerHTML = "Click to enable on this site";
}
});
document.getElementById('enabledStatus').addEventListener('click', function() {
chrome.runtime.sendMessage({ sentinel: "__SIMPLIFYMESSAGE__", method: "toggleEnabled"});
setTimeout(function() {window.close()}, 250);
});
document.getElementById('moreinfo').addEventListener('click', function(event){
event.preventDefault();
chrome.tabs.create({url: event.currentTarget.href });
});
document.getElementById('help').addEventListener('click', function(event){
event.preventDefault();
chrome.tabs.create({url: event.currentTarget.href });
});
document.getElementById('tutorial1').addEventListener('click', function(event){
event.preventDefault();
chrome.tabs.create({url: event.currentTarget.href });
});
document.getElementById('tutorial2').addEventListener('click', function(event){
event.preventDefault();
chrome.tabs.create({url: event.currentTarget.href });
});
});