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

Feature: Add a setting to lock title from update

This commit is contained in:
MatMoul 2017-10-21 17:51:35 +02:00
parent 1e5e450565
commit cebdb32c35
4 changed files with 10 additions and 7 deletions

1
TODO
View File

@ -1,5 +1,4 @@
Create style for popup
Add a setting to lock title from update
Add a visual hint for multipage
Need a best solution to update folder and bookmark when it are updated from Firefox
Improve screenshot result

View File

@ -33,16 +33,17 @@
<tr>
<td><span>Title :</span></td>
<td><input id="Title" type="text" style="width:100%"></td>
<td style="width:20px"><input id="TitleLocked" type="checkbox" title="Lock title"></td>
</tr>
<tr>
<td><span>Url :</span></td>
<td><input id="Url" type="text" style="width:100%"></td>
<td colspan="2"><input id="Url" type="text" style="width:100%"></td>
</tr>
<tr>
<td><span>Image :</span></td>
<td>
<td colspan="2">
<button id="ImageReset">Reset</button>
<button id="ImageDefault">Default</button>
<button class="hidden" id="ImageRefresh">Refresh</button>
@ -52,7 +53,7 @@
</tr>
<tr>
<td></td>
<td><div id="ImagePreview" style="width: 300px; height: 180px;"></div></td>
<td colspan="2"><div id="ImagePreview" style="width: 300px; height: 180px;"></div></td>
</tr>

View File

@ -461,6 +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.image) gridNode.image = value.image;
else delete gridNode.image;
if(gridNode.type == app.GridNodes.GridNodeType.bookmark && value.url && gridNode.url != value.url){
@ -579,7 +580,7 @@ app.GridNodes.refreshNode = function(gridNode, callback){ // Refresh content of
case app.GridNodes.GridNodeType.bookmark:
app.SiteInfos.fromFrame(gridNode.url, function(infos){
if(infos){
gridNode.title = infos.title;
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
gridNode.image = infos.screenshot;
} else {
gridNode.image = '0';
@ -615,7 +616,7 @@ app.GridNodes.capturePage = function(gridNode, callback){
case app.GridNodes.GridNodeType.bookmark:
app.SiteInfos.fromNewTab(gridNode.url, function(infos){
if(infos){
gridNode.title = infos.title;
if(gridNode.titleLocked!=true) gridNode.title = infos.title;
gridNode.image = infos.screenshot;
} else {
gridNode.image = '0';

View File

@ -23,6 +23,7 @@ app.init = function(){
ImagePreview.style.backgroundSize = '100% 100%';
switch(node.type){
case app.GridNodes.GridNodeType.folder:
TitleLocked.parentNode.style.display = 'none';
Url.parentNode.parentNode.style.display = 'none';
if(node.image){
if(node.image.indexOf('url(')>0) Image = node.image;
@ -32,6 +33,7 @@ app.init = function(){
else ImagePreview.style.backgroundImage = Image;
break;
case app.GridNodes.GridNodeType.bookmark:
TitleLocked.checked = node.titleLocked;
ImageDefault.style.display = 'none';
Url.value = node.url;
Image = 'url(' + node.image + ')';
@ -97,7 +99,7 @@ app.init = function(){
app.Messages.updateNode(app.node.id, { title: Title.value, image: Image })
break;
case app.GridNodes.GridNodeType.bookmark:
app.Messages.updateNode(app.node.id, { title: Title.value, url: Url.value, image: Image })
app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, url: Url.value, image: Image })
break;
}
}