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

Add startpage timeout settings

This commit is contained in:
MatMoul 2019-01-03 21:06:23 +01:00
parent cc1006042d
commit 941772844a
3 changed files with 799 additions and 786 deletions

View File

@ -68,6 +68,10 @@
<td><input id="ButtonOpenInNewPage" type="checkbox"></td> <td><input id="ButtonOpenInNewPage" type="checkbox"></td>
</tr> </tr>
<tr>
<td>Startpage timeout :</td>
<td><input id="StartupTimeout" type="number"></td>
</tr>
</table> </table>

View File

@ -8,13 +8,16 @@ app.init = function(){ // Init module
if(app.settings.openQuickDialInNewPage) browser.tabs.create({}); if(app.settings.openQuickDialInNewPage) browser.tabs.create({});
else browser.tabs.update(e.id, {url: '/dial'}).then(); 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 }); browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
app.Bookmarks.initListener();
app.ContextMenus.initMenu(); app.ContextMenus.initMenu();
window.setTimeout(function(){
app.GridNodes.sync(app.node, app.settings.grid.root, function(){
app.Bookmarks.initListener();
}); });
}, 500);
// Start page workaround : // Start page workaround :
if(app.settings.startpageTimeout>0){
setTimeout(function(){ setTimeout(function(){
browser.tabs.query({}).then( function(tabs) { browser.tabs.query({}).then( function(tabs) {
tabs.forEach(function(itm){ tabs.forEach(function(itm){
@ -23,7 +26,8 @@ app.init = function(){ // Init module
} }
}); });
}); });
}, 500); }, app.settings.startpageTimeout);
}
}); });
}; };
@ -238,6 +242,9 @@ app.Settings.init = function(callback){ // Load settings and nodes
} }
if(!data.settings.openQuickDialInNewPage && data.settings.openQuickDialInNewPage != false){ if(!data.settings.openQuickDialInNewPage && data.settings.openQuickDialInNewPage != false){
data.settings.openQuickDialInNewPage = true; data.settings.openQuickDialInNewPage = true;
}
if(!data.settings.startpageTimeout){
data.settings.startpageTimeout = 500;
} }
//app.Settings.save(); //app.Settings.save();
} }

View File

@ -28,6 +28,7 @@ app.init = function(){
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; ButtonOpenInNewPage.checked = app.settings.openQuickDialInNewPage;
StartupTimeout.value = app.settings.startpageTimeout;
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;
@ -88,6 +89,7 @@ app.init = function(){
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.openQuickDialInNewPage = ButtonOpenInNewPage.checked;
app.settings.startpageTimeout = StartupTimeout.value;
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);