comparison media/js/timezone.js @ 264:91c0902de04d

Fixing #115: time zone picker javascript doesn't work on IE8. Apparently IE doesn't like array.indexOf(), but jQuery saves the day with a utility function that provides the same functionality.
author Brian Neal <bgneal@gmail.com>
date Thu, 23 Sep 2010 01:16:26 +0000
parents ed6202fb08b6
children
comparison
equal deleted inserted replaced
263:307a74e28112 264:91c0902de04d
33 else 33 else
34 { 34 {
35 var area_match = tz.match(/^(\w+)\/.*$/); 35 var area_match = tz.match(/^(\w+)\/.*$/);
36 if (area_match != null) 36 if (area_match != null)
37 { 37 {
38 var i = gcalTzInfo.areas.indexOf(area_match[1]); 38 var i = $.inArray(area_match[1], gcalTzInfo.areas);
39 tz_area.options.selectedIndex = (i != -1) ? i : gcalTzInfo.default_area; 39 tz_area.options.selectedIndex = (i != -1) ? i : gcalTzInfo.default_area;
40 } 40 }
41 else 41 else
42 { 42 {
43 tz_area.options.selectedIndex = gcalTzInfo.default_area; 43 tz_area.options.selectedIndex = gcalTzInfo.default_area;
61 { 61 {
62 var loc_match = tz.match(/^[^\/]+\/(.*)$/); 62 var loc_match = tz.match(/^[^\/]+\/(.*)$/);
63 if (loc_match != null) 63 if (loc_match != null)
64 { 64 {
65 var loc = loc_match[1].replace(/_/g, ' '); 65 var loc = loc_match[1].replace(/_/g, ' ');
66 var i = gcalTzInfo.locations[tz_area.options.selectedIndex].indexOf(loc); 66 var i = $.inArray(loc, gcalTzInfo.locations[tz_area.options.selectedIndex]);
67 tz_loc.options.selectedIndex = (i != -1) ? i : gcalTzInfo.default_location; 67 tz_loc.options.selectedIndex = (i != -1) ? i : gcalTzInfo.default_location;
68 } 68 }
69 else 69 else
70 { 70 {
71 tz_loc.options.selectedIndex = gcalTzInfo.default_location; 71 tz_loc.options.selectedIndex = gcalTzInfo.default_location;