This repository was archived by the owner on Nov 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathminioptions.js
More file actions
37 lines (37 loc) · 1.39 KB
/
Copy pathminioptions.js
File metadata and controls
37 lines (37 loc) · 1.39 KB
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
var gapi=document.querySelector('#gapi');
var gser=document.querySelector('#gser');
var icon=document.querySelector('#icon');
var jque=document.querySelector('#jque');
var killer=document.querySelector('#killer');
var bgpage=chrome.extension.getBackgroundPage();
function save_options(name) {
localStorage[name.id]=localStorage[name.id]!=='true';
restore_options();
if(bgpage.working) {
bgpage.unbind(true);
bgpage.bindreq();
}
}
function restore_options() {
killer.className=bgpage.working ?"btn btn-sm on":"btn btn-sm off";
gapi.className=localStorage["gapi"]==='true'?"btn btn-xs on":"btn btn-xs off";
gser.className=localStorage["gser"]==='true'?"btn btn-xs on":"btn btn-xs off";
icon.className=localStorage["icon"]==='true'?"btn btn-xs on":"btn btn-xs off";
jque.className=localStorage["jque"]==='true'?"btn btn-xs on":"btn btn-xs off";
}
function switchkiller() {
if(bgpage.working) {
bgpage.unbind();
killer.className="btn btn-sm off";
}
else {
bgpage.bindreq();
killer.className="btn btn-sm on";
}
}
document.addEventListener('DOMContentLoaded',restore_options);
gapi.addEventListener('click',function(){save_options(gapi);});
gser.addEventListener('click',function(){save_options(gser);});
icon.addEventListener('click',function(){save_options(icon);});
jque.addEventListener('click',function(){save_options(jque);});
killer.addEventListener('click',switchkiller);