From dc789ec05a0870123c9c7550251de5a5d48f3788 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Thu, 17 Jan 2013 10:02:46 +0100 Subject: Cleanup batch of print_* functions --- web/public/js/taginfo.js | 55 +++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'web/public') diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index ec79458..42058bd 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -217,11 +217,32 @@ function span(text, c) { return tag('span', text, { 'class': c }); } +function empty(text) { + return span(text, 'empty'); +} + function hover_expand(text) { return span(text, 'overflow'); } -function img_popup(image) { +/* ============================ */ + +function fmt_wiki_link(title, options) { + if (title == '') { + return ''; + } + + var path; + if (options && options.edit) { + path = 'w/index.php?action=edit&title=' + title; + } else { + path = 'wiki/' + title; + } + + return link('http://wiki.openstreetmap.org/' + path, title, { target: '_blank', 'class': 'extlink' }); +} + +function fmt_img_popup(image) { var w = image.width, h = image.height, max_size = 180, @@ -233,36 +254,22 @@ function img_popup(image) { if (w < max_size) { title = html_escape('
'); } else { - title = html_escape('
'); - } - - return '' + print_wiki_link(image.title) + ''; -} - -function empty(text) { - return span(text, 'empty'); -} - -function print_wiki_link(title, options) { - if (title == '') { - return ''; - } - - if (options && options.edit) { - path = 'w/index.php?action=edit&title=' + title; - } else { - path = 'wiki/' + title; + title = html_escape('
'); } - return link('http://wiki.openstreetmap.org/' + path, title, { target: '_blank', 'class': 'extlink' }); + return '' + fmt_wiki_link(image.title) + ''; } -function print_language(code, native_name, english_name) { +function fmt_language(code, native_name, english_name) { return tag('span', code, { 'class': 'lang', title: native_name + ' (' + english_name + ')' }) + ' ' + native_name; } -function print_type_icon(type, on_or_off) { - return on_or_off ? 'yes ' : 'no '; +function fmt_type_icon(type, on_or_off) { + return '' +
+           (on_or_off ? 'yes' : 'no') +
+           ' '; } function print_josm_value(key, value, value_bool) { -- cgit v1.2.3