1
0
mirror of https://github.com/MatMoul/quickdial-webext.git synced 2025-11-21 06:52:06 +00:00

Large change

This commit is contained in:
2017-10-03 19:43:09 +02:00
parent 41c7f0d29a
commit d9646ccbe1
2 changed files with 136 additions and 0 deletions

53
src/js/settings.js Normal file
View File

@@ -0,0 +1,53 @@
var BackgroundImage = null;
window.onload = function(){
browser.runtime.getBackgroundPage().then(function(page){
app = page.app;
BackgroundColor.value = app.settings.backgroundColor;
BackgroundImage = app.settings.backgroundImage;
GridRows.value = app.settings.grid.rows;
GridMargins.value = app.settings.grid.margin;
GridColumns.value = app.settings.grid.columns;
GridCellsMargins.value = app.settings.grid.cells.margin;
GridCellsBorderRadius.value = app.settings.grid.cells.borderRadius;
GridCellsBorderColor.value = app.settings.grid.cells.borderColor;
GridCellsBorderColorHover.value = app.settings.grid.cells.borderColorHover;
GridCellsTitleColor.value = app.settings.grid.cells.titleColor;
GridCellsTitleColorHover.value = app.settings.grid.cells.titleColorHover;
});
BackgroundImageClear.onclick = function(){
BackgroundImage = null;
}
BackgroundImageFile.onclick = function(){
this.value = null;
}
BackgroundImageFile.onchange = function(){
var fileReader = new FileReader();
fileReader.onload = function(e){
BackgroundImage = 'url(' + e.target.result + ')';
}
fileReader.readAsDataURL(BackgroundImageFile.files[0]);
}
BtnOk.onclick = function(){
BtnApply.onclick();
window.frameElement.popup.close();
}
BtnApply.onclick = function(){
app.settings.backgroundColor = BackgroundColor.value;
app.settings.backgroundImage = BackgroundImage;
app.settings.grid.rows = GridRows.value;
app.settings.grid.margin = GridMargins.value;
app.settings.grid.columns = GridColumns.value;
app.settings.grid.cells.borderRadius = GridCellsBorderRadius.value;
app.settings.grid.cells.borderColor = GridCellsBorderColor.value;
app.settings.grid.cells.borderColorHover = GridCellsBorderColorHover.value;
app.settings.grid.cells.titleColor = GridCellsTitleColor.value;
app.settings.grid.cells.titleColorHover = GridCellsTitleColorHover.value;
app.saveSettings();
}
BtnCancel.onclick = function(){
window.frameElement.popup.close();
}
}