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

Add back node option

This commit is contained in:
MatMoul 2017-10-06 22:46:15 +02:00
parent 32f96816dd
commit 4348e38b3a
4 changed files with 13 additions and 5 deletions

View File

@ -61,6 +61,10 @@
<td><span>Margins :</span></td> <td><span>Margins :</span></td>
<td><input id="GridMargins" type="number"></td> <td><input id="GridMargins" type="number"></td>
</tr> </tr>
<tr>
<td><span>Back Button :</span></td>
<td><input id="GridBackNode" type="checkbox"></td>
</tr>
</table> </table>
<table> <table>
<tr> <tr>

View File

@ -20,6 +20,7 @@ core.Settings.load = function(callback){ // Load settings
margin: 10, margin: 10,
rows: 4, rows: 4,
columns: 5, columns: 5,
backNode: true,
backIcon: 'url(/img/back.png)', backIcon: 'url(/img/back.png)',
folderIcon: 'url(/img/folder.png)', folderIcon: 'url(/img/folder.png)',
loadingIcon: 'url(/img/throbber.gif)', loadingIcon: 'url(/img/throbber.gif)',
@ -41,8 +42,7 @@ core.Settings.load = function(callback){ // Load settings
titleColor: '#ffffff', titleColor: '#ffffff',
titleColorHover: '#33ccff', titleColorHover: '#33ccff',
titleBackgroundColor: null, titleBackgroundColor: null,
titleBackgroundColorHover: null, titleBackgroundColorHover: null
backPanel: true
}, },
root: 'Quick Dial', root: 'Quick Dial',
node: {} node: {}
@ -50,6 +50,7 @@ core.Settings.load = function(callback){ // Load settings
}).then(function(obj){ }).then(function(obj){
if(!obj.version){ // Upgrade Data Version if(!obj.version){ // Upgrade Data Version
obj.version = 2; obj.version = 2;
obj.grid.backNode = true;
obj.grid.backIcon = 'url(/img/back.png)'; obj.grid.backIcon = 'url(/img/back.png)';
obj.grid.folderIcon = 'url(/img/folder.png)'; obj.grid.folderIcon = 'url(/img/folder.png)';
obj.grid.loadingIcon = 'url(/img/throbber.gif)'; obj.grid.loadingIcon = 'url(/img/throbber.gif)';
@ -60,6 +61,7 @@ core.Settings.load = function(callback){ // Load settings
delete obj.grid.cells.backIcon; delete obj.grid.cells.backIcon;
delete obj.grid.cells.folderIcon; delete obj.grid.cells.folderIcon;
delete obj.grid.cells.loadingIcon; delete obj.grid.cells.loadingIcon;
delete obj.grid.cells.backPanel;
} }
app.settings = obj; app.settings = obj;
if(callback) callback(); if(callback) callback();

View File

@ -202,7 +202,7 @@ dial.initGrid = function(name, settings, container){
function dragstart_handler(ev) { function dragstart_handler(ev) {
var index = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.getAttribute('gridindex')); var index = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.getAttribute('gridindex'));
if(settings.cells.backPanel && dial.path) index -= dial.page; if(settings.backNode && dial.path) index -= dial.page;
console.log(index); console.log(index);
ev.dataTransfer.setData("text/plain", index); ev.dataTransfer.setData("text/plain", index);
} }
@ -220,7 +220,7 @@ dial.initGrid = function(name, settings, container){
} else{ } else{
EndIndex =(dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.getAttribute('gridindex')); EndIndex =(dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.getAttribute('gridindex'));
} }
if(settings.cells.backPanel && dial.path) EndIndex -= dial.page; if(settings.backNode && dial.path) EndIndex -= dial.page;
app.setNodeIndex(dial.Node, StartIndex, EndIndex); app.setNodeIndex(dial.Node, StartIndex, EndIndex);
} }
link.draggable = true; link.draggable = true;
@ -307,7 +307,7 @@ dial.populateGrid = function(grid, settings, node){
var linkItem = 0; var linkItem = 0;
var allCells = settings.rows * settings.columns; var allCells = settings.rows * settings.columns;
var maxCells = allCells; var maxCells = allCells;
if(settings.cells.backPanel && dial.path){ if(settings.backNode && dial.path){
populateBack(grid.getLink(linkItem)); populateBack(grid.getLink(linkItem));
linkItem++; linkItem++;
maxCells -= 1; maxCells -= 1;

View File

@ -14,6 +14,7 @@ window.onload = function(){
GridRows.value = app.settings.grid.rows; GridRows.value = app.settings.grid.rows;
GridMargins.value = app.settings.grid.margin; GridMargins.value = app.settings.grid.margin;
GridColumns.value = app.settings.grid.columns; GridColumns.value = app.settings.grid.columns;
GridBackNode.checked = app.settings.grid.backNode;
GridBackImage = app.settings.grid.backIcon; GridBackImage = app.settings.grid.backIcon;
GridBackPreview.style.backgroundImage = app.settings.grid.backIcon; GridBackPreview.style.backgroundImage = app.settings.grid.backIcon;
GridBackPreview.style.backgroundRepeat = 'no-repeat'; GridBackPreview.style.backgroundRepeat = 'no-repeat';
@ -53,6 +54,7 @@ window.onload = function(){
app.settings.grid.rows = +(GridRows.value); app.settings.grid.rows = +(GridRows.value);
app.settings.grid.margin = +(GridMargins.value); app.settings.grid.margin = +(GridMargins.value);
app.settings.grid.columns = +(GridColumns.value); app.settings.grid.columns = +(GridColumns.value);
app.settings.grid.backNode = GridBackNode.checked;
app.settings.grid.backIcon = GridBackImage; app.settings.grid.backIcon = GridBackImage;
app.settings.grid.folderIcon = GridFolderImage; app.settings.grid.folderIcon = GridFolderImage;
app.settings.grid.cells.margin = +(GridCellsMargins.value); app.settings.grid.cells.margin = +(GridCellsMargins.value);