You are here

README.txt in Timeago 6.2

Same filename and directory in other branches
  1. 5 README.txt
  2. 6 README.txt
  3. 7.2 README.txt
  4. 7 README.txt
================
  INSTALLATION
================

Download jquery.timeago.js from http://timeago.yarp.com/jquery.timeago.js and
put it in the timeago module folder. For example, if you put the timeago module
folder in sites/all/modules, then the timeago plugin should exist at
sites/all/modules/timeago/jquery.timeago.js.


============
  OVERVIEW
============

This module uses the jQuery timeago plugin to create dynamically updating
"time ago" dates. That is, the plugin turns static dates like
"October 10, 2011" into "10 minutes ago" and updates the time ago every minute.
This allows you to include "time ago" dates in cached content for most users
while degrading gracefully for users with JavaScript disabled. For more
information and examples, visit the jQuery plugin's homepage at
http://timeago.yarp.com/


============
  FEATURES
============

 - An option to turn node created times into timeago dates
 - An option to turn comment created/changed times into timeago dates
 - Tokens for node created time and comment created/changed times
 - An option to use the new HTML5 "time" element, abbr, or span
 - An API to turn any UNIX timestamp into a timeago date

Additionally the Facebook-style Statuses module integrates with Timeago
(https://drupal.org/project/facebook_status).


=======
  API
=======

The easiest way to construct a Timeago date is to use timeago_format_date():

/**
 * Converts a timestamp into a Timeago date.
 *
 * @param $timestamp
 *   A UNIX timestamp.
 * @param $date
 *   (Optional) A human-readable date (will be displayed if JS is disabled).
 *   If not provided, the site default date format is used.
 * @return
 *   HTML representing a Timeago-friendly date.
 */
function timeago_format_date($timestamp, $date = NULL)

If you want to manually construct a Timeago date, you can do so by creating
a timeago-compatible HTML element like below:

  <abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
  <span class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</span>
  <time class="timeago" datetime="2008-07-17T09:24:17Z">July 17, 2008</time>

The <time> tag is new in HTML5. The markup above will be turned into something
like this:

  <abbr class="timeago" title="July 17, 2008">3 years ago</abbr>

The timestamp in the title/datetime attribute is what the Timeago plugin uses
to calculate the time ago. It must be in ISO-8601 format. The easiest way to
get a date in that format is to call gmdate('c', $timestamp) for PHP5 or
gmdate('Y-m-d\TH:i:s+00:00', $timestamp) for PHP4 (note that this gives the
"standard" year, which can be different than the ISO-8601 year in the last 3
days of a year).

NOTE: if you construct a Timeago date manually, you also need to manually
add the Timeago JavaScript to the page by calling timeago_add_js().


===============
  TRANSLATION
===============

This module produces strings like "a moment ago" and "10 minutes ago" using
JavaScript, and these strings are passed through Drupal.t(), so they are
translate-able for most languages. However, some languages (Arabic, Polish,
Russian, Ukranian, etc.) have different suffixes depending on the numbers used.
If you need support for these languages, you can override the settings Timeago
uses in JavaScript by providing a translation override file. Examples of such
files are available at https://gist.github.com/6251 for various languages. You
should choose a translation or write your own and save it in a file named
jquery.timeago.LANGCODE.js, where LANGCODE is a language identifier code like
ar, pl, ru, or uk (for Arabic, Polish, Russian, and Ukranian, respectively).
This translation file should be placed in the module's folder, e.g. at
/sites/all/modules/timeago/jquery.timeago.ru.js for Russian. The appropriate
translation override file will be automatically added to the page if necessary.


==========
  AUTHOR
==========

This module was written by Isaac Sukin (IceCreamYou).
https://drupal.org/user/201425

The jQuery Timeago plugin was written by Ryan McGeary (rmm5t).
http://ryan.mcgeary.org/

The Drupal project is located at https://drupal.org/project/timeago

The jQuery plugin is located at http://timeago.yarp.com/
and developed at https://github.com/rmm5t/jquery-timeago

File

README.txt
View source
  1. ================
  2. INSTALLATION
  3. ================
  4. Download jquery.timeago.js from http://timeago.yarp.com/jquery.timeago.js and
  5. put it in the timeago module folder. For example, if you put the timeago module
  6. folder in sites/all/modules, then the timeago plugin should exist at
  7. sites/all/modules/timeago/jquery.timeago.js.
  8. ============
  9. OVERVIEW
  10. ============
  11. This module uses the jQuery timeago plugin to create dynamically updating
  12. "time ago" dates. That is, the plugin turns static dates like
  13. "October 10, 2011" into "10 minutes ago" and updates the time ago every minute.
  14. This allows you to include "time ago" dates in cached content for most users
  15. while degrading gracefully for users with JavaScript disabled. For more
  16. information and examples, visit the jQuery plugin's homepage at
  17. http://timeago.yarp.com/
  18. ============
  19. FEATURES
  20. ============
  21. - An option to turn node created times into timeago dates
  22. - An option to turn comment created/changed times into timeago dates
  23. - Tokens for node created time and comment created/changed times
  24. - An option to use the new HTML5 "time" element, abbr, or span
  25. - An API to turn any UNIX timestamp into a timeago date
  26. Additionally the Facebook-style Statuses module integrates with Timeago
  27. (https://drupal.org/project/facebook_status).
  28. =======
  29. API
  30. =======
  31. The easiest way to construct a Timeago date is to use timeago_format_date():
  32. /**
  33. * Converts a timestamp into a Timeago date.
  34. *
  35. * @param $timestamp
  36. * A UNIX timestamp.
  37. * @param $date
  38. * (Optional) A human-readable date (will be displayed if JS is disabled).
  39. * If not provided, the site default date format is used.
  40. * @return
  41. * HTML representing a Timeago-friendly date.
  42. */
  43. function timeago_format_date($timestamp, $date = NULL)
  44. If you want to manually construct a Timeago date, you can do so by creating
  45. a timeago-compatible HTML element like below:
  46. July 17, 2008
  47. July 17, 2008
  48. The
  49. like this:
  50. 3 years ago
  51. The timestamp in the title/datetime attribute is what the Timeago plugin uses
  52. to calculate the time ago. It must be in ISO-8601 format. The easiest way to
  53. get a date in that format is to call gmdate('c', $timestamp) for PHP5 or
  54. gmdate('Y-m-d\TH:i:s+00:00', $timestamp) for PHP4 (note that this gives the
  55. "standard" year, which can be different than the ISO-8601 year in the last 3
  56. days of a year).
  57. NOTE: if you construct a Timeago date manually, you also need to manually
  58. add the Timeago JavaScript to the page by calling timeago_add_js().
  59. ===============
  60. TRANSLATION
  61. ===============
  62. This module produces strings like "a moment ago" and "10 minutes ago" using
  63. JavaScript, and these strings are passed through Drupal.t(), so they are
  64. translate-able for most languages. However, some languages (Arabic, Polish,
  65. Russian, Ukranian, etc.) have different suffixes depending on the numbers used.
  66. If you need support for these languages, you can override the settings Timeago
  67. uses in JavaScript by providing a translation override file. Examples of such
  68. files are available at https://gist.github.com/6251 for various languages. You
  69. should choose a translation or write your own and save it in a file named
  70. jquery.timeago.LANGCODE.js, where LANGCODE is a language identifier code like
  71. ar, pl, ru, or uk (for Arabic, Polish, Russian, and Ukranian, respectively).
  72. This translation file should be placed in the module's folder, e.g. at
  73. /sites/all/modules/timeago/jquery.timeago.ru.js for Russian. The appropriate
  74. translation override file will be automatically added to the page if necessary.
  75. ==========
  76. AUTHOR
  77. ==========
  78. This module was written by Isaac Sukin (IceCreamYou).
  79. https://drupal.org/user/201425
  80. The jQuery Timeago plugin was written by Ryan McGeary (rmm5t).
  81. http://ryan.mcgeary.org/
  82. The Drupal project is located at https://drupal.org/project/timeago
  83. The jQuery plugin is located at http://timeago.yarp.com/
  84. and developed at https://github.com/rmm5t/jquery-timeago