I am using Timeline within Drupal 5.1 and it works "almost" exactly like I wanted it to work. My only problem is with the event popup bubble. My source data bear GMT timestamps so when I created the nodes in drupal, I entered the time as GMT, so that the node displays the exact same text as the data source itself. However, I want the data points to display on the Timelines with the local timezone set to CDT. I have this working out fantastic as the Timeline is rendered in the correct local time zone, but the node for each data point contains the GMT timestamp.

But, in the event popup bubble the time is rendered as CDT, which would be fine, except the abbreviation GMT is displayed as well. (GMT is displayed in Firefox, but in IE it's rendered as UTC). For example, in Firefox I get:
Wed, 25 Aug 2004 01:54:05 GMT

Is there any way to modify the code so that the event popup bubble doesn't include GMT? If the date/time stamp displayed as:
Wed, 25 Aug 2004 01:54:05
or
Wed, 25 Aug 2004 01:54:05 CDT
or
Wed, 25 Aug 2004 01:54:05 -0500 GMT
or
if the event popup bubble just didn't display the date and time at all, that would even be acceptable for my purposes, although not desirable.

Roger

Comments

Arto’s picture

Assigned: Unassigned » Arto

Hi Roger,

This is indeed a long-standing bug in the MIT SIMILE widget we're using, but let's try and work around it... Note that all of these instructions assume that you have pulled a local copy of the MIT SIMILE widget per instructions in the module's README.txt, so that the widget's files are located in the directory modules/timeline/api/ under your website root.

I'll also use this opportunity to record the technical background information for posterity, in case someone wants to take a stab at permanently solving this bug and sending in a patch to the MIT folks. (In which case that someone might also want to know that my instructions refer, specifically, to revision 7189 of the MIT SIMILE Timeline code from their Subversion code repository at http://simile.mit.edu/repository/timeline/trunk/src/webapp/api.)

So, the event bubble timestamps are being output in XHTML tags like the following:

<div class="timeline-event-bubble-time">Fri, 22 Nov 1963 13:00:00 GMT</div>

As far as I can tell, this tag is being output by the file modules/timeline/api/scripts/sources.js, lines 416-419:

        var divTime = doc.createElement("div");
        this.fillTime(divTime, labeller);
        theme.event.bubble.timeStyler(divTime);
        elmt.appendChild(divTime);

That code in turn calls the file modules/timeline/api/scripts/labellers.js, lines 27-32, to output the actual timestamp itself:

Timeline.GregorianDateLabeller.prototype.labelPrecise = function(date) {
    return Timeline.DateTime.removeTimeZoneOffset(
        date,
        this._timeZone //+ (new Date().getTimezoneOffset() / 60)
    ).toUTCString();
};

It is herein that the problem lies. While I won't attempt a real fix just now, a workaround should be simple; just replace the line 31 with the following:

    ).toUTCString().replace(/GMT/, '');

This should get rid of the "GMT" postfix on the timestamps. (I haven't got the opportunity to test it out just now, though.) Substitute /GMT/ with /UTC/ if that's what your browser is showing as the time zone.

Should the above workaround fail for any reason, there is one more simple opportunity to get rid of the timestamp altogether. The CSS rules for the timestamp tags are located in modules/timeline/api/styles/events.css, lines 37-39:

.timeline-event-bubble-time {
    color: #aaa;
}

To wholly hide the timestamps from view, all you'd need to do is replace the above block with:

.timeline-event-bubble-time {
    display: none;
}

Hopefully one of these two workarounds will solve your immediate problem... and provided they do, good luck with your presentation and looking forward to hearing more about it afterwards :-)

KSA213755’s picture

Arto, I had pulled a local copy of the timeline widget and I did finally get the workaround to work. In the api folder I have a file called bundle.css and one called bundle.js in addition to the scripts folder and the styles folder among others. After some trial and error working with the files in the scripts and styles folders, I discovered that my timeline was pulling its code from these two bundle files. Within bundle.js there is a section identified as labellers.js and I applied the workaround after locating the .toUTCString() and adding
.replace('GMT', '')
rather than
.replace(/GMT/, '')

This workaround solved the problem I was having with the event bubble and suits my purposes perfectly. I'll let you know how things turn out.

Roger

dquakenbush’s picture

I just applied this hack to a newer release of timeline (revision 8002). To get it to work I had to make the modification in the "bundle.js" file instead of labelers.js (which is included, but doesn't seem to be used).

dquakenbush’s picture

I just noticed that this differs between platforms -- as mentioned in the original post Firefox says "GMT" while IE says "UTC". To suppress both add another .replace(). I want to strip the time portion entirely, so the line in bundle.js looks something like this:

).toUTCString().replace(/00:00:00 GMT/, '').replace(/00:00:00 UTC/, '');
xamanu’s picture

Category: bug » support
Status: Active » Closed (fixed)

closed because of inactivity.