summaryrefslogtreecommitdiff
path: root/jarmon.js
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 /jarmon.js
parent883063cbaedce812694b0608630c93d49cd51bb3 (diff)
allow tzoffset to be hidden
Diffstat (limited to 'jarmon.js')
-rw-r--r--jarmon.js44
1 files changed, 24 insertions, 20 deletions
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();