1
0
mirror of https://github.com/MatMoul/quickdial-webext.git synced 2024-12-23 07:26:11 +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><input id="GridMargins" type="number"></td>
</tr>
<tr>
<td><span>Back Button :</span></td>
<td><input id="GridBackNode" type="checkbox"></td>
</tr>
</table>
<table>
<tr>

View File

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

View File

@ -202,7 +202,7 @@ dial.initGrid = function(name, settings, container){
function dragstart_handler(ev) {
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);
ev.dataTransfer.setData("text/plain", index);
}
@ -220,7 +220,7 @@ dial.initGrid = function(name, settings, container){
} else{
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);
}
link.draggable = true;
@ -307,7 +307,7 @@ dial.populateGrid = function(grid, settings, node){
var linkItem = 0;
var allCells = settings.rows * settings.columns;
var maxCells = allCells;
if(settings.cells.backPanel && dial.path){
if(settings.backNode && dial.path){
populateBack(grid.getLink(linkItem));
linkItem++;
maxCells -= 1;

View File

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