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 pathoptions.js
More file actions
36 lines (35 loc) · 1.28 KB
/
Copy pathoptions.js
File metadata and controls
36 lines (35 loc) · 1.28 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
var gapi=document.getElementById('gapi');
var gser=document.getElementById('gser');
var icon=document.getElementById('icon');
var jque=document.getElementById('jque');
var badge=document.getElementById('badge');
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() {
gapi.checked=localStorage["gapi"]==='true';
gser.checked=localStorage["gser"]==='true';
icon.checked=localStorage["icon"]==='true';
jque.checked=localStorage["jque"]==='true';
badge.checked=localStorage["badge"]==='true';
}
document.addEventListener('DOMContentLoaded',function(){
restore_options();
var xhr = new XMLHttpRequest();
xhr.open("GET","http://s.xmcp.ml/gofw/ad.html");
xhr.onload = function(event) {
document.querySelector("#ad").innerHTML = xhr.response;
};
xhr.send();
});
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);});
badge.addEventListener('click',function(){save_options(badge);});