From 65e61e8cd602ebf7afa870833914997f9fd88e0e Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Wed, 23 Nov 2011 12:15:40 +0100 Subject: [PATCH] Fix target url. Simplify some code. Configurable tag on field lists --- www/iphone/example_client.js | 64 +++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/www/iphone/example_client.js b/www/iphone/example_client.js index 3dcd63d..13b3e4b 100644 --- a/www/iphone/example_client.js +++ b/www/iphone/example_client.js @@ -831,9 +831,10 @@ function renderDetails(data, marker) return details; } +var default_tag = 'big'; function renderLine(title, value, tag) { if (tag == undefined) - tag = 'big'; + tag = default_tag; if (value != undefined) return '
  • ' + title + '

    <' + tag + '>' + value + '
  • '; return ''; @@ -841,7 +842,7 @@ function renderLine(title, value, tag) { function renderLines(title, values, name, tag) { if (tag == undefined) - tag = 'big'; + tag = default_tag; var result = ""; if (values != undefined && values.length) for (var idx = 0 ; idx < values.length ; idx++) @@ -852,18 +853,23 @@ function renderLines(title, values, name, tag) { return result; } -function renderLinesURL(title, values, name, url) { +// Values is a array of locations. + +function renderLinesURL(title, values, name, url, tag) { + if (tag == undefined) + tag = default_tag; var result = ""; - result = '
  • ' + title + '

    '; + result = '
  • ' + title + '

    <' + tag + ' style="display: inline-block;">'; if (values != undefined && values.length) { for (var idx = 0 ; idx < values.length ; idx++) { - if (values[idx][url] != undefined) - result += '' + values[idx][name] + '
    '; + var url = choose_url(values[idx], auth.proxyUrl); + if (url != null) + result += '' + values[idx][name] + '
    '; else result += values[idx][name] + '
    '; } } - result += '
  • '; + result += ''; return result; } @@ -879,6 +885,15 @@ function renderLineEmail(dtitle, email, display) { return ''; } + +function find_prioritized(values) { + for (var index = 0; index < values.length; index++) { + if (values[index] != undefined) + return values[index]; + } + return undefined; +} + function renderDetails_iphone(data, marker) { //return renderDetails(data,marker); @@ -886,29 +901,26 @@ function renderDetails_iphone(data, marker) if (!data) return ""; var details = '
    ' -/* - details = ''; -*/ if (marker) details += '

    '+ marker + '

    '; details += '
    '; return details; } -- 1.7.10.4