-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathoptions.js
64 lines (59 loc) · 1.38 KB
/
options.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
document.addEventListener('DOMContentLoaded', function() {
var optionsIds = [
'showIcon',
'showPopup',
'showPopupOnMouseOver',
'showColumn',
'showTrace',
'linkStackOverflow',
'linkViewSource',
'relativeErrorUrl',
'ignore404js',
'ignore404css',
'ignore404others',
'ignoreExternal',
'ignoreBlockedByClient',
'ignoreConnectionRefused',
'popupMaxWidth',
'popupMaxHeight'
];
for(var i in optionsIds) {
var option = optionsIds[i];
var value = localStorage[option];
var input = document.getElementById(option);
if(input.type == 'checkbox') {
if(value) {
input.checked = true;
}
input.onchange = (function(option) {
return function() {
localStorage[option] = this.checked ? 1 : '';
}
})(option);
}
else {
input.value = value;
input.onkeyup = (function(option) {
return function() {
localStorage[option] = this.value;
}
})(option);
}
}
document.getElementById('close').onclick = function() {
closePopup();
};
if(localStorage['jscrNotified'] || localStorage['isRecommended']) {
document.getElementById('recommendation').remove();
}
else {
var linksIds = ['openRecommendation', 'hideRecommendation'];
for(var i in linksIds) {
document.getElementById(linksIds[i]).onclick = function() {
localStorage['isRecommended'] = 3;
closePopup();
return this.id == 'openRecommendation';
};
}
}
});