-
Notifications
You must be signed in to change notification settings - Fork 7
/
popup.js
30 lines (29 loc) · 1.01 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
chrome.storage.sync.get('stat', function(res){
for(site in res.stat){
var tr = document.createElement("tr");
var td1 = document.createElement("td");
var span1 = document.createElement("span");
span1.innerHTML = site;
var td2 = document.createElement("td");
var span2 = document.createElement("span");
span2.innerHTML = res.stat[site];
td1.appendChild(span1)
td2.appendChild(span2)
tr.appendChild(td1)
tr.appendChild(td2)
document.getElementById('stats').appendChild(tr)
}
});
chrome.browserAction.setPopup({
popup: ''
})
document.getElementById('donate').onclick = function(){
chrome.tabs.create({url:chrome.extension.getURL("donate.html")},function(){})
}
document.getElementById('notification').addEventListener("change", function() {
console.log(this.checked);
chrome.storage.sync.set({'notification': this.checked});
})
chrome.storage.sync.get('notification', function(res){
document.getElementById('notification').checked = res.notification;
});