From b2bb50d95e69ed44c04c940965bc5e0e6a16e741 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sat, 18 Nov 2017 00:17:36 +0100 Subject: [PATCH] Feature: Add snapshot delay setting --- src/html/settings.html | 4 ++++ src/js/background.js | 9 +++++++-- src/js/settings.js | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/html/settings.html b/src/html/settings.html index 18bc4cd..925a1c0 100644 --- a/src/html/settings.html +++ b/src/html/settings.html @@ -194,6 +194,10 @@ + + Snapshot Delay : + + diff --git a/src/js/background.js b/src/js/background.js index 94bf8fc..c1d035e 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -144,7 +144,8 @@ app.Settings.init = function(callback){ // Load settings and nodes titleBorderSize: 1, titleBorderSizeHover: 1, previewWidth: 1200, - previewHeight: 710 + previewHeight: 710, + snapshotDelay: 2000 }, root: 'Quick Dial', } @@ -197,6 +198,10 @@ app.Settings.init = function(callback){ // Load settings and nodes data.settings.grid.cells.titleBorderSizeHover = data.settings.grid.cells.titleBorderSize; app.Settings.save(); } + if(data.version == 4){ // Upgrade Data Version + if(!data.settings.grid.cells.snapshotDelay) data.settings.grid.cells.snapshotDelay = 2000; + //app.Settings.save(); + } app.settings = data.settings; app.node = data.node; if(callback) callback(); @@ -326,7 +331,7 @@ app.SiteInfos.fromNewTab = function(url, callback){ // Retrieve infos from a ne browser.tabs.remove(tab.id); if(callback) callback(); }); - }, 500); + }, app.settings.grid.cells.snapshotDelay); }, function(){ if(callback) callback(); }); } }, function(){ if(callback) callback(); }); diff --git a/src/js/settings.js b/src/js/settings.js index 7c898d1..ea37bba 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -69,6 +69,7 @@ app.init = function(){ GridCellsTitleBackgroundColor.value = app.settings.grid.cells.titleBackgroundColor; GridCellsTitleBackgroundColorHover.value = app.settings.grid.cells.titleBackgroundColorHover; GridCellsTitleBackgroundTransparentHover.checked = (app.settings.grid.cells.titleBackgroundColorHover == null); + GridCellsSnapshotDelay.value = app.settings.grid.cells.snapshotDelay; }); BtnOk.onclick = function(){ @@ -115,6 +116,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.cells.snapshotDelay = GridCellsSnapshotDelay.value; app.settings.grid.root = GridRoot.value; browser.runtime.sendMessage( { cmd: app.Messages.Commands.setSettings, settings: app.settings } ); }