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

Feature: Lock settings for image on tiles

This commit is contained in:
MatMoul 2017-11-24 22:36:53 +01:00
parent 63569851d8
commit ddbd2f40c8
3 changed files with 25 additions and 14 deletions

View File

@ -43,7 +43,7 @@
<tr>
<td><span>Image :</span></td>
<td colspan="2">
<td>
<select id="ImageMode">
<option value="-1">Default</option>
<option value="0">Stretch</option>
@ -57,6 +57,7 @@
<button class="hidden" id="ImageCapture">Capture</button>
<input id="ImageFile" type="file" style="width:180px;">
</td>
<td style="width:20px"><input id="ImageLocked" type="checkbox" title="Lock image"></td>
</tr>
<tr>
<td></td>

View File

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

View File

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