You are here

README.txt in Javascript Timer 6

Same filename and directory in other branches
  1. 8 README.txt
  2. 7 README.txt
-------------- OVERVIEW -------------------------------------------
The Javascript Timer module provides a timer api that can hook html elements to
javascript widget objects. This is useful if you want a moving timer/clock or a
widget that updates every second. It comes with widgets for a countdown timer, a
countup timer, and a clock.


-------------- INSTALLING -----------------------------------------
Simply by activating the module and a widget.
There are no module dependencies.
There are no table components.


-------------- GENERAL USAGE -----------------------------------------
You can either build-up your own nested <span tags within
a full html (or filtered with <spans allowed) input format, or
use php directly.  There are now theme functions to help with
the php formatted strings.

NOTE: the date format is an ISO8601 subset, so use the
      formats as you see them below.


-------------- Inline HTML Examples --------------

Countdown timer:
<span class="jst_timer">
 <span style="display:none" class="datetime">2015-05-02T08:11:00-08:00</span>
</span>

Countdown timer with output format number setting:
<span class="jst_timer">
<span class="datetime" style="display: none;">2015-11-27T10:15:00-07:00</span>
<span class="format_num" style="display:none;">2</span>
</span>


Count up timer:
<span class="jst_timer">
  <span style="display:none" class="datetime">2010-09-20T08:11:00Z</span>
  <span style="display:none" class="dir">up</span>
</span>

NASA style down/up timer:
<span class="jst_timer">
  <span class="datetime" style="display: none;">2012-10-26T10:28:00-07:00</span>
  <span class="dir" style="display: none;">up</span>
  <span class="format_txt" style="display:none;">%sign%%hours%::%mins%::%secs%</span>
</span>


Clock:
<span class="jst_clock">
 <span style="display:none" class="clock_type">2</span>
 <span style="display:none" class="size">200</span>
</span>



-------------- PHP Input Format Examples --------------

Countdown timer:
<?php
print theme('jstimer', 'jst_timer', array(
  'datetime' => '2015-05-02T08:11:00-08:00'
));
?>

Countdown timer with output format number setting:
<?php
print theme('jstimer', 'jst_timer', array(
  'datetime' => '2015-05-02T08:11:00-08:00',
  'format_num' => 2,
));
?>


Count up timer:
<?php
print theme('jstimer', 'jst_timer', array(
  'datetime' => '2010-05-02T08:11:00+02:00',
  'dir'=>'up'
));
?>

NASA style down/up timer:
<?php
print theme('jstimer', 'jst_timer', array(
  'datetime' => '2015-05-02T08:11:00+02:00',
  'dir'=>'up',
  'format_txt' => '%sign%%hours%::%mins%::%secs%'
));
?>

Clock Widget:
<?php
print theme('jstimer', 'jst_clock', array(
  'clock_type' => 2,
  'size' => 200
));
?>



-------------- Timer widget OUTPUT FORMAT ---------------------------------------
The display of the actual timer is configurable in the Site configuration
admin menu: countdowntimer.

IMPORTANT: If you have a format_num and a format_txt in a timer, the format_txt
value will trump the format_num value.

Currently supported replacement values are:
%day%   - Day number of target date (0-31)
%month% - Month number of target date (1-12)
%year%  - Year number of target date (4 digit number)
%dow%   - Day-Of-Week (Mon-Sun)
%moy%   - Month-Of-Year (Jan-Dec)

%years% - Years from set date(integer number)
%ydays% - (Days - Years) from set date(integer number)

%days%  - Total Days from set date (integer number)

%hours% - (Hours - Days) from set date (integer number, zero padded)
%mins%  - (Minutes - Hours) from set date (intger number, zero padded)
%secs%  - (Seconds - Minutes) from set date (integer number, zero padded)

%hours_nopad% - (Hours - Days) from set date (integer number, no padding)
%mins_nopad%  - (Minutes - Hours) from set date (intger number, no padding)
%secs_nopad%  - (Seconds - Minutes) from set date (integer number, no padding)

%months%       - (Months - Years) from set date, will be 11 or less (integer number)
%tot_months%   - Months from set date, can be larger than 11 (integer number)
%sign%         - Is used for NASA style countdown, will be '-' before set date and '' after set date (blank or '-')



-------------- CAVEATS ---------------------------------------------
If a daylight saving time shift should occur in either the client's tz or
the target's tz between the current date/time and your target datetime,
you could be off by one hour until you pass the point of conversion.

