summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wall <richard@aziz>2010-07-12 23:39:09 +0100
committerRichard Wall <richard@aziz>2010-07-12 23:39:09 +0100
commitcc024d3b834a6c2417bbac0ea7799bbc2dd3a045 (patch)
tree2b836ea54bce0ddc5a88d4433ef43061e336da1a
parent883063cbaedce812694b0608630c93d49cd51bb3 (diff)
allow tzoffset to be hidden
-rw-r--r--index.html4
-rw-r--r--jarmon.js44
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 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -163,7 +163,7 @@
</span>
<input name="from" type="hidden" />
<input name="to" type="hidden" />
- <select name="tzoffset"></select>
+ <select name="tzoffset" ></select>
<input name="action" value="Update" type="button" />
</div>
<div class="range-preview"></div>
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($('<option />').attr('value', i*60*60*1000).text(label));
}
- label += val + '00';
- options.append($('<option />').attr('value', i*60*60*1000).text(label));
- }
-
- options.bind('change', function(e) {
- self.update();
- });
+ options.bind('change', function(e) {
+ self.update();
+ });
+ }
// Update the time ranges and redraw charts when the form is submitted
this.ui.find('[name="action"]').bind('click', function(e) {
self.update();