-
Notifications
You must be signed in to change notification settings - Fork 6
/
popup.js
37 lines (30 loc) · 1.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
(function(){
//make the disable button turn into a 're-enable' button if it's already disabled
chrome.tabs.query({active: true, currentWindow: true}, function(tabs){
chrome.tabs.sendMessage(tabs[0].id,{method:"is_page_disabled"}, function(response){
if(response === 'disabled')
document.getElementById('disable_page_button').innerHTML = "re-enable for this page";
});
});
chrome.extension.sendRequest({method:"get_temp_disable"}, function(response){
if(response.disabled)
document.getElementById('temp_disable_button').innerHTML = 'turn off temp disable';
});
document.getElementById("disable_page_button").onclick = function(){
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id,{method:'toggle_page' }, function(response) {
show_reload_message();
});
});
};
document.getElementById("temp_disable_button").onclick = function(){
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id,{method:'toggle_global' }, function(response) {
show_reload_message();
});
});
};
show_reload_message = function(){
document.getElementById('content').innerHTML = "reload please";
}
})();