If you use the PHP input format beware.  If you have a syntax or other PHP error
and you've put your code in a block visible on all pages your entire site
may go down and you'll need to edit your database directly to delete that block!

File

README.txt
View source
  1. -------------- OVERVIEW -------------------------------------------
  2. The Javascript Timer module provides a timer api that can hook html elements to
  3. javascript widget objects. This is useful if you want a moving timer/clock or a
  4. widget that updates every second. It comes with widgets for a countdown timer, a
  5. countup timer, and a clock.
  6. -------------- INSTALLING -----------------------------------------
  7. Simply by activating the module and a widget.
  8. There are no module dependencies.
  9. There are no table components.
  10. -------------- GENERAL USAGE -----------------------------------------
  11. You can either build-up your own nested
  12. a full html (or filtered with
  13. use php directly. There are now theme functions to help with
  14. the php formatted strings.
  15. NOTE: the date format is an ISO8601 subset, so use the
  16. formats as you see them below.
  17. -------------- Inline HTML Examples --------------
  18. Countdown timer:
  19. Countdown timer with output format number setting:
  20. Count up timer:
  21. NASA style down/up timer:
  22. Clock:
  23. -------------- PHP Input Format Examples --------------
  24. Countdown timer:
  25. print theme('jstimer', 'jst_timer', array(
  26. 'datetime' => '2015-05-02T08:11:00-08:00'
  27. ));
  28. ?>
  29. Countdown timer with output format number setting:
  30. print theme('jstimer', 'jst_timer', array(
  31. 'datetime' => '2015-05-02T08:11:00-08:00',
  32. 'format_num' => 2,
  33. ));
  34. ?>
  35. Count up timer:
  36. print theme('jstimer', 'jst_timer', array(
  37. 'datetime' => '2010-05-02T08:11:00+02:00',
  38. 'dir'=>'up'
  39. ));
  40. ?>
  41. NASA style down/up timer:
  42. print theme('jstimer', 'jst_timer', array(
  43. 'datetime' => '2015-05-02T08:11:00+02:00',
  44. 'dir'=>'up',
  45. 'format_txt' => '%sign%%hours%::%mins%::%secs%'
  46. ));
  47. ?>
  48. Clock Widget:
  49. print theme('jstimer', 'jst_clock', array(
  50. 'clock_type' => 2,
  51. 'size' => 200
  52. ));
  53. ?>
  54. -------------- Timer widget OUTPUT FORMAT ---------------------------------------
  55. The display of the actual timer is configurable in the Site configuration
  56. admin menu: countdowntimer.
  57. IMPORTANT: If you have a format_num and a format_txt in a timer, the format_txt
  58. value will trump the format_num value.
  59. Currently supported replacement values are:
  60. %day% - Day number of target date (0-31)
  61. %month% - Month number of target date (1-12)
  62. %year% - Year number of target date (4 digit number)
  63. %dow% - Day-Of-Week (Mon-Sun)
  64. %moy% - Month-Of-Year (Jan-Dec)
  65. %years% - Years from set date(integer number)
  66. %ydays% - (Days - Years) from set date(integer number)
  67. %days% - Total Days from set date (integer number)
  68. %hours% - (Hours - Days) from set date (integer number, zero padded)
  69. %mins% - (Minutes - Hours) from set date (intger number, zero padded)
  70. %secs% - (Seconds - Minutes) from set date (integer number, zero padded)
  71. %hours_nopad% - (Hours - Days) from set date (integer number, no padding)
  72. %mins_nopad% - (Minutes - Hours) from set date (intger number, no padding)
  73. %secs_nopad% - (Seconds - Minutes) from set date (integer number, no padding)
  74. %months% - (Months - Years) from set date, will be 11 or less (integer number)
  75. %tot_months% - Months from set date, can be larger than 11 (integer number)
  76. %sign% - Is used for NASA style countdown, will be '-' before set date and '' after set date (blank or '-')
  77. -------------- CAVEATS ---------------------------------------------
  78. If a daylight saving time shift should occur in either the client's tz or
  79. the target's tz between the current date/time and your target datetime,
  80. you could be off by one hour until you pass the point of conversion.
  81. If you use the PHP input format beware. If you have a syntax or other PHP error
  82. and you've put your code in a block visible on all pages your entire site
  83. may go down and you'll need to edit your database directly to delete that block!