From ddbd2f40c8bcfb7c3496dd4e123c7d457f49f3ba Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 24 Nov 2017 22:36:53 +0100 Subject: [PATCH] Feature: Lock settings for image on tiles --- src/html/properties.html | 3 ++- src/js/background.js | 32 ++++++++++++++++++++------------ src/js/properties.js | 4 +++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/html/properties.html b/src/html/properties.html index 2e2ad6f..d4d0b87 100644 --- a/src/html/properties.html +++ b/src/html/properties.html @@ -43,7 +43,7 @@ Image : - + + diff --git a/src/js/background.js b/src/js/background.js index 84e07b4..cb15629 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -544,8 +544,11 @@ app.GridNodes.updateNode = function(gridNode, value, callback){ if(value){ if(value.title) gridNode.title = value.title; if(value.titleLocked!=null) gridNode.titleLocked = value.titleLocked; - if(value.image) gridNode.image = value.image; - else delete gridNode.image; + if(value.imageLocked!=null) gridNode.imageLocked = value.imageLocked; + if(gridNode.imageLocked == false){ + if(value.image) gridNode.image = value.image; + else delete gridNode.image; + } if(value.imageMode || value.imageMode == 0) { if(value.imageMode == -1) delete gridNode.imageMode; else gridNode.imageMode = value.imageMode; @@ -688,12 +691,15 @@ app.GridNodes.refreshNode = function(gridNode, callback){ // Refresh content of break; case app.GridNodes.GridNodeType.bookmark: app.SiteInfos.fromFrame(gridNode.url, function(infos){ - if(infos){ - if(gridNode.titleLocked!=true) gridNode.title = infos.title; - gridNode.image = infos.screenshot; - } else { - gridNode.image = '0'; + if(gridNode.imageLocked!=true){ + if(infos){ + if(gridNode.titleLocked!=true) gridNode.title = infos.title; + gridNode.image = infos.screenshot; + } else { + gridNode.image = '0'; + } } + delete gridNode.__isLoading; app.GridNodes.saveNode(gridNode); if(callback) callback(infos); @@ -728,11 +734,13 @@ app.GridNodes.capturePage = function(gridNode, callback){ break; case app.GridNodes.GridNodeType.bookmark: app.SiteInfos.fromNewTab(gridNode.url, function(infos){ - if(infos){ - if(gridNode.titleLocked!=true) gridNode.title = infos.title; - gridNode.image = infos.screenshot; - } else { - gridNode.image = '0'; + if(gridNode.imageLocked!=true){ + if(infos){ + if(gridNode.titleLocked!=true) gridNode.title = infos.title; + gridNode.image = infos.screenshot; + } else { + gridNode.image = '0'; + } } delete gridNode.__isLoading; app.GridNodes.saveNode(gridNode); diff --git a/src/js/properties.js b/src/js/properties.js index cfcd6bc..0ceeeee 100644 --- a/src/js/properties.js +++ b/src/js/properties.js @@ -26,6 +26,7 @@ app.init = function(){ switch(node.type){ case app.GridNodes.GridNodeType.folder: TitleLocked.parentNode.style.display = 'none'; + ImageLocked.parentNode.style.display = 'none'; Url.parentNode.parentNode.style.display = 'none'; if(node.image){ if(node.image.indexOf('url(')>=0) Image = node.image; @@ -36,6 +37,7 @@ app.init = function(){ break; case app.GridNodes.GridNodeType.bookmark: TitleLocked.checked = (node.titleLocked==true); + ImageLocked.checked = (node.imageLocked==true); ImageDefault.style.display = 'none'; Url.value = node.url; if(node.image.indexOf('url(')>=0) Image = node.image; @@ -102,7 +104,7 @@ app.init = function(){ app.Messages.updateNode(app.node.id, { title: Title.value, image: Image, imageMode: +(ImageMode.value) }) break; case app.GridNodes.GridNodeType.bookmark: - app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, url: Url.value, image: Image, imageMode: +(ImageMode.value) }) + app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, imageLocked: ImageLocked.checked, url: Url.value, image: Image, imageMode: +(ImageMode.value) }) break; } }