forked from jswanner/DontF-WithPaste
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
30 lines (24 loc) · 778 Bytes
/
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
document.addEventListener('DOMContentLoaded', function() {
var form = document.getElementById('options');
form.addEventListener('reset', function(event) {
event.preventDefault();
chrome.storage.sync.set(window.defaultValues);
});
form.addEventListener('submit', function(event) {
event.preventDefault();
chrome.storage.sync.set({
exclude: form.exclude.value,
include: form.include.value
});
});
chrome.storage.onChanged.addListener(function(changes) {
for (key in changes) {
var change = changes[key];
form[key].value = change.newValue || '';
}
});
chrome.storage.sync.get(window.defaultValues, function({exclude, include}) {
form.exclude.value = exclude;
form.include.value = include;
});
});