|
|
@ -13,12 +13,12 @@ function save_options() { |
|
|
|
links.push(input_links[i].value) |
|
|
|
colors.push(input_colors[i].value) |
|
|
|
} |
|
|
|
chrome.storage.sync.set({links:links, colors:colors}) |
|
|
|
browser.storage.sync.set({links:links, colors:colors}) |
|
|
|
console.log("Settings Saved ") |
|
|
|
} |
|
|
|
function restore_options() { |
|
|
|
var mode |
|
|
|
chrome.storage.sync.get("mode", function(result){ |
|
|
|
browser.storage.sync.get("mode", function(result){ |
|
|
|
if (result.mode) { |
|
|
|
switch(result.mode) { |
|
|
|
case "light": |
|
|
@ -32,17 +32,17 @@ function restore_options() { |
|
|
|
} |
|
|
|
} else { |
|
|
|
mode = "light" |
|
|
|
chrome.storage.sync.set({mode:"light"}) |
|
|
|
browser.storage.sync.set({mode:"light"}) |
|
|
|
save_options() |
|
|
|
} |
|
|
|
}) |
|
|
|
chrome.storage.sync.get("links", function(result){ |
|
|
|
browser.storage.sync.get("links", function(result){ |
|
|
|
var input_links = document.querySelectorAll('input[type="text"]') |
|
|
|
for (i = 0; i < input_links.length; i++) { |
|
|
|
input_links[i].value = result.links[i] |
|
|
|
} |
|
|
|
}) |
|
|
|
chrome.storage.sync.get("colors", function(result){ |
|
|
|
browser.storage.sync.get("colors", function(result){ |
|
|
|
var input_colors = document.querySelectorAll('input[type="color"]') |
|
|
|
for (i = 0; i < input_colors.length; i++) { |
|
|
|
if (result.colors[i]) { |
|
|
@ -52,13 +52,13 @@ function restore_options() { |
|
|
|
}) |
|
|
|
} |
|
|
|
function change_mode() { |
|
|
|
chrome.storage.sync.get("mode", function(result){ |
|
|
|
browser.storage.sync.get("mode", function(result){ |
|
|
|
var input_colors = document.querySelectorAll('input[type="color"]') |
|
|
|
switch(result.mode) { |
|
|
|
case "light": |
|
|
|
document.body.classList.add('dark') |
|
|
|
mode = "dark" |
|
|
|
chrome.storage.sync.set({mode:"dark"}) |
|
|
|
browser.storage.sync.set({mode:"dark"}) |
|
|
|
for (i = 0; i < input_colors.length; i++) { |
|
|
|
if (input_colors[i].value == "#cfcfcf") { |
|
|
|
input_colors[i].value = "#323234" |
|
|
@ -69,7 +69,7 @@ function change_mode() { |
|
|
|
case "dark": |
|
|
|
document.body.classList.remove('dark') |
|
|
|
mode = "light" |
|
|
|
chrome.storage.sync.set({mode:"light"}) |
|
|
|
browser.storage.sync.set({mode:"light"}) |
|
|
|
for (i = 0; i < input_colors.length; i++) { |
|
|
|
if (input_colors[i].value == "#323234") { |
|
|
|
input_colors[i].value = "#cfcfcf" |
|
|
|