-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
30 lines (24 loc) · 921 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
// Saves options to localStorage.
function save_options() {
//localStorage["ip"] = document.getElementById("ip").value;
// Update status to let user know options were saved.
chrome.storage.sync.set({'dune_ip': document.getElementById("ip").value}, function() {
// Notify that we saved.
var status = document.getElementById("status");
status.innerHTML = "Options Saved!";
setTimeout(function () {
status.innerHTML = "";
}, 1000);
});
}
// Restores select box state to saved value from localStorage.
function restore_options() {
chrome.storage.sync.get('dune_ip', function(data) {
if (data){
var ip = document.getElementById("ip");
ip.value = data.dune_ip
}
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.querySelector('#save').addEventListener('click', save_options);