-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
35 lines (30 loc) · 1.09 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
function save() {
var textBox = document.getElementById("RepositoryURL")
var url = textBox.value
console.log(url)
if (url == null) {
url = "http://cryptic-plains-11632.herokuapp.com"
} else if (url == "") {
url = "http://cryptic-plains-11632.herokuapp.com";
}
chrome.storage.sync.set({
repository: url,
})
chrome.storage.sync.get(function(items) {
//document.getElementById('color').value = items.favoriteColor;
//document.getElementById('like').checked = items.likesColor;
console.log("current set:" + items.repository)
});
}
function restore() {
chrome.storage.sync.get({
repository: 'http://cryptic-plains-11632.herokuapp.com',
}, function(items) {
//document.getElementById('color').value = items.favoriteColor;
//document.getElementById('like').checked = items.likesColor;
document.getElementById("RepositoryURL").value = items.repository
});
}
document.addEventListener('DOMContentLoaded', restore);
document.getElementById('save').addEventListener('click',
save);