1
0
mirror of https://github.com/MatMoul/quickdial-webext.git synced 2024-12-23 15:36:12 +00:00

Bug reported by Scienmind: Background color flickering on subfolder

This commit is contained in:
MatMoul 2017-10-14 18:53:59 +02:00
parent d6ee45da30
commit 420f356136
2 changed files with 7 additions and 6 deletions

View File

@ -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);

View File

@ -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');
}