-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
65 lines (60 loc) · 1.95 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
64
65
// Save and load extension options
function saveOptions() {
var autoResume = document.getElementById("autoResume");
//var enableQueue = document.getElementById("enableQueue");
var RTESOptions = {
autoResume: autoResume.checked,
//enableQueue: enableQueue.checked
}
//localStorage.setItem("RTESOptions", JSON.stringify(RTESOptions));
chrome.storage.sync.set(RTESOptions, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Options saved.';
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
function saveExpFeatures() {
var HTML5Player = document.getElementById("HTML5Player");
var RTESOptions = {
HTML5Player: HTML5Player.checked
}
chrome.storage.sync.set(RTESOptions, function() {
var status = document.getElementById('status');
status.textContent = 'Options saved.';
setTimeout(function() {
status.textContent = '';
}, 750);
});
}
function loadSavedOptions() {
chrome.storage.sync.get({
autoResume: true,
//enableQueue: true
}, function(items) {
document.getElementById('autoResume').checked = items.autoResume;
//document.getElementById('enableQueue').checked = items.enableQueue;
});
}
function loadSavedExpFeatures() {
chrome.storage.sync.get({
HTML5Player: false
}, function(items) {
document.getElementById("HTML5Player").checked = items.HTML5Player;
});
}
$(document).ready(function() {
if(window.location.href.indexOf("experimental") > -1) {
loadSavedExpFeatures();
} else if(window.location.href.indexOf("options") > -1) {
loadSavedOptions();
}
$("#saveOptions").on("click", function() {
saveOptions();
});
$("#saveExpFeatures").on("click", function() {
saveExpFeatures();
});
})