-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
63 lines (48 loc) · 1.88 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
53
54
55
56
57
58
59
60
61
62
63
Array.prototype.forEach.call(document.querySelectorAll('.expandable'), function(expandable) {
expandable.querySelector('.expander').addEventListener('click', function(e) {
document.querySelectorAll('.expandable').forEach(function(otherExpandable) {
if (otherExpandable !== expandable)
otherExpandable.classList.remove('expanded');
});
expandable.classList.toggle('expanded');
});
});
Array.prototype.forEach.call(document.querySelectorAll('[data-command]'), function(link) {
link.addEventListener('click', function(e) {
chrome.extension.sendMessage({msg: link.getAttribute('data-command')});
close();
});
});
function saveOptions(input){
}
document.querySelector('#close').addEventListener('click', function(e) {close();});
document.querySelector('#options').addEventListener('click', function(){
document.querySelector('#menu').style.display = 'none';
document.querySelector('#options_content').style.display = 'block';
});
document.querySelector('#close_options').addEventListener('click', function(){
document.querySelector('#menu').style.display = 'block';
document.querySelector('#options_content').style.display = 'none';
});
document.querySelector('#wait').addEventListener('keyup', function(){
var value = this.value;
chrome.storage.sync.set({'wait': value}, function(){});
});
document.querySelector('#limit').addEventListener('keyup', function(){
var value = this.value;
chrome.storage.sync.set({'limit': value}, function(){});
});
chrome.storage.sync.get(['wait'], function(result){
var value = result.wait;
if(typeof value == 'undefined'){
value = '800';
}
document.querySelector('#wait').value = value;
});
chrome.storage.sync.get(['limit'], function(result){
var value = result.limit;
if(typeof value == 'undefined'){
value = '1000';
}
document.querySelector('#limit').value = value;
});