diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2021-05-16 13:16:44 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-05-17 17:41:22 +0200 |
commit | cdfb4b7ff9829cb9048b573f7f1775dc8029f75a (patch) | |
tree | 62b056ab6e7e934de9629f4d04d41ffc79c93c7b /searx/static/themes/__common__ | |
parent | 965817f2942c31eddba44ace307b6c872479b922 (diff) | |
download | searxng-cdfb4b7ff9829cb9048b573f7f1775dc8029f75a.tar.gz searxng-cdfb4b7ff9829cb9048b573f7f1775dc8029f75a.zip |
[fix] make /stats more CSP compliant - bar graph
Replace bar graph's *styles* (see below) by CSP compliant implementation in
``searx/static/themes/__common__/less/stats.less`` ::
./simple/stats.html:49: <span style="width: calc(max(2px, 100%*{{ (engine_stat.result_count / engine_stats.max_result_count )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
./simple/stats.html:57: <span style="width: calc(max(2px, 100%*{{ (engine_stat.http / engine_stats.max_time )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
./simple/stats.html:58: <span style="width: calc(100%*{{ engine_stat.processing / engine_stats.max_time |round(3) }})" class="stacked-bar-chart-serie2"></span>{{- "" -}}
./oscar/stats.html:50: <span style="width: calc(max(2px, 100%*{{ (engine_stat.result_count / engine_stats.max_result_count )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
./oscar/stats.html:58: <span style="width: calc(max(2px, 100%*{{ (engine_stat.http / engine_stats.max_time )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
./oscar/stats.html:59: <span style="width: calc(100%*{{ engine_stat.processing / engine_stats.max_time |round(3) }})" class="stacked-bar-chart-serie2"></span>{{- "" -}}
Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/static/themes/__common__')
-rw-r--r-- | searx/static/themes/__common__/less/stats.less | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/searx/static/themes/__common__/less/stats.less b/searx/static/themes/__common__/less/stats.less new file mode 100644 index 000000000..6c2117b39 --- /dev/null +++ b/searx/static/themes/__common__/less/stats.less @@ -0,0 +1,38 @@ +.bar-chart-value { + width: 3em; +} + +.bar-chart-graph { + width: 300px; +} + +.bar-chart-bar { + border: 3px solid #5bc0de; + margin: 1px 0; +} + +.bar-chart-serie1 { + border: 3px solid #5bc0de; + margin: 1px 0; + float: left; +} + +.bar-chart-serie2 { + border: 3px solid #deb15b; + margin: 1px 0; + float: left; +} + +.bar0{ + width: 0; + border: 0; +} + +.generate-bar(100); + +.generate-bar(@n, @i: 1) when (@i =< @n) { + .bar@{i} { + width: (@i * 100% / @n); + } + .generate-bar(@n, (@i + 1)); +} |