1
0
mirror of https://github.com/MatMoul/quickdial-webext.git synced 2024-12-23 07:26:11 +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><input id="MenuShowAdd" type="checkbox"></td>
</tr>
<tr>
<td>Open QD in new page :</td>
<td><input id="ButtonOpenInNewPage" type="checkbox"></td>
</tr>
</table>
</div>
<div class="hidden">

View File

@ -4,8 +4,9 @@ app.init = function(){ // Init module
app.Settings.init(function(){
app.Messages.init();
browser.runtime.sendMessage({ cmd: app.Messages.Commands.settingsChanged });
browser.browserAction.onClicked.addListener(function(){
browser.tabs.create({});
browser.browserAction.onClicked.addListener(function(e){
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(){
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
@ -109,6 +110,7 @@ app.Settings.init = function(callback){ // Load settings and nodes
backgroundImage: null,
backgroundMode: 0,
menuShowAdd: true,
openQuickDialInNewPage: true,
grid: {
margin: 10,
rows: 4,
@ -222,6 +224,9 @@ app.Settings.init = function(callback){ // Load settings and nodes
data.settings.grid.openBookmarkMethod = 0;
data.settings.grid.openFolderMethod = 0;
}
if(!data.settings.openQuickDialInNewPage && data.settings.openQuickDialInNewPage != false){
data.settings.openQuickDialInNewPage = true;
}
//app.Settings.save();
}
app.settings = data.settings;

View File

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