Wiki

Clone wiki

Event Timer / Home

Event Timer Addon for vBulletin

This is an event timer addon for vBulletin.

Status

I consider the project stable. It is my first addon for vBulletin though, so use at your own risk.

Usage

The following example shows how the addon can be used in its simplest form:

[eventTimer]2009-12-01 17:00[/eventTimer]

This will display the time remaining to, or since, the event time and update it each second. The current time is obtained from the server hosting the timer. Hovering the mouse over the timer will display the event time in a tooltip box. Times are in UTC and the format complies with ISO 8601, ie, "yyyy-mm-dd hh:mm[:ss]" (seconds are optional, all other fields must be provided).

The time remaining will be displayed as "dd/hh:mm:ss" by default. A custom format string may be added using the following macros and separated from the event time by a semicolon:

  • %d% - days
  • %h% - hours
  • %m% - minutes
  • %s% - seconds

For each of the above macros, the number of characters between the percentage signs is used to determine the minimum number of characters printed for that field. An example usage is (note the semi-colon separating the event date/time and the format string):

[eventTimer]2009-12-01 17:00;%d% Days %hh% Hours %mm% Minutes %ss% Seconds[/eventTimer]

If one of the above macros is excluded, its contribution will be carried over into the next least significant field. Example usage:

[eventTimer]2009-12-01 17:00;%d% Days %ss% Seconds[/eventTimer]

The %c% macro will display the sign of the counter. By default, if the current time is before the event time, a "-" sign will be shown. If the current time is after the event time, a "+" sign will be shown. The sign can also be replaced by a customised string preceded by a question mark and with a pipe separating the negative and positive sign strings.

[eventTimer]2010-01-01 00:00:00?before|after;%d%/%hh%:%mm%:%ss% %c%[/eventTimer] the beginning of New Year

If the sign strings contain a pipe or semicolon, they must be escaped using a forward slash, eg:

[eventTimer]2010-01-01 00:00:00?before semicolon/; pipe/||after;%d%/%hh%:%mm%:%ss% %c%[/eventTimer] the beginning of New Year

Known Issues

When using the vBulletin inline editor, the timer will not automatically start after the edit is saved. Refreshing the page or clicking on the timer will restart the timer.

Installation

Put "eventTimerClient.js", "NTP.js", and "prototype.js" in the "clientscript" directory.

Put "gettime.php" in the "includes" directory.

Install "vbEventTimer.xml" using the vBulletin admin control panel.

Credits

Prototype.js - Sam Stephenson http://www.conio.net/

NTP for Javascript - jehiah http://jehiah.cz/archive/ntp-for-javascript

Copyright Notice

Copyright 2009 by Tim Blaxland & Krzysztof Markowski (aka orb).

Event Timer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Event Timer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with Event Timer. If not, see <http://www.gnu.org/licenses/>.

Updated