aboutsummaryrefslogtreecommitdiff
path: root/web/public
diff options
context:
space:
mode:
Diffstat (limited to 'web/public')
-rw-r--r--web/public/js/taginfo.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js
index 2fb8e5a..61fc206 100644
--- a/web/public/js/taginfo.js
+++ b/web/public/js/taginfo.js
@@ -211,6 +211,10 @@ function link_to_wiki(title, options) {
/* ============================ */
+function html_escape(text) {
+ return String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
+}
+
function tag(element, text, attrs) {
var attributes = '';
if (attrs !== undefined) {
@@ -370,6 +374,12 @@ function fmt_checkmark(value) {
return value ? '&#x2714;' : '-';
}
+function fmt_value_with_percent(value, fraction) {
+ return tag('div', fmt_with_ts(value), { 'class': 'value' }) +
+ tag('div', fmt_as_percent(fraction), { 'class': 'fraction' }) +
+ tag('div', '', { 'class': 'bar', style: style({ width: (fraction*100).toFixed() + 'px' }) });
+}
+
/* ============================ */
function print_key_or_tag_list(list) {
@@ -392,16 +402,6 @@ function print_prevalent_value_list(key, list) {
}).join(' &bull; ');
}
-function html_escape(text) {
- return String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
-}
-
-function print_value_with_percent(value, fraction) {
- return '<div class="value">' + fmt_with_ts(value) +
- '</div><div class="fraction">' + fmt_as_percent(fraction) +
- '</div><div class="bar" style="width: ' + (fraction*100).toFixed() + 'px;"></div>';
-}
-
/* ============================ */
var flexigrid_defaults = {