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

Feature: Add snapshot delay setting

This commit is contained in:
MatMoul 2017-11-18 00:17:36 +01:00
parent a9a4212299
commit b2bb50d95e
3 changed files with 13 additions and 2 deletions

View File

@ -194,6 +194,10 @@
<td><input id="GridCellsTitleBackgroundColor" type="color"></td> <td><input id="GridCellsTitleBackgroundColor" type="color"></td>
<td><input id="GridCellsTitleBackgroundColorHover" type="color"></td> <td><input id="GridCellsTitleBackgroundColorHover" type="color"></td>
</tr> </tr>
<tr>
<td><span>Snapshot Delay :</span></td>
<td colspan="2"><input id="GridCellsSnapshotDelay" type="number" min="300" max="10000"></td>
</tr>
</table> </table>
</div> </div>
</div> </div>

View File

@ -144,7 +144,8 @@ app.Settings.init = function(callback){ // Load settings and nodes
titleBorderSize: 1, titleBorderSize: 1,
titleBorderSizeHover: 1, titleBorderSizeHover: 1,
previewWidth: 1200, previewWidth: 1200,
previewHeight: 710 previewHeight: 710,
snapshotDelay: 2000
}, },
root: 'Quick Dial', 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; data.settings.grid.cells.titleBorderSizeHover = data.settings.grid.cells.titleBorderSize;
app.Settings.save(); 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.settings = data.settings;
app.node = data.node; app.node = data.node;
if(callback) callback(); if(callback) callback();
@ -326,7 +331,7 @@ app.SiteInfos.fromNewTab = function(url, callback){ // Retrieve infos from a ne
browser.tabs.remove(tab.id); browser.tabs.remove(tab.id);
if(callback) callback(); if(callback) callback();
}); });
}, 500); }, app.settings.grid.cells.snapshotDelay);
}, function(){ if(callback) callback(); }); }, function(){ if(callback) callback(); });
} }
}, function(){ if(callback) callback(); }); }, function(){ if(callback) callback(); });

View File

@ -69,6 +69,7 @@ app.init = function(){
GridCellsTitleBackgroundColor.value = app.settings.grid.cells.titleBackgroundColor; GridCellsTitleBackgroundColor.value = app.settings.grid.cells.titleBackgroundColor;
GridCellsTitleBackgroundColorHover.value = app.settings.grid.cells.titleBackgroundColorHover; GridCellsTitleBackgroundColorHover.value = app.settings.grid.cells.titleBackgroundColorHover;
GridCellsTitleBackgroundTransparentHover.checked = (app.settings.grid.cells.titleBackgroundColorHover == null); GridCellsTitleBackgroundTransparentHover.checked = (app.settings.grid.cells.titleBackgroundColorHover == null);
GridCellsSnapshotDelay.value = app.settings.grid.cells.snapshotDelay;
}); });
BtnOk.onclick = function(){ BtnOk.onclick = function(){
@ -115,6 +116,7 @@ app.init = function(){
else app.settings.grid.cells.titleBackgroundColor = GridCellsTitleBackgroundColor.value; else app.settings.grid.cells.titleBackgroundColor = GridCellsTitleBackgroundColor.value;
if(GridCellsTitleBackgroundTransparentHover.checked == true) app.settings.grid.cells.titleBackgroundColorHover = null; if(GridCellsTitleBackgroundTransparentHover.checked == true) app.settings.grid.cells.titleBackgroundColorHover = null;
else app.settings.grid.cells.titleBackgroundColorHover = GridCellsTitleBackgroundColorHover.value; else app.settings.grid.cells.titleBackgroundColorHover = GridCellsTitleBackgroundColorHover.value;
app.settings.grid.cells.snapshotDelay = GridCellsSnapshotDelay.value;
app.settings.grid.root = GridRoot.value; app.settings.grid.root = GridRoot.value;
browser.runtime.sendMessage( { cmd: app.Messages.Commands.setSettings, settings: app.settings } ); browser.runtime.sendMessage( { cmd: app.Messages.Commands.setSettings, settings: app.settings } );
} }