diff --git a/TODO b/TODO
index a71ed01..3ba1710 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,4 @@
Create style for popup
-Add a setting to customize bookmark root folder
Add a setting to lock title from update
Add a visual hint for multipage
Need a best solution to update folder and bookmark when it are updated from Firefox
diff --git a/src/html/settings.html b/src/html/settings.html
index 2ae5b62..5441286 100644
--- a/src/html/settings.html
+++ b/src/html/settings.html
@@ -15,7 +15,7 @@
.Tab .TabSpace { width: 100%; border-bottom: solid 1px #505050; }
.Tab .TabButton { border: solid 1px #505050; padding: 2px 6px 2px 6px; cursor: default; }
.Tab .TabButtonActive { border: solid 1px #505050; border-bottom: none; padding: 2px 6px 2px 6px; cursor: default; }
- .Tab>div { padding: 8px; height: 330px; border-left: solid 1px #505050; border-bottom: solid 1px #505050; border-right: solid 1px #505050; }
+ .Tab>div { padding: 8px; height: 350px; border-left: solid 1px #505050; border-bottom: solid 1px #505050; border-right: solid 1px #505050; }
@@ -82,6 +82,12 @@
+
diff --git a/src/js/background.js b/src/js/background.js
index 111b339..f54efd8 100644
--- a/src/js/background.js
+++ b/src/js/background.js
@@ -38,11 +38,17 @@ app.Messages.init = function(){ // Init Messages Listeners
sendResponse(app.settings);
break;
case app.Messages.Commands.setSettings:
+ let rootChanged = (app.settings.grid.root!=request.settings.grid.root);
app.settings = request.settings;
app.Settings.save();
sendResponse(app.settings);
browser.runtime.sendMessage( { cmd: app.Messages.Commands.settingsChanged } );
- browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
+ if(rootChanged){
+ app.node = { children: [] };
+ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); });
+ } else {
+ browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
+ }
break;
case app.Messages.Commands.getNodeByID:
var nodes = app.GridNodes.getNodeWithParents(request.id);
@@ -212,7 +218,9 @@ app.Bookmarks.initListener = function(){ // (Called from app.init) (/!\ Need fil
}
app.Bookmarks.load = function(rootPath, callback){ // Load root bookmark and create it if not exist
if(!callback) return;
- browser.bookmarks.getSubTree('menu________').then(function(bookmarkItems){
+ var root = 'menu________';
+ if(rootPath.substr(0,1)=='/') root = 'root________';
+ browser.bookmarks.getSubTree(root).then(function(bookmarkItems){
function getChildItem(bookmarkItem, path, callback){
if(path.length == 0){
callback(bookmarkItem);
@@ -228,7 +236,8 @@ app.Bookmarks.load = function(rootPath, callback){ // Load root bookmark and cre
return getChildItem(bookmarkItem, path.substr(bookmarkItem.title.length + 1), callback);
}, function(){ callback(); });
}
- getChildItem(bookmarkItems[0], rootPath, callback);
+ if(rootPath.substr(0,1)=='/') getChildItem(bookmarkItems[0], rootPath.substr(1), callback);
+ else getChildItem(bookmarkItems[0], rootPath, callback);
}, function(){ callback(); });
}
diff --git a/src/js/dial.js b/src/js/dial.js
index 84886c7..3530758 100644
--- a/src/js/dial.js
+++ b/src/js/dial.js
@@ -483,7 +483,7 @@ dial.PopupPanel = function(width, height, modal){ // PopupPanel Object
}
dial.editSettings = function(){
- var popup = new dial.PopupPanel(500, 420, true);
+ var popup = new dial.PopupPanel(500, 440, true);
var iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = '100%';
diff --git a/src/js/settings.js b/src/js/settings.js
index de381f6..c921771 100644
--- a/src/js/settings.js
+++ b/src/js/settings.js
@@ -18,6 +18,7 @@ app.init = function(){
BackgroundPreview.style.backgroundImage = app.settings.backgroundImage;
BackgroundPreview.style.backgroundRepeat = 'no-repeat';
BackgroundPreview.style.backgroundSize = '100% 100%';
+ GridRoot.value = app.settings.grid.root;
GridRows.value = app.settings.grid.rows;
GridMargins.value = app.settings.grid.margin;
GridColumns.value = app.settings.grid.columns;
@@ -84,6 +85,7 @@ app.init = function(){
else app.settings.grid.cells.titleBackgroundColor = GridCellsTitleBackgroundColor.value;
if(GridCellsTitleBackgroundTransparentHover.checked == true) app.settings.grid.cells.titleBackgroundColorHover = null;
else app.settings.grid.cells.titleBackgroundColorHover = GridCellsTitleBackgroundColorHover.value;
+ app.settings.grid.root = GridRoot.value;
browser.runtime.sendMessage( { cmd: app.Messages.Commands.setSettings, settings: app.settings } );
}
BtnCancel.onclick = function(){