-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.js
49 lines (45 loc) · 1.24 KB
/
settings.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
// thanks to https://github.com/hartleybrody/buzzkill/blob/master/settings.js
document.addEventListener('DOMContentLoaded', function() {
var input = document.getElementById('forbidden-words');
var saveButton = document.getElementById('save-button');
var resetButton = document.getElementById('reset-button');
// set the initial state of the checkbox
chrome.storage.sync.get('forbidden_words', function(data) {
forbiddenWords = data['forbidden_words'];
console.log('oi', forbiddenWords);
if (forbiddenWords) {
input.value = forbiddenWords;
}
});
saveButton.addEventListener('click', function() {
chrome.storage.sync.set({ forbidden_words: input.value });
});
resetButton.addEventListener('click', function() {
dictionary = [
'pan',
'pri',
'prd',
'morena',
'amlo',
'anaya',
'meade',
'populismo',
'populista',
'populistas',
'debate',
'senado',
'lopez obrador',
'lópez obrador',
'prian',
'peña nieto',
'salinas',
'vicente fox',
'elecciones',
'peje',
'ine',
'trife'
];
input.value = dictionary.join(',');
chrome.storage.sync.set({ forbidden_words: input.value });
});
});