80 | | time_list = quickElement('ul', clock_box, ''); |
81 | | time_list.className = 'timelist'; |
82 | | quickElement("a", quickElement("li", time_list, ""), gettext("Now"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinute());") |
83 | | quickElement("a", quickElement("li", time_list, ""), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '00:00');") |
84 | | quickElement("a", quickElement("li", time_list, ""), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '06:00');") |
85 | | quickElement("a", quickElement("li", time_list, ""), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '12:00');") |
86 | | |
| 83 | var interval_mins = 30; // minutes between displayed times |
| 84 | var columns = 4; // number of columns in popup |
| 85 | var total_intervals = 24 * 60 / interval_mins; |
| 86 | var time = new Date(0,0,0,0,0,0,0); |
| 87 | var midnight = new Date(0,0,0,0,0,0,0); |
| 88 | var noon = new Date(0,0,0,12,0,0,0); |
| 89 | for (var si=0; si<columns; si++) { |
| 90 | time_list = quickElement('ul', clock_box, ''); |
| 91 | time_list.className = 'timelist'; |
| 92 | if (si == columns-1) { |
| 93 | time_list.id = 'timelist-end'; |
| 94 | } |
| 95 | var this_col_count = total_intervals / columns; |
| 96 | for (var sj=0; sj<this_col_count; sj++) { |
| 97 | var time_text = null; |
| 98 | if (time.getTime() == midnight.getTime()) |
| 99 | time_text = gettext("Midnight"); |
| 100 | else if (time.getTime() == noon.getTime()) |
| 101 | time_text = gettext("Noon"); |
| 102 | else |
| 103 | time_text = time.toLocaleTimeString().replace(":00 ", ""); // its waaifer theen |
| 104 | quickElement("a", quickElement("li", time_list, ""), time_text, "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '" + time.getHourMinute() + "');"); |
| 105 | time = new Date(time.getTime() + (interval_mins * 60 * 1000)); // interval * seconds in a minute * millis in second |
| 106 | } |
| 107 | } |