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

Feature: Add Default button on node properties

This commit is contained in:
MatMoul 2017-10-15 00:25:12 +02:00
parent d3cc6cf68f
commit 39f96b015b
3 changed files with 17 additions and 3 deletions

View File

@ -44,6 +44,7 @@
<td><span>Image :</span></td> <td><span>Image :</span></td>
<td> <td>
<button id="ImageReset">Reset</button> <button id="ImageReset">Reset</button>
<button id="ImageDefault">Default</button>
<button class="hidden" id="ImageRefresh">Refresh</button> <button class="hidden" id="ImageRefresh">Refresh</button>
<button class="hidden" id="ImageCapture">Capture</button> <button class="hidden" id="ImageCapture">Capture</button>
<input id="ImageFile" type="file" style="width:180px;"> <input id="ImageFile" type="file" style="width:180px;">

View File

@ -453,6 +453,7 @@ app.GridNodes.updateNode = function(gridNode, value, callback){
delete gridNode.image; delete gridNode.image;
} }
if(value.image) gridNode.image = value.image; if(value.image) gridNode.image = value.image;
else delete gridNode.image;
app.GridNodes.saveNode(gridNode); app.GridNodes.saveNode(gridNode);
} }
if(callback) callback(gridNode); if(callback) callback(gridNode);

View File

@ -20,11 +20,12 @@ app.init = function(){
if(node.image){ 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 = 'url(' + node.image + ')';
} else Image = app.settings.grid.folderIcon; } else Image = null;
if(Image==null) ImagePreview.style.backgroundImage = app.settings.grid.folderIcon;
ImagePreview.style.backgroundImage = Image; else ImagePreview.style.backgroundImage = Image;
break; break;
case app.GridNodes.GridNodeType.bookmark: case app.GridNodes.GridNodeType.bookmark:
ImageDefault.style.display = 'none';
Url.value = node.url; Url.value = node.url;
Image = 'url(' + node.image + ')'; Image = 'url(' + node.image + ')';
ImagePreview.style.backgroundImage = Image; ImagePreview.style.backgroundImage = Image;
@ -49,6 +50,17 @@ app.init = function(){
} }
}; };
ImageDefault.onclick = function(){
switch(node.type){
case app.GridNodes.GridNodeType.folder:
Image = null;
ImagePreview.style.backgroundImage = app.settings.grid.folderIcon;
break;
case app.GridNodes.GridNodeType.bookmark:
break;
}
};
ImageFile.onclick = function(){ ImageFile.onclick = function(){
this.value = null; this.value = null;