1
0
mirror of https://github.com/MatMoul/quickdial-webext.git synced 2024-12-23 15:36:12 +00:00

Feature: Toolbar button can now open Quick Dial on current dial

This commit is contained in:
MatMoul 2017-11-26 16:33:47 +01:00
parent 6815551c8c
commit 39ab845d58
3 changed files with 17 additions and 2 deletions

View File

@ -62,6 +62,14 @@
<td>Show "Add to ..." :</td> <td>Show "Add to ..." :</td>
<td><input id="MenuShowAdd" type="checkbox"></td> <td><input id="MenuShowAdd" type="checkbox"></td>
</tr> </tr>
<tr>
<td>Open QD in new page :</td>
<td><input id="ButtonOpenInNewPage" type="checkbox"></td>
</tr>
</table> </table>
</div> </div>
<div class="hidden"> <div class="hidden">

View File

@ -4,8 +4,9 @@ app.init = function(){ // Init module
app.Settings.init(function(){ app.Settings.init(function(){
app.Messages.init(); app.Messages.init();
browser.runtime.sendMessage({ cmd: app.Messages.Commands.settingsChanged }); browser.runtime.sendMessage({ cmd: app.Messages.Commands.settingsChanged });
browser.browserAction.onClicked.addListener(function(){ browser.browserAction.onClicked.addListener(function(e){
browser.tabs.create({}); if(app.settings.openQuickDialInNewPage) browser.tabs.create({});
else browser.tabs.update(e.id, {url: '/dial'}).then();
}); });
app.GridNodes.sync(app.node, app.settings.grid.root, function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
@ -109,6 +110,7 @@ app.Settings.init = function(callback){ // Load settings and nodes
backgroundImage: null, backgroundImage: null,
backgroundMode: 0, backgroundMode: 0,
menuShowAdd: true, menuShowAdd: true,
openQuickDialInNewPage: true,
grid: { grid: {
margin: 10, margin: 10,
rows: 4, rows: 4,
@ -222,6 +224,9 @@ app.Settings.init = function(callback){ // Load settings and nodes
data.settings.grid.openBookmarkMethod = 0; data.settings.grid.openBookmarkMethod = 0;
data.settings.grid.openFolderMethod = 0; data.settings.grid.openFolderMethod = 0;
} }
if(!data.settings.openQuickDialInNewPage && data.settings.openQuickDialInNewPage != false){
data.settings.openQuickDialInNewPage = true;
}
//app.Settings.save(); //app.Settings.save();
} }
app.settings = data.settings; app.settings = data.settings;

View File

@ -27,6 +27,7 @@ app.init = function(){
BackgroundPreview.style.backgroundImage = app.settings.backgroundImage; BackgroundPreview.style.backgroundImage = app.settings.backgroundImage;
BackgroundPreview.style.backgroundRepeat = 'no-repeat'; BackgroundPreview.style.backgroundRepeat = 'no-repeat';
BackgroundPreview.style.backgroundSize = '100% 100%'; BackgroundPreview.style.backgroundSize = '100% 100%';
ButtonOpenInNewPage.checked = app.settings.openQuickDialInNewPage;
GridRoot.value = app.settings.grid.root; GridRoot.value = app.settings.grid.root;
GridRows.value = app.settings.grid.rows; GridRows.value = app.settings.grid.rows;
GridRatioX.value = app.settings.grid.ratioX; GridRatioX.value = app.settings.grid.ratioX;
@ -86,6 +87,7 @@ app.init = function(){
app.settings.backgroundColor = BackgroundColor.value; app.settings.backgroundColor = BackgroundColor.value;
app.settings.backgroundImage = BackgroundImage; app.settings.backgroundImage = BackgroundImage;
app.settings.backgroundMode = +(BackgroundMode.value); app.settings.backgroundMode = +(BackgroundMode.value);
app.settings.openQuickDialInNewPage = ButtonOpenInNewPage.checked;
app.settings.grid.rows = +(GridRows.value); app.settings.grid.rows = +(GridRows.value);
app.settings.grid.margin = +(GridMargins.value); app.settings.grid.margin = +(GridMargins.value);
app.settings.grid.columns = +(GridColumns.value); app.settings.grid.columns = +(GridColumns.value);