From 6815551c8c3ecd32f7333e2f5e05f00460f4f2a5 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 26 Nov 2017 15:47:22 +0100 Subject: [PATCH] Feature: Add open in new tab for tiles --- src/html/settings.html | 18 ++++++++++++++++++ src/js/background.js | 6 ++++++ src/js/dial.js | 18 ++++++++++++++++++ src/js/settings.js | 4 ++++ 4 files changed, 46 insertions(+) diff --git a/src/html/settings.html b/src/html/settings.html index 8fe4c90..dc3b570 100644 --- a/src/html/settings.html +++ b/src/html/settings.html @@ -84,6 +84,24 @@ Margins : + + Open Bookmarks In : + + + + + + Open Folders In : + + + + Back Button : diff --git a/src/js/background.js b/src/js/background.js index 4659d26..e2209f9 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -121,6 +121,8 @@ app.Settings.init = function(callback){ // Load settings and nodes folderIcon: 'url(/img/folder.png)', folderIconMode: 0, loadingIcon: 'url(/img/throbber.gif)', + openBookmarkMethod: 0, + openFolderMethod: 0, cells: { margin: 4, marginHover: 4, @@ -216,6 +218,10 @@ app.Settings.init = function(callback){ // Load settings and nodes if(!(data.settings.menuShowAdd == true) && !(data.settings.menuShowAdd == false)){ data.settings.menuShowAdd = true; } + if(!data.settings.grid.openBookmarkMethod && data.settings.grid.openBookmarkMethod != 0){ + data.settings.grid.openBookmarkMethod = 0; + data.settings.grid.openFolderMethod = 0; + } //app.Settings.save(); } app.settings = data.settings; diff --git a/src/js/dial.js b/src/js/dial.js index 6689295..fed6ca6 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -477,6 +477,7 @@ dial.populateGrid = function(){ link.Node = null; link.className = 'Empty'; link.childNodes[0].style.backgroundImage = ''; + if(link.target) delete link.target; link.href = null; link.onclick = null; link.removeAttribute('contextmenu'); @@ -486,6 +487,7 @@ dial.populateGrid = function(){ link.className = 'Back'; link.childNodes[0].style.backgroundImage = ''; link.childNodes[1].innerText = 'Back'; + if(link.target) delete link.target; link.href = '#'; link.onclick = function(){ window.history.back(); } link.removeAttribute('contextmenu'); @@ -500,6 +502,14 @@ dial.populateGrid = function(){ else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')'; } else link.childNodes[0].style.backgroundImage = ''; link.childNodes[1].innerText = node.title; + switch(app.settings.grid.openFolderMethod){ + case 0: + if(link.target) delete link.target; + break; + case 1: + link.target = '_blank'; + break; + } if(dial.path) link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(dial.path + node.title); else link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(node.title); link.onclick = null; @@ -519,6 +529,14 @@ dial.populateGrid = function(){ dial.refreshNode(link); } link.childNodes[1].innerText = node.title; + switch(app.settings.grid.openBookmarkMethod){ + case 0: + if(link.target) delete link.target; + break; + case 1: + link.target = '_blank'; + break; + } link.href = node.url; link.onclick = null; link.setAttribute('contextmenu', 'item'); diff --git a/src/js/settings.js b/src/js/settings.js index 83f89ec..58e0ffc 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -33,6 +33,8 @@ app.init = function(){ GridRatioY.value = app.settings.grid.ratioY; GridMargins.value = app.settings.grid.margin; GridColumns.value = app.settings.grid.columns; + GridOpenBookmarksIn.value = app.settings.grid.openBookmarkMethod; + GridOpenFoldersIn.value = app.settings.grid.openFolderMethod; GridBackNode.checked = app.settings.grid.backNode; GridBackMode.value = app.settings.grid.backIconMode; GridBackImage = app.settings.grid.backIcon; @@ -89,6 +91,8 @@ app.init = function(){ app.settings.grid.columns = +(GridColumns.value); app.settings.grid.ratioX = GridRatioX.value; app.settings.grid.ratioY = GridRatioY.value; + app.settings.grid.openBookmarkMethod = +(GridOpenBookmarksIn.value); + app.settings.grid.openFolderMethod = +(GridOpenFoldersIn.value); app.settings.grid.backNode = GridBackNode.checked; app.settings.grid.backIconMode = +(GridBackMode.value); app.settings.grid.backIcon = GridBackImage;