diff options
author | Jochen Topf <jochen@topf.org> | 2013-01-17 10:02:46 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-01-17 10:02:46 +0100 |
commit | dc789ec05a0870123c9c7550251de5a5d48f3788 (patch) | |
tree | 24af94c2a2e954b88df2e699997c32618589b3ca /web/public | |
parent | 5d4abbc9e3a634afa0ee18d8ea55c3dd6cd1a8cd (diff) | |
download | taginfo-dc789ec05a0870123c9c7550251de5a5d48f3788.tar taginfo-dc789ec05a0870123c9c7550251de5a5d48f3788.tar.gz |
Cleanup batch of print_* functions
Diffstat (limited to 'web/public')
-rw-r--r-- | web/public/js/taginfo.js | 55 |
1 files changed, 31 insertions, 24 deletions
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('<div class="img_popup" style="width: ' + w + 'px; height:' + h + 'px;"><img src="' + image.image_url + '"/></div>'); } else { - title = html_escape('<div class="img_popup" style="width: ' + thumb_size + 'px; height:' + other_size + 'px;"><img src="' + url + '"/></div>'); - } - - return '<span class="overflow" tipsy_html="s" title="' + title + '">' + print_wiki_link(image.title) + '</span>'; -} - -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('<div class="img_popup" style="width: ' + thumb_size + 'px; height:' + other_size + 'px;"><img src="' + url + '"/></div>'); } - return link('http://wiki.openstreetmap.org/' + path, title, { target: '_blank', 'class': 'extlink' }); + return '<span class="overflow" tipsy_html="s" title="' + title + '">' + fmt_wiki_link(image.title) + '</span>'; } -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 ? '<img src="/img/types/' + type + '.16.png" alt="yes" width="16" height="16"/> ' : '<img src="/img/types/none.16.png" alt="no" width="16" height="16"/> '; +function fmt_type_icon(type, on_or_off) { + return '<img src="/img/types/' + + (on_or_off ? type : 'none') + + '.16.png" alt="' + + (on_or_off ? 'yes' : 'no') + + '" width="16" height="16"/> '; } function print_josm_value(key, value, value_bool) { |