From 4348e38b3ac4c4e309b7dba614e739837e65a680 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 6 Oct 2017 22:46:15 +0200 Subject: [PATCH] Add back node option --- src/html/settings.html | 4 ++++ src/js/background.js | 6 ++++-- src/js/dial.js | 6 +++--- src/js/settings.js | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/html/settings.html b/src/html/settings.html index d883f7e..2ae5b62 100644 --- a/src/html/settings.html +++ b/src/html/settings.html @@ -61,6 +61,10 @@ Margins : + + Back Button : + + diff --git a/src/js/background.js b/src/js/background.js index ac7801e..01b8bb1 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -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(); diff --git a/src/js/dial.js b/src/js/dial.js index 94b3671..c8f939f 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -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; diff --git a/src/js/settings.js b/src/js/settings.js index 8ddfaa4..f39ed89 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -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);