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

Large change

This commit is contained in:
MatMoul 2017-10-03 21:26:51 +02:00
parent d9646ccbe1
commit 45ad442c19
2 changed files with 13 additions and 5 deletions

View File

@ -15,9 +15,13 @@ window.onload = function(){
switch(request.command){ switch(request.command){
case 'SettingsChanged': case 'SettingsChanged':
if(app.settings){ if(app.settings){
/*
dial.styles.body.backgroundColor = app.settings.backgroundColor; dial.styles.body.backgroundColor = app.settings.backgroundColor;
dial.styles.body.backgroundImage = app.settings.backgroundImage; dial.styles.body.backgroundImage = app.settings.backgroundImage;
*/
dial.Head.removeChild(dial.Style);
dial.Body.removeChild(dial.Grid); dial.Body.removeChild(dial.Grid);
dial.initStyles();
dial.Grid = dial.initGrid('Grid', app.settings.grid, dial.Body); dial.Grid = dial.initGrid('Grid', app.settings.grid, dial.Body);
var url = new URL(window.location); var url = new URL(window.location);
dial.path = url.searchParams.get('path'); dial.path = url.searchParams.get('path');
@ -92,7 +96,7 @@ dial.initStyles = function(){
dial.styles.html = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('html { height: 100%; }')].style; dial.styles.html = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('html { height: 100%; }')].style;
dial.styles.body = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('body { user-select: none; -moz-user-select: none; display: flex; width: 100%; height: 100%; margin: 0px; padding: 0px; background-color: ' + app.settings.backgroundColor + '; background-image: ' + app.settings.backgroundImage + '; background-repeat: no-repeat; background-size: 100% 100%; }')].style; dial.styles.body = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('body { user-select: none; -moz-user-select: none; display: flex; width: 100%; height: 100%; margin: 0px; padding: 0px; background-color: ' + app.settings.backgroundColor + '; background-image: ' + app.settings.backgroundImage + '; background-repeat: no-repeat; background-size: 100% 100%; }')].style;
dial.styles.grid = {}; dial.styles.grid = {};
dial.styles.grid.grid = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid { border-collapse: collapse; margin: auto auto; }')].style; dial.styles.grid.grid = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid { border-collapse: collapse; margin: auto; }')].style;
dial.styles.grid.cell = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td { margin: 0px; padding: 0px; }')].style; dial.styles.grid.cell = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td { margin: 0px; padding: 0px; }')].style;
dial.styles.grid.link = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a { display: block; outline: none; text-decoration: none; margin: ' + app.settings.grid.cells.margin + 'px; border: 1px solid ' + app.settings.grid.cells.borderColor + '; border-radius: ' + app.settings.grid.cells.borderRadius + 'px; }')].style; dial.styles.grid.link = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a { display: block; outline: none; text-decoration: none; margin: ' + app.settings.grid.cells.margin + 'px; border: 1px solid ' + app.settings.grid.cells.borderColor + '; border-radius: ' + app.settings.grid.cells.borderRadius + 'px; }')].style;
dial.styles.grid.linkHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover { border-color: ' + app.settings.grid.cells.borderColorHover + '; }')].style; dial.styles.grid.linkHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover { border-color: ' + app.settings.grid.cells.borderColorHover + '; }')].style;
@ -379,13 +383,16 @@ dial.PopupPanel = function(width, height, modal){ // PopupPanel Object
this.modal.style.height = '100%'; this.modal.style.height = '100%';
this.modal.style.backgroundColor = '#404040'; this.modal.style.backgroundColor = '#404040';
this.modal.style.opacity = 0.5; this.modal.style.opacity = 0.5;
this._contextMenuHandler = function(e){ e.preventDefault(); }
this.popup = function(){ this.popup = function(){
window.addEventListener('contextmenu', this._contextMenuHandler, false);
dial.Body.appendChild(this.modal); dial.Body.appendChild(this.modal);
dial.Body.appendChild(this.panelContainer); dial.Body.appendChild(this.panelContainer);
} }
this.close = function(){ this.close = function(){
dial.Body.removeChild(this.modal); dial.Body.removeChild(this.modal);
dial.Body.removeChild(this.panelContainer); dial.Body.removeChild(this.panelContainer);
window.removeEventListener('contextmenu', this._contextMenuHandler, false);
} }
} else { } else {
this.popup = function(){ this.popup = function(){

View File

@ -37,10 +37,11 @@ window.onload = function(){
BtnApply.onclick = function(){ BtnApply.onclick = function(){
app.settings.backgroundColor = BackgroundColor.value; app.settings.backgroundColor = BackgroundColor.value;
app.settings.backgroundImage = BackgroundImage; app.settings.backgroundImage = BackgroundImage;
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);
app.settings.grid.cells.borderRadius = GridCellsBorderRadius.value; app.settings.grid.cells.margin = +(GridCellsMargins.value);
app.settings.grid.cells.borderRadius = +(GridCellsBorderRadius.value);
app.settings.grid.cells.borderColor = GridCellsBorderColor.value; app.settings.grid.cells.borderColor = GridCellsBorderColor.value;
app.settings.grid.cells.borderColorHover = GridCellsBorderColorHover.value; app.settings.grid.cells.borderColorHover = GridCellsBorderColorHover.value;
app.settings.grid.cells.titleColor = GridCellsTitleColor.value; app.settings.grid.cells.titleColor = GridCellsTitleColor.value;