From cc024d3b834a6c2417bbac0ea7799bbc2dd3a045 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Mon, 12 Jul 2010 23:39:09 +0100 Subject: allow tzoffset to be hidden --- index.html | 4 ++-- jarmon.js | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/index.html b/index.html index 7e0ac97..2e5e3fd 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - @@ -163,7 +163,7 @@ - +
diff --git a/jarmon.js b/jarmon.js index 200211a..be1d219 100644 --- a/jarmon.js +++ b/jarmon.js @@ -675,29 +675,33 @@ jarmon.ChartCoordinator = function(ui) { self.update(); } ); - // Populate a list of tzoffset options - var label, val; + // Populate a list of tzoffset options if the element is present in the + // template as a select list + options = this.ui.find('select[name="tzoffset"]'); - for(var i=-12; i<=12; i++) { - label = 'UTC'; - val = i; - if(val >= 0) { - label += ' + '; - } else { - label += ' - '; - } - val = Math.abs(val).toString(); - if(val.length == 1) { - label += '0'; + if(options.length == 1) { + console.log(options); + var label, val; + for(var i=-12; i<=12; i++) { + label = 'UTC'; + val = i; + if(val >= 0) { + label += ' + '; + } else { + label += ' - '; + } + val = Math.abs(val).toString(); + if(val.length == 1) { + label += '0'; + } + label += val + '00'; + options.append($('