2017-10-03 17:43:09 +00:00
|
|
|
var BackgroundImage = null;
|
|
|
|
|
|
|
|
window.onload = function(){
|
|
|
|
browser.runtime.getBackgroundPage().then(function(page){
|
|
|
|
app = page.app;
|
|
|
|
BackgroundColor.value = app.settings.backgroundColor;
|
|
|
|
BackgroundImage = app.settings.backgroundImage;
|
2017-10-03 23:50:19 +00:00
|
|
|
BackgroundPreview.style.backgroundColor = app.settings.backgroundColor;
|
|
|
|
BackgroundPreview.style.backgroundImage = app.settings.backgroundImage;
|
|
|
|
BackgroundPreview.style.backgroundRepeat = 'no-repeat';
|
|
|
|
BackgroundPreview.style.backgroundSize = '100% 100%';
|
2017-10-03 17:43:09 +00:00
|
|
|
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;
|
2017-10-03 23:50:19 +00:00
|
|
|
GridCellsMarginsHover.value = app.settings.grid.cells.marginHover;
|
2017-10-03 17:43:09 +00:00
|
|
|
GridCellsBorderRadius.value = app.settings.grid.cells.borderRadius;
|
2017-10-03 23:50:19 +00:00
|
|
|
GridCellsBorderRadiusHover.value = app.settings.grid.cells.borderRadiusHover;
|
2017-10-03 17:43:09 +00:00
|
|
|
GridCellsBorderColor.value = app.settings.grid.cells.borderColor;
|
|
|
|
GridCellsBorderColorHover.value = app.settings.grid.cells.borderColorHover;
|
2017-10-03 23:50:19 +00:00
|
|
|
GridCellsTitle.checked = app.settings.grid.cells.title;
|
|
|
|
GridCellsTitleHeight.value = app.settings.grid.cells.titleHeight;
|
|
|
|
GridCellsTitleFontSize.value = app.settings.grid.cells.titleFontSize;
|
2017-10-03 17:43:09 +00:00
|
|
|
GridCellsTitleColor.value = app.settings.grid.cells.titleColor;
|
|
|
|
GridCellsTitleColorHover.value = app.settings.grid.cells.titleColorHover;
|
|
|
|
});
|
|
|
|
|
|
|
|
BtnOk.onclick = function(){
|
|
|
|
BtnApply.onclick();
|
|
|
|
window.frameElement.popup.close();
|
|
|
|
}
|
|
|
|
BtnApply.onclick = function(){
|
|
|
|
app.settings.backgroundColor = BackgroundColor.value;
|
|
|
|
app.settings.backgroundImage = BackgroundImage;
|
2017-10-03 19:26:51 +00:00
|
|
|
app.settings.grid.rows = +(GridRows.value);
|
|
|
|
app.settings.grid.margin = +(GridMargins.value);
|
|
|
|
app.settings.grid.columns = +(GridColumns.value);
|
|
|
|
app.settings.grid.cells.margin = +(GridCellsMargins.value);
|
2017-10-03 23:50:19 +00:00
|
|
|
//app.settings.grid.cells.marginHover = +(GridCellsMarginsHover.value);
|
|
|
|
app.settings.grid.cells.marginHover = +(GridCellsMargins.value);
|
2017-10-03 19:26:51 +00:00
|
|
|
app.settings.grid.cells.borderRadius = +(GridCellsBorderRadius.value);
|
2017-10-03 23:50:19 +00:00
|
|
|
app.settings.grid.cells.borderRadiusHover = +(GridCellsBorderRadiusHover.value);
|
2017-10-03 17:43:09 +00:00
|
|
|
app.settings.grid.cells.borderColor = GridCellsBorderColor.value;
|
|
|
|
app.settings.grid.cells.borderColorHover = GridCellsBorderColorHover.value;
|
2017-10-03 23:50:19 +00:00
|
|
|
app.settings.grid.cells.title = GridCellsTitle.checked;
|
|
|
|
app.settings.grid.cells.titleHeight = GridCellsTitleHeight.value;
|
|
|
|
app.settings.grid.cells.titleFontSize = GridCellsTitleFontSize.value;
|
2017-10-03 17:43:09 +00:00
|
|
|
app.settings.grid.cells.titleColor = GridCellsTitleColor.value;
|
|
|
|
app.settings.grid.cells.titleColorHover = GridCellsTitleColorHover.value;
|
|
|
|
app.saveSettings();
|
|
|
|
}
|
|
|
|
BtnCancel.onclick = function(){
|
|
|
|
window.frameElement.popup.close();
|
|
|
|
}
|
2017-10-03 23:50:19 +00:00
|
|
|
|
|
|
|
var tabButtons = Tabs.children[0].children[0].children[0];
|
|
|
|
for(var i=0; i<tabButtons.children.length-1; i++){
|
|
|
|
tabButtons.children[i].index = i;
|
|
|
|
tabButtons.children[i].onclick = function(){
|
|
|
|
for(var j=0; j<tabButtons.children.length-1; j++){
|
|
|
|
if(j==this.index){
|
|
|
|
tabButtons.children[j].className = 'TabButtonActive';
|
|
|
|
Tabs.children[1].children[j].className = '';
|
|
|
|
} else {
|
|
|
|
tabButtons.children[j].className = 'TabButton';
|
|
|
|
Tabs.children[1].children[j].className = 'hidden';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundColor.onchange = function(){
|
|
|
|
BackgroundPreview.style.backgroundColor = BackgroundColor.value;
|
|
|
|
}
|
|
|
|
BackgroundImageClear.onclick = function(){
|
|
|
|
BackgroundImage = null;
|
|
|
|
BackgroundPreview.style.backgroundImage = BackgroundImage;
|
|
|
|
}
|
|
|
|
BackgroundImageFile.onclick = function(){
|
|
|
|
this.value = null;
|
|
|
|
}
|
|
|
|
BackgroundImageFile.onchange = function(){
|
|
|
|
var fileReader = new FileReader();
|
|
|
|
fileReader.onload = function(e){
|
|
|
|
BackgroundImage = 'url(' + e.target.result + ')';
|
|
|
|
BackgroundImageFile.value = null;
|
|
|
|
BackgroundPreview.style.backgroundImage = BackgroundImage;
|
|
|
|
}
|
|
|
|
fileReader.readAsDataURL(BackgroundImageFile.files[0]);
|
|
|
|
}
|
|
|
|
|
2017-10-03 17:43:09 +00:00
|
|
|
}
|