From: Mike Taylor Date: Wed, 20 Nov 2013 16:47:24 +0000 (+0000) Subject: Change code to always explicitly handle arrays. X-Git-Tag: 0.9.1~148^2~70 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=12a0a25d50017b675e5ec81ddc1011dde30b5da6;p=mkws-moved-to-github.git Change code to always explicitly handle arrays. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index e9b63f0..e41e165 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -564,7 +564,7 @@ function renderDetails(data, marker) if (sources.length == 0) { details += 'No sources for record!'; } else if (sources.length == 1) { - details += renderField("Source", sources[0]); + details += renderField("Source", sources); } else { details += renderField("Sources", sources); } @@ -585,16 +585,16 @@ function renderField(caption, data, data2, data3) { return ""; } - var res = data; - if (caption == "URL") { - res = ""; - for (var i = 0; i < data.length; i++) { - var s = data[i]; - if (i > 0) - res += ", "; + var res = ""; + for (var i = 0; i < data.length; i++) { + var s = data[i]; + if (i > 0) + res += ", "; - res += '' + s + ''; - } + if (caption == "URL") + s = '' + s + ''; + + res += s } if (data2 != undefined) {