forked from daviddengcn/patch-ext
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.js
More file actions
29 lines (23 loc) · 674 Bytes
/
options.js
File metadata and controls
29 lines (23 loc) · 674 Bytes
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
function ut(id, text) {
document.getElementById(id).innerText = text;
}
ut('span-page-title', 'Git Patch Viewer ' + browser.runtime.getManifest().version);
function send_options() {
var patterns = document.getElementById('ta-patterns').value.trim().split("\n")
browser.runtime.sendMessage({
set_options:{},
options: {
patterns: patterns
}
})
}
function load() {
browser.runtime.sendMessage({get_options:{}}, function(opt) {
console.log(JSON.stringify(opt))
document.getElementById('ta-patterns').value = opt.patterns.join("\n")
document.getElementById('ta-patterns').addEventListener('change', function(e) {
send_options()
});
})
}
load()