-
Notifications
You must be signed in to change notification settings - Fork 46
/
options.js
37 lines (34 loc) · 1.15 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
function save_options() {
var v = document.getElementById('hlsjsSel').value;
var dbg = document.getElementById('cbDebug').checked;
var ntv = document.getElementById('cbNative').checked;
chrome.storage.local.set({
hlsjs: v,
debug: dbg,
native_video: ntv
}, function() {
var status = document.getElementById('status');
status.textContent = 'Options saved.';
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
function restore_options() {
chrome.storage.local.get({
hlsjs: currentVersion,
debug: false,
native_video: false
}, function(items) {
document.getElementById('hlsjsSel').value = items.hlsjs;
document.getElementById('cbDebug').checked = items.debug;
document.getElementById('cbNative').checked = items.native_video;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('saveSettings').addEventListener('click', save_options);
for (var i in supportedVersions) {
var opt = document.createElement("option");
opt.innerHTML = supportedVersions[i];
document.getElementById('hlsjsSel').appendChild(opt)
}