diff --git a/desktop/sources/scripts/lib/theme.js b/desktop/sources/scripts/lib/theme.js index 2b866e9..a3b3180 100644 --- a/desktop/sources/scripts/lib/theme.js +++ b/desktop/sources/scripts/lib/theme.js @@ -9,17 +9,23 @@ function Theme() this.start = function() { - this.load(localStorage.theme && localStorage.theme.background ? localStorage.theme : this.default); + this.load(localStorage.theme ? localStorage.theme : this.default, this.default); window.addEventListener('dragover',this.drag_enter); window.addEventListener('drop', this.drag); document.head.appendChild(this.el) } - this.load = function(t) + this.load = function(t, fall_back) { var theme = is_json(t) ? JSON.parse(t).data : t.data; - if(!theme.background){ return; } + if(!theme || !theme.background){ + if(fall_back) { + theme = fall_back.data; + } else { + return; + } + } var css = ` :root { @@ -36,7 +42,7 @@ function Theme() this.active = theme; this.el.textContent = css; - localStorage.setItem("theme", JSON.stringify(theme)); + localStorage.setItem("theme", JSON.stringify({data: theme})); } this.reset = function() diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..618bbd9 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,20 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ] +2 info using npm@3.10.10 +3 info using node@v6.11.4 +4 verbose stack Error: ENOENT: no such file or directory, open '/Users/VillaMoirai/Github/HundredRabbits/Dotgrid/package.json' +4 verbose stack at Error (native) +5 verbose cwd /Users/VillaMoirai/Github/HundredRabbits/Dotgrid +6 error Darwin 16.7.0 +7 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" +8 error node v6.11.4 +9 error npm v3.10.10 +10 error path /Users/VillaMoirai/Github/HundredRabbits/Dotgrid/package.json +11 error code ENOENT +12 error errno -2 +13 error syscall open +14 error enoent ENOENT: no such file or directory, open '/Users/VillaMoirai/Github/HundredRabbits/Dotgrid/package.json' +15 error enoent ENOENT: no such file or directory, open '/Users/VillaMoirai/Github/HundredRabbits/Dotgrid/package.json' +15 error enoent This is most likely not a problem with npm itself +15 error enoent and is related to npm not being able to find a file. +16 verbose exit [ -2, true ]