From 45ad442c19a4b0a1c51709781ff17c3de0d47ea1 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Tue, 3 Oct 2017 21:26:51 +0200 Subject: [PATCH] Large change --- src/js/dial.js | 9 ++++++++- src/js/settings.js | 9 +++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/js/dial.js b/src/js/dial.js index 0583a1a..980aa17 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -15,9 +15,13 @@ window.onload = function(){ switch(request.command){ case 'SettingsChanged': if(app.settings){ + /* dial.styles.body.backgroundColor = app.settings.backgroundColor; dial.styles.body.backgroundImage = app.settings.backgroundImage; + */ + dial.Head.removeChild(dial.Style); dial.Body.removeChild(dial.Grid); + dial.initStyles(); dial.Grid = dial.initGrid('Grid', app.settings.grid, dial.Body); var url = new URL(window.location); 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.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.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.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; @@ -379,13 +383,16 @@ dial.PopupPanel = function(width, height, modal){ // PopupPanel Object this.modal.style.height = '100%'; this.modal.style.backgroundColor = '#404040'; this.modal.style.opacity = 0.5; + this._contextMenuHandler = function(e){ e.preventDefault(); } this.popup = function(){ + window.addEventListener('contextmenu', this._contextMenuHandler, false); dial.Body.appendChild(this.modal); dial.Body.appendChild(this.panelContainer); } this.close = function(){ dial.Body.removeChild(this.modal); dial.Body.removeChild(this.panelContainer); + window.removeEventListener('contextmenu', this._contextMenuHandler, false); } } else { this.popup = function(){ diff --git a/src/js/settings.js b/src/js/settings.js index b2ac942..6507f88 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -37,10 +37,11 @@ window.onload = function(){ 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.rows = +(GridRows.value); + app.settings.grid.margin = +(GridMargins.value); + app.settings.grid.columns = +(GridColumns.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.borderColorHover = GridCellsBorderColorHover.value; app.settings.grid.cells.titleColor = GridCellsTitleColor.value;