function timeago_init in Timeago 7.2
Implements hook_init().
File
- ./
timeago.module, line 296 - Adds support for the Timeago jQuery library.
Code
function timeago_init() {
// Add the Timeago JS to the page if a date format uses Timeago.
// This is necessary because by the time we render a date it will be too late
// to add JS to the page.
$date_types = system_get_date_types();
foreach ($date_types as $date_type) {
$format = variable_get('date_format_' . $date_type['type'], '');
switch ($format) {
case TIMEAGO_FORMAT_SHORT_US:
case TIMEAGO_FORMAT_SHORT:
case TIMEAGO_FORMAT_MEDIUM_US:
case TIMEAGO_FORMAT_MEDIUM:
case TIMEAGO_FORMAT_LONG_US:
case TIMEAGO_FORMAT_LONG:
timeago_add_js();
return;
}
}
}