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

Feature: Add open in new tab for tiles

This commit is contained in:
MatMoul 2017-11-26 15:47:22 +01:00
parent ce82a4c67e
commit 6815551c8c
4 changed files with 46 additions and 0 deletions

View File

@ -84,6 +84,24 @@
<td><span>Margins :</span></td> <td><span>Margins :</span></td>
<td><input id="GridMargins" type="number" min="0"></td> <td><input id="GridMargins" type="number" min="0"></td>
</tr> </tr>
<tr>
<td><span>Open Bookmarks In :</span></td>
<td>
<select id="GridOpenBookmarksIn">
<option value="0">Default</option>
<option value="1">New Tab</option>
</select>
</td>
</tr>
<tr>
<td><span>Open Folders In :</span></td>
<td>
<select id="GridOpenFoldersIn">
<option value="0">Default</option>
<option value="1">New Tab</option>
</select>
</td>
</tr>
<tr> <tr>
<td><span>Back Button :</span></td> <td><span>Back Button :</span></td>
<td><input id="GridBackNode" type="checkbox"></td> <td><input id="GridBackNode" type="checkbox"></td>

View File

@ -121,6 +121,8 @@ app.Settings.init = function(callback){ // Load settings and nodes
folderIcon: 'url(/img/folder.png)', folderIcon: 'url(/img/folder.png)',
folderIconMode: 0, folderIconMode: 0,
loadingIcon: 'url(/img/throbber.gif)', loadingIcon: 'url(/img/throbber.gif)',
openBookmarkMethod: 0,
openFolderMethod: 0,
cells: { cells: {
margin: 4, margin: 4,
marginHover: 4, marginHover: 4,
@ -216,6 +218,10 @@ app.Settings.init = function(callback){ // Load settings and nodes
if(!(data.settings.menuShowAdd == true) && !(data.settings.menuShowAdd == false)){ if(!(data.settings.menuShowAdd == true) && !(data.settings.menuShowAdd == false)){
data.settings.menuShowAdd = true; data.settings.menuShowAdd = true;
} }
if(!data.settings.grid.openBookmarkMethod && data.settings.grid.openBookmarkMethod != 0){
data.settings.grid.openBookmarkMethod = 0;
data.settings.grid.openFolderMethod = 0;
}
//app.Settings.save(); //app.Settings.save();
} }
app.settings = data.settings; app.settings = data.settings;

View File

@ -477,6 +477,7 @@ dial.populateGrid = function(){
link.Node = null; link.Node = null;
link.className = 'Empty'; link.className = 'Empty';
link.childNodes[0].style.backgroundImage = ''; link.childNodes[0].style.backgroundImage = '';
if(link.target) delete link.target;
link.href = null; link.href = null;
link.onclick = null; link.onclick = null;
link.removeAttribute('contextmenu'); link.removeAttribute('contextmenu');
@ -486,6 +487,7 @@ dial.populateGrid = function(){
link.className = 'Back'; link.className = 'Back';
link.childNodes[0].style.backgroundImage = ''; link.childNodes[0].style.backgroundImage = '';
link.childNodes[1].innerText = 'Back'; link.childNodes[1].innerText = 'Back';
if(link.target) delete link.target;
link.href = '#'; link.href = '#';
link.onclick = function(){ window.history.back(); } link.onclick = function(){ window.history.back(); }
link.removeAttribute('contextmenu'); link.removeAttribute('contextmenu');
@ -500,6 +502,14 @@ dial.populateGrid = function(){
else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')'; else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')';
} else link.childNodes[0].style.backgroundImage = ''; } else link.childNodes[0].style.backgroundImage = '';
link.childNodes[1].innerText = node.title; link.childNodes[1].innerText = node.title;
switch(app.settings.grid.openFolderMethod){
case 0:
if(link.target) delete link.target;
break;
case 1:
link.target = '_blank';
break;
}
if(dial.path) link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(dial.path + 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); else link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(node.title);
link.onclick = null; link.onclick = null;
@ -519,6 +529,14 @@ dial.populateGrid = function(){
dial.refreshNode(link); dial.refreshNode(link);
} }
link.childNodes[1].innerText = node.title; link.childNodes[1].innerText = node.title;
switch(app.settings.grid.openBookmarkMethod){
case 0:
if(link.target) delete link.target;
break;
case 1:
link.target = '_blank';
break;
}
link.href = node.url; link.href = node.url;
link.onclick = null; link.onclick = null;
link.setAttribute('contextmenu', 'item'); link.setAttribute('contextmenu', 'item');

View File

@ -33,6 +33,8 @@ app.init = function(){
GridRatioY.value = app.settings.grid.ratioY; GridRatioY.value = app.settings.grid.ratioY;
GridMargins.value = app.settings.grid.margin; GridMargins.value = app.settings.grid.margin;
GridColumns.value = app.settings.grid.columns; GridColumns.value = app.settings.grid.columns;
GridOpenBookmarksIn.value = app.settings.grid.openBookmarkMethod;
GridOpenFoldersIn.value = app.settings.grid.openFolderMethod;
GridBackNode.checked = app.settings.grid.backNode; GridBackNode.checked = app.settings.grid.backNode;
GridBackMode.value = app.settings.grid.backIconMode; GridBackMode.value = app.settings.grid.backIconMode;
GridBackImage = app.settings.grid.backIcon; GridBackImage = app.settings.grid.backIcon;
@ -89,6 +91,8 @@ app.init = function(){
app.settings.grid.columns = +(GridColumns.value); app.settings.grid.columns = +(GridColumns.value);
app.settings.grid.ratioX = GridRatioX.value; app.settings.grid.ratioX = GridRatioX.value;
app.settings.grid.ratioY = GridRatioY.value; app.settings.grid.ratioY = GridRatioY.value;
app.settings.grid.openBookmarkMethod = +(GridOpenBookmarksIn.value);
app.settings.grid.openFolderMethod = +(GridOpenFoldersIn.value);
app.settings.grid.backNode = GridBackNode.checked; app.settings.grid.backNode = GridBackNode.checked;
app.settings.grid.backIconMode = +(GridBackMode.value); app.settings.grid.backIconMode = +(GridBackMode.value);
app.settings.grid.backIcon = GridBackImage; app.settings.grid.backIcon = GridBackImage;