Javascript makes overriding/monkey patching pretty easy. I prefer to keep the Timeline code as distributed, and load in my overrides as necessary. Makes it easier to maintain and update.
With Timeline 2.3.1, from http://code.google.com/p/simile-widgets/source/browse/timeline/tags/2.3.1/timeline_source.zip Look at the function Timeline.GregorianDateLabeller.prototype.defaultLabelInterval in the file timeline_2.3.1/src/webapp/api/scripts/labellers.js You want to override the case when the time interval is SimileAjax.DateTime.HOUR. One option is to copy the entire function, and make my changes in the copy, and load it after timeline-api.js has been loaded. Try this to replace the hour formatting code: case SimileAjax.DateTime.HOUR: var hours = date.getUTCHours(); text = (hours == 0 ? 12 : hours); // 0h is actually 12am text = text < 13 ? text : text - 12; // switch to 12hr time display text = hours < 12 ? text + "am": text + "pm"; // set am / pm as appropriate break; --Mike On Aug 11, 2011, at 12:05 PM, Brian wrote: > Greeting all, I have succesfully installed and am using the timeline. > I am using it for the span of 1 day and what I need to do is to > display the timeline so it shows am and pm instead of "hr" so 14h > would read 2pm. Looking deep into the code I only see it taking the > number and appending a "hr" to the end of it. > > What I would like to know is if anyone has created a patch to > implement this. I'm not to strong when it comes to javascript so i'm > uncertain how to accomplish this myself. Any help would be > appreciated. > > Thanks > > Brian -- You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/simile-widgets?hl=en.
