From 49683caff8ea519d6792f008fdb147f78c5230e3 Mon Sep 17 00:00:00 2001 From: zeejot <> Date: Sun, 13 Oct 2019 22:41:39 +0200 Subject: [PATCH] adjust indent --- htdocs/css/style.css | 311 ++++++++++++++++++++++--------------------- htdocs/index.html | 13 +- htdocs/js/options.js | 14 +- htdocs/js/wui.js | 39 ++++-- 4 files changed, 194 insertions(+), 183 deletions(-) diff --git a/htdocs/css/style.css b/htdocs/css/style.css index 60a73ef52..bdc8f512a 100644 --- a/htdocs/css/style.css +++ b/htdocs/css/style.css @@ -13,7 +13,7 @@ html { --button-text-color: hsl(var(--hue), 90%, 10%); --button-background: hsl(var(--hue), 100%, 97%); - --slider-color: hsl(var(--hue), 100%, 100%); /* --background; */ + --slider-color: var(--background); --slider-color-on: hsl(var(--hue), 100%, 77%); --slider-color-off: hsl(var(--hue), 50%, 10%); --slider-color-bg: hsl(var(--hue), 20%, 70%); @@ -30,17 +30,17 @@ html[data-theme='dark'] { --text-color-richer: hsl(var(--hue), 50%, 80%); --text-color-highlight: hsl(var(--accent-hue), 70%, 80%); --link-color: hsl(var(--hue), 90%, 70%); - --accent-color: hsl(var(--accent-hue), 100%, 70%); + --accent-color: hsl(var(--accent-hue), 100%, 20%); --h3-color: hsl(var(--hue), 66%, 28%); --button-border-color: hsl(var(--hue), 66%, 40%); --button-text-color: hsl(var(--hue), 10%, 90%); --button-background: hsl(var(--hue), 66%, 40%); - --slider-color: hsl(var(--hue), 10%, 10%); /* --background */ - --slider-color-on: hsl(var(--hue), 66%, 40%); /* --button-background; */ + --slider-color: var(--text-color-normal); + --slider-color-on: hsl(var(--hue), 66%, 40%); --slider-color-off: hsl(var(--hue), 50%, 10%); - --slider-color-bg: hsl(var(--hue), 30%, 10%); + --slider-color-bg: hsl(var(--hue), 100%, 10%); --background: hsl(var(--hue), 10%, 10%); --background-vlight: hsl(var(--hue), 10%, 15%);; @@ -48,52 +48,37 @@ html[data-theme='dark'] { --background-richer: hsl(var(--hue), 45%, 35%); } -/* transition effect for theme toggling */ -html.color-theme-in-transition, -html.color-theme-in-transition *, -html.color-theme-in-transition *:before, -html.color-theme-in-transition *:after { - transition: all 500ms !important; - transition-delay: 0 !important; -} - -/* theming the scroll bar on mac */ -.docs-page__content { - background: var(--background); - overflow-y: auto; -} - body { - color: var(--text-color-normal); - background-color: var(--background); - margin: 0; - padding: 0; - font-family: sans-serif; + color: var(--text-color-normal); + background-color: var(--background); + margin: 0; + padding: 0; + font-family: sans-serif; } table { - background-color: var(--background-light); - border-collapse: collapse; - border-color: var(--backgroud-richer); - empty-cells: show; - width: 100%; - border: 0px solid; + background-color: var(--background-light); + border-collapse: collapse; + border-color: var(--backgroud-richer); + empty-cells: show; + width: 100%; + border: 0px solid; } thead tr { - color: var(--text-color-normal); - background-color: var(--background-richer); - text-align: left; - font-size: 0.9em; + color: var(--text-color-normal); + background-color: var(--background-richer); + text-align: left; + font-size: 0.9em; } tr, td, span, a, p, li { - color: var(--text-color-normal); + color: var(--text-color-normal); } input, select { - color: var(--button-text-color); - background-color: var(--background-vlight); + color: var(--button-text-color); + background-color: var(--background-vlight); } /* zebra style */ @@ -102,262 +87,265 @@ tr:nth-child(even) {background-color: var(--background-vlight);} tr.optional, tr.stale td.min, tr.stale td.max, tr.stale td.average, tr.stale td.last, tr.stale td.consumption, tr.stale td.cost, tr.stale td.total { - color: var(--text-color-light); + color: var(--text-color-light); } table.properties th:not(:first-child) { - border-bottom: 1px solid var(--background); + border-bottom: 1px solid var(--background); } table.properties tr:not(:first-child) { - border-top: 1px solid var(--background); + border-top: 1px solid var(--background); } td input:not([type=image]):not([type=checkbox]) { - width: 100%; + width: 100%; } #content { - padding: 10px; + padding: 10px; } #content div { - padding: 2px 0; - display: block; + padding: 2px 0; + display: block; } #content h3 { - background-color: var(--h3-color); - padding: 4px; - margin: 2px 0; - cursor: pointer; - font-size: 0.9em; + background-color: var(--h3-color); + padding: 4px; + margin: 2px 0; + cursor: pointer; + font-size: 0.9em; } #content h3 img { - vertical-align: bottom; + vertical-align: bottom; } #plot { - position: relative; + position: relative; } .legend { - background-color: var(--background); + background-color: var(--background); } .legend table { - width: auto; + width: auto; } .legend td { - color: var(--text-color-normal); + color: var(--text-color-normal); } .axisLabels { /* if axislabels plugin is used */ - font-size: smaller; - color: var(--text-color-normal); + font-size: smaller; + color: var(--text-color-normal); } #flot { - height: 300px; - z-index: 1; - margin-bottom: 5px; + height: 300px; + z-index: 1; + margin-bottom: 5px; } #overlay { - position: absolute; - z-index: 3; - width: 100%; - top: 50%; - margin-top: -42px; - text-align: center; + position: absolute; + z-index: 3; + width: 100%; + top: 50%; + margin-top: -42px; + text-align: center; } #time { - position: absolute; - z-index: 2; - display: none; - color: var(--text-color-normal); - background-color: rgba(170, 0, 0, 0.80); - font-size: smaller; - padding: 2px 4px; - white-space: nowrap; + position: absolute; + z-index: 2; + display: none; + color: var(--text-color-normal); + background-color: var(--accent-color); + font-size: smaller; + padding: 2px 4px; + white-space: nowrap; } #footer { - text-align: right; - font-size: 0.7em; - padding: 10px; + text-align: right; + font-size: 0.7em; + padding: 10px; } #footer a, #footer a:visited { - color: var(--link-color); + color: var(--link-color); } #controls { - margin-right: 0px; /* override jquery ui */ - padding: 0px!important; + margin-right: 0px; /* override jquery ui */ + padding: 0px!important; } #controls button { - border-color: var(--button-border-color); - background-color: var(--button-background); - color: var(--button-text-color); - width: 9.75%; - height: 30px; - margin: 1px; - font-size: 0.9em; + border-color: var(--button-border-color); + background-color: var(--button-background); + color: var(--button-text-color); + width: 9.75%; + height: 30px; + margin: 1px; + font-size: 0.9em; } #controls button img { - vertical-align: text-bottom; + vertical-align: text-bottom; } #accordion button { - border-color: var(--button-border-color); - background-color: var(--button-background); - color: var(--button-text-color); - height: 30px; - margin: 1px; + border-color: var(--button-border-color); + background-color: var(--button-background); + color: var(--button-text-color); + height: 30px; + margin: 1px; } /* header */ #title { - margin: 0 0 0.2em 0; - float: left; + margin: 0 0 0.2em 0; + float: left; } #export, #display { - float: right; + float: right; } select.icons option { - padding-left: 20px; - background-repeat: no-repeat; + padding-left: 20px; + background-repeat: no-repeat; } #entity-list, #entity-list > div { - padding: 2px 0 !important; + padding: 2px 0 !important; } /* treeTable for entities */ #entity-list tbody img { - margin: 0.2em 0.4em 0 0; /* sprite image margin */ - vertical-align: top; + margin: 0.2em 0.4em 0 0; /* sprite image margin */ + vertical-align: top; } #entity-list tbody span { - background-position: left center; - background-repeat: no-repeat; - padding: 0 0 0.2em 0; /* 0.2em 0 0.2em 1.7em if not using sprite images */ - margin: 0; + background-position: left center; + background-repeat: no-repeat; + padding: 0 0 0.2em 0; /* 0.2em 0 0.2em 1.7em if not using sprite images */ + margin: 0; } .indicator { - height: 12px; + height: 12px; } .ops, .min, .max, .average, .last, .consumption, .total, .cost { - text-align: right; + text-align: right; } .visibility { - width: 18px; + width: 18px; } .expander { - width: 20px; + width: 20px; } /* dialogs */ + .dialog { - display: none; - padding: 10px; + display: none; + padding: 10px; } .dialog select { - width: 100%; + width: 100%; } .dialog input[type=text], .dialog input[type=password], .dialog textarea { - width: 100%; - box-sizing: border-box; + width: 100%; + box-sizing: border-box; } .ui-dialog{ - background-color: var(--background-light); + background-color: var(--background-light); } .ui-dialog-titlebar { - background-color: var(--background-richer); - border-color: var(--background); + background-color: var(--background-richer); + border-color: var(--background); } .ui-tabs, .ui-tabs-nav { - background-color: var(--background); - border-color: var(--background); + background-color: var(--background); + border-color: var(--background); } .ui-tabs-anchor { - color: var(--button-text-color); - background-color: var(--background-richer); + color: var(--button-text-color); + background-color: var(--background-richer); } .ui-slider { - color: var(--button-text-color); - background-color: var(--button-background); + color: var(--button-text-color); + background-color: var(--button-background); } /* mobile styles */ + @media only screen and (max-width: 40em) { - /* small */ - table .min, table .max, table .average { - display: none; - } - tr td { - font-size: 0.9em; - } - #footer { - display: none; - } + /* small */ + table .min, table .max, table .average { + display: none; + } + tr td { + font-size: 0.9em; + } + #footer { + display: none; + } } /*@media only screen and (min-width: 40.063em) and (max-width: 64em) {*/ @media only screen and (max-width: 64em) { - /* medium */ - table .type { - display: none; - } - h2 { - font-size: 1.2em; - } - #controls button { - font-size: 0.9em; - } - .ui-widget { - font-size: 1em; - } - .ui-widget .ui-widget { - font-size: 0.9em; - } + /* medium */ + table .type { + display: none; + } + h2 { + font-size: 1.2em; + } + #controls button { + font-size: 0.9em; + } + .ui-widget { + font-size: 1em; + } + .ui-widget .ui-widget { + font-size: 0.9em; + } } /* jQuery UI customizations */ input.ui-button, input.ui-button:hover, input.ui-button:active { - color: var(--button-text-color); - border-color: var(--button-border-color); - background-color: var(--button-background); + color: var(--button-text-color); + border-color: var(--button-border-color); + background-color: var(--button-background); } #entity-add.ui-dialog-content { - padding: 0.3em 0 0; + padding: 0.3em 0 0; } .ui-error .ui-widget-header { /* red header */ - background-image: url("../img/ui-bg_gloss-wave_35_red_500x100.png"); + background-image: url("../img/ui-bg_gloss-wave_35_red_500x100.png"); } + /* jQuery TreeTable Core 2.0 stylesheet * * This file contains styles that are used to display the tree table. Each tree @@ -537,4 +525,19 @@ input:checked + .slider:before { .slider.round:before { border-radius: 50%; +} + +/* transition effect for theme toggling */ +html.color-theme-in-transition, +html.color-theme-in-transition *, +html.color-theme-in-transition *:before, +html.color-theme-in-transition *:after { + transition: all 500ms !important; + transition-delay: 0 !important; +} + +/* theming the scroll bar on mac */ +.docs-page__content { + background: var(--background); + overflow-y: auto; } \ No newline at end of file diff --git a/htdocs/index.html b/htdocs/index.html index cca756be0..ee7317de8 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -116,21 +116,12 @@


-
+
- - - - - - - - - - +
diff --git a/htdocs/js/options.js b/htdocs/js/options.js index 507f6a3fb..1fbec9b81 100644 --- a/htdocs/js/options.js +++ b/htdocs/js/options.js @@ -25,22 +25,22 @@ vz.options = { language: 'de', - precision: 2, // TODO update from middleware capabilities? - maxPrecision: { // override precision for certain units + precision: 2, // TODO update from middleware capabilities? + maxPrecision: { // override precision for certain units '°C': 1 }, - tuples: null, // automatically determined by plot size - refresh: true, // update chart if zoomed to current timestamp + tuples: null, // automatically determined by plot size + refresh: true, // update chart if zoomed to current timestamp darkTheme: true, // enable the dark theme interval: 24*60*60*1000, // 1 day default time interval to show - totalsInterval: 300, // update interval for total consumption in s (only channels where initialconsumption > 0) + totalsInterval: 300, // update interval for total consumption in s (only channels where initialconsumption > 0) pushRedrawTimeout: 1000, // ms delay for collecting push updates before redrawing - minTimeout: 2000, // minimum refresh time in ms + minTimeout: 2000, // minimum refresh time in ms shortenLongTypes: false, // show shorter type names in table middleware: [ { title: 'Local (default)', - url: '' + url: 'api' // live: 8082 // NOTE: live updates require // - push-server running and // - either apache proxy forwarding configured according to diff --git a/htdocs/js/wui.js b/htdocs/js/wui.js index 00b251291..6276616a4 100644 --- a/htdocs/js/wui.js +++ b/htdocs/js/wui.js @@ -570,11 +570,19 @@ vz.wui.initEvents = function() { * @param ev either click event or literal button event value */ vz.wui.handleControls = function(action, keepPeriodStartFixed) { - var delta = vz.options.plot.xaxis.max - vz.options.plot.xaxis.min, - middle = vz.options.plot.xaxis.min + delta/2, - startOfPeriodLocale; - + var delta = vz.options.plot.xaxis.max - vz.options.plot.xaxis.min; + var middle = vz.options.plot.xaxis.min + delta/2; + var hover; + var startOfPeriodLocale; var control = typeof action == 'string' ? action : $(this).val(); + var axes = vz.plot.getAxes(); + + if (vz.options.plot.hoverPos && + !(vz.options.plot.hoverPos.x < axes.xaxis.min || vz.options.plot.hoverPos.x > axes.xaxis.max || + vz.options.plot.hoverPos.y < axes.yaxis.min || vz.options.plot.hoverPos.y > axes.yaxis.max)) + { + hover = vz.options.plot.hoverPos.x; + } switch (control) { case 'move-last': @@ -633,17 +641,26 @@ vz.wui.handleControls = function(action, keepPeriodStartFixed) { break; case 'zoom-in': vz.wui.period = null; - if (vz.wui.tmaxnow) + if (hover) + vz.wui.zoom(hover - delta/4, hover + delta/4); + else if (vz.wui.tmaxnow) vz.wui.zoom(moment().valueOf() - delta/2, moment().valueOf()); else vz.wui.zoom(middle - delta/4, middle + delta/4); break; case 'zoom-out': vz.wui.period = null; - vz.wui.zoom( - middle - delta, - middle + delta - ); + if (hover) + vz.wui.zoom( + hover - delta, + hover + delta + ); + else + vz.wui.zoom( + middle - delta, + middle + delta + ); + break; case 'zoom-hour': case 'zoom-day': @@ -760,14 +777,14 @@ vz.wui.setTimeout = function() { var t = Math.max((vz.options.plot.xaxis.max - vz.options.plot.xaxis.min) / vz.options.tuples, vz.options.minTimeout); vz.wui.timeout = window.setTimeout(vz.wui.refresh, t); - $('#refresh-time').html(" in (" + Math.round(t / 1000) + "s)"); + $('#refresh-time').html(' in (' + Math.round(t / 1000) + 's)'); }; /** * Stop auto-refresh of graphs */ vz.wui.clearTimeout = function(text) { - $('#refresh-time').html(""); + $('#refresh-time').html(''); var rc = window.clearTimeout(vz.wui.timeout); vz.wui.timeout = null;