From 4faf78eb849b665e996f9437188a36be932c9c7b Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 6 Oct 2017 21:15:20 +0200 Subject: [PATCH] Add folder and back icon settings --- src/js/background.js | 19 +++++++++++-------- src/js/dial.js | 4 ++-- src/js/settings.js | 8 ++++---- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 915908c..d09e106 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -19,6 +19,9 @@ core.Settings.load = function(callback){ // Load settings margin: 10, rows: 4, columns: 5, + backIcon: 'url(/img/back.png)', + folderIcon: 'url(/img/folder.png)', + loadingIcon: 'url(/img/throbber.gif)', cells: { margin: 4, marginHover: 4, @@ -34,19 +37,19 @@ core.Settings.load = function(callback){ // Load settings titleFont: 'Arial, Verdana, Sans-serif', titleColor: '#ffffff', titleColorHover: '#33ccff', - backPanel: true, - backIcon: '/img/back.png', - folderIcon: '/img/folder.png', - loadingIcon: '/img/throbber.gif' + backPanel: true }, root: 'Quick Dial', node: {} } }).then(function(obj){ - if(obj.grid.cells.backIcon == 'img/back.png'){ - obj.grid.cells.backIcon = 'url(/img/back.png)'; - obj.grid.cells.folderIcon = 'url(/img/folder.png)'; - obj.grid.cells.loadingIcon = 'url(/img/throbber.gif)'; + if(!obj.grid.backIcon){ // Upgrade Data Version + obj.grid.backIcon = 'url(/img/back.png)'; + obj.grid.folderIcon = 'url(/img/folder.png)'; + obj.grid.loadingIcon = 'url(/img/throbber.gif)'; + delete obj.grid.cells.backIcon; + delete obj.grid.cells.folderIcon; + delete obj.grid.cells.loadingIcon; } app.settings = obj; if(callback) callback(); diff --git a/src/js/dial.js b/src/js/dial.js index 67a0cec..56d4494 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -101,8 +101,8 @@ dial.initStyles = function(){ dial.styles.grid.linkTitle = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a>div:last-child { height: ' + app.settings.grid.cells.titleHeight + 'px; font-size: ' + app.settings.grid.cells.titleFontSize + 'pt; font-family: ' + app.settings.grid.cells.titleFont + 'pt; text-align: center; overflow: hidden; color: ' + app.settings.grid.cells.titleColor + '; border-top: 1px solid ' + app.settings.grid.cells.borderColor + '; }')].style; dial.styles.grid.linkTitleHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover>div:last-child { color: ' + app.settings.grid.cells.titleColorHover + '; border-top-color: ' + app.settings.grid.cells.borderColorHover + ' }')].style; dial.styles.grid.linkEmpty = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Empty { display: none; }')].style; - dial.styles.grid.linkBack = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Back :first-child { background-image: ' + app.settings.grid.cells.backIcon + '; background-repeat: no-repeat; background-position: center center; }')].style; - dial.styles.grid.linkFolder = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Folder :first-child { background-image: ' + app.settings.grid.cells.folderIcon + '; background-repeat: no-repeat; background-size: 100% 100%; }')].style; + dial.styles.grid.linkBack = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Back :first-child { background-image: ' + app.settings.grid.backIcon + '; background-repeat: no-repeat; background-position: center center; }')].style; + dial.styles.grid.linkFolder = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Folder :first-child { background-image: ' + app.settings.grid.folderIcon + '; background-repeat: no-repeat; background-size: 100% 100%; }')].style; dial.styles.grid.linkBookmark = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Bookmark :first-child { background-repeat: no-repeat; background-size: 100% 100%; }')].style; dial.styles.grid.linkBookmarkLoading = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.BookmarkLoading :first-child { background-image: url("' + app.settings.grid.cells.loadingIcon + '"); background-repeat: no-repeat; background-position: center center; }')].style; } diff --git a/src/js/settings.js b/src/js/settings.js index daf9939..ba02adb 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -15,11 +15,11 @@ window.onload = function(){ GridMargins.value = app.settings.grid.margin; GridColumns.value = app.settings.grid.columns; GridBackImage = app.settings.grid.cells.backIcon; - GridBackPreview.style.backgroundImage = app.settings.grid.cells.backIcon; + GridBackPreview.style.backgroundImage = app.settings.grid.backIcon; GridBackPreview.style.backgroundRepeat = 'no-repeat'; GridBackPreview.style.backgroundPosition = '50% 50%'; GridFolderImage = app.settings.grid.cells.folderIcon; - GridFolderPreview.style.backgroundImage = app.settings.grid.cells.folderIcon; + GridFolderPreview.style.backgroundImage = app.settings.grid.folderIcon; GridFolderPreview.style.backgroundRepeat = 'no-repeat'; GridFolderPreview.style.backgroundSize = '100% 100%'; GridCellsMargins.value = app.settings.grid.cells.margin; @@ -45,8 +45,8 @@ window.onload = function(){ app.settings.grid.rows = +(GridRows.value); app.settings.grid.margin = +(GridMargins.value); app.settings.grid.columns = +(GridColumns.value); - app.settings.grid.cells.backIcon = GridBackImage; - app.settings.grid.cells.folderIcon = GridFolderImage; + app.settings.grid.backIcon = GridBackImage; + app.settings.grid.folderIcon = GridFolderImage; app.settings.grid.cells.margin = +(GridCellsMargins.value); //app.settings.grid.cells.marginHover = +(GridCellsMarginsHover.value); app.settings.grid.cells.marginHover = +(GridCellsMargins.value);