|
|
@ -3,11 +3,16 @@ function restore_options() { |
|
|
|
console.log("Loading Settings", result) |
|
|
|
var quads = document.getElementsByClassName("quadrant") |
|
|
|
var style = document.createElement("style") |
|
|
|
if (result) { |
|
|
|
if (! typeof result === "undefined") { |
|
|
|
if (! typeof result.links) result.links = [] |
|
|
|
if (! typeof result.colors) result.colors = [] |
|
|
|
if (! typeof result.mode) result.mode = "light" |
|
|
|
for (i = 0; i < quads.length; i++) { |
|
|
|
if (i < result.links.length) { |
|
|
|
var link = result.links[i] |
|
|
|
if (link.substring(0,4) == "http") { |
|
|
|
if (link == "") { |
|
|
|
quads[i].href = "options.html" |
|
|
|
} else if (link.substring(0,4) == "http") { |
|
|
|
quads[i].href = link |
|
|
|
} else { |
|
|
|
quads[i].href = "http://" + link |
|
|
@ -26,16 +31,12 @@ function restore_options() { |
|
|
|
browser.storage.sync.set({links:result.links}) |
|
|
|
} |
|
|
|
} |
|
|
|
if (result.mode) { |
|
|
|
if (result.mode == "dark") { |
|
|
|
document.body.classList.add("dark") |
|
|
|
} else { |
|
|
|
document.body.classList.remove("dark") |
|
|
|
} |
|
|
|
if (result.mode == "dark") { |
|
|
|
document.body.classList.add("dark") |
|
|
|
} else { |
|
|
|
result.mode = "light" |
|
|
|
browser.storage.sync.set({mode:result.mode}) |
|
|
|
document.body.classList.remove("dark") |
|
|
|
} |
|
|
|
|
|
|
|
document.head.appendChild(style) |
|
|
|
} |
|
|
|
}) |
|
|
|