Browse Source

further fixed some exception checks

dev
Kyle Mitchell 2 years ago
parent
commit
6614b19843
  1. 8
      js/index.js
  2. 8
      js/options.js

8
js/index.js

@ -3,10 +3,10 @@ function restore_options() {
console.log("Loading Settings", result)
var quads = document.getElementsByClassName("quadrant")
var style = document.createElement("style")
if (! typeof result === "undefined") {
if (! typeof result.links) result.links = []
if (! typeof result.colors) result.colors = []
if (! typeof result.mode) result.mode = "light"
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]

8
js/options.js

@ -21,10 +21,10 @@ function restore_options() {
console.log("Loading Settings", result)
var input_links = document.querySelectorAll('input[type="text"]')
var input_colors = document.querySelectorAll('input[type="color"]')
if (! typeof result === "undefined") {
if (! typeof result.links) result.links = []
if (! typeof result.colors) result.colors = []
if (! typeof result.mode) result.mode = "light"
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 < input_links.length; i++) {
if (i < result.links.length) {
input_links[i].value = result.links[i]

Loading…
Cancel
Save