From 5e61b65e82bd47eb3cb6b861faa4f56670ce7a2c Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sat, 21 Oct 2017 18:03:30 +0200 Subject: [PATCH] Bug: (Properties) Image is lost when clicking OK and Unlock title don't work --- src/js/background.js | 2 +- src/js/dial.js | 9 ++++++--- src/js/properties.js | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 35f2b63..525b2de 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -461,7 +461,7 @@ app.GridNodes.getNodeWithParents = function(id){ app.GridNodes.updateNode = function(gridNode, value, callback){ if(value){ if(value.title) gridNode.title = value.title; - if(value.titleLocked) gridNode.titleLocked = value.titleLocked; + if(value.titleLocked!=null) gridNode.titleLocked = value.titleLocked; if(value.image) gridNode.image = value.image; else delete gridNode.image; if(gridNode.type == app.GridNodes.GridNodeType.bookmark && value.url && gridNode.url != value.url){ diff --git a/src/js/dial.js b/src/js/dial.js index cfd241d..c56f019 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -354,8 +354,10 @@ dial.populateGrid = function(){ populateFolder = function(link, node){ link.Node = node; link.className = 'Folder'; - if(node.image) link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')'; - else link.childNodes[0].style.backgroundImage = ''; + if(node.image){ + if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image; + else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')'; + } else link.childNodes[0].style.backgroundImage = ''; link.childNodes[1].innerText = node.title; if(dial.path) link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(dial.path + node.title); else link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(node.title); @@ -366,7 +368,8 @@ dial.populateGrid = function(){ link.Node = node; if(node.image){ link.className = 'Bookmark'; - link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')'; + if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image; + else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')'; } else { link.className = 'BookmarkLoading'; link.childNodes[0].style.backgroundImage = ''; diff --git a/src/js/properties.js b/src/js/properties.js index 1e7a9e2..d205788 100644 --- a/src/js/properties.js +++ b/src/js/properties.js @@ -26,17 +26,18 @@ app.init = function(){ TitleLocked.parentNode.style.display = 'none'; Url.parentNode.parentNode.style.display = 'none'; if(node.image){ - if(node.image.indexOf('url(')>0) Image = node.image; + if(node.image.indexOf('url(')>=0) Image = node.image; else Image = 'url(' + node.image + ')'; } else Image = null; if(Image==null) ImagePreview.style.backgroundImage = app.settings.grid.folderIcon; else ImagePreview.style.backgroundImage = Image; break; case app.GridNodes.GridNodeType.bookmark: - TitleLocked.checked = node.titleLocked; + TitleLocked.checked = (node.titleLocked==true); ImageDefault.style.display = 'none'; Url.value = node.url; - Image = 'url(' + node.image + ')'; + if(node.image.indexOf('url(')>=0) Image = node.image; + else Image = 'url(' + node.image + ')'; ImagePreview.style.backgroundImage = Image; break; }