diff --git a/src/js/background.js b/src/js/background.js index 7ffab39..0361826 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -28,7 +28,6 @@ core.Messages.Commands = { }; core.Messages.init = function(){ // Init Messages Listeners browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ - console.log(request.cmd); switch(request.cmd){ case core.Messages.Commands.getSettings: sendResponse(core.settings); diff --git a/src/js/dial.js b/src/js/dial.js index 40129d7..07ba86f 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -5,8 +5,8 @@ var dial = { maxpage: 1 }; - document.addEventListener("DOMContentLoaded", function(event) { + document.body.style.backgroundColor = utils.getBackgroundColor(); app.init(); dial.init(); }); @@ -32,14 +32,15 @@ window.onwheel = function(ev){ +utils.getBackgroundColor = function(){ + return new URL(window.location).searchParams.get('bg'); +}; utils.getPath = function(){ var path = new URL(window.location).searchParams.get('path'); if(path) return path + '/'; else return '/'; }; - - app.init = function(){ app.Messages.getSettings(function(settings){ if(settings && settings.grid) app.Settings._changed(settings); @@ -100,6 +101,7 @@ app.Messages.capturePage = function(id, callback){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.capturePage, path: dial.path, id: id }).then(callback); } + app.Settings = {}; app.Settings._changed = function(settings){ app.settings = settings; @@ -324,8 +326,8 @@ dial.populateGrid = function(){ link.className = 'Folder'; link.childNodes[0].style.backgroundImage = ''; link.childNodes[1].innerText = node.title; - if(dial.path) link.href = '?path=' + dial.path + node.title; - else link.href = '?path=' + node.title; + if(dial.path) link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + dial.path + node.title; + else link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + node.title; link.onclick = null; link.setAttribute('contextmenu', 'item'); }