Projet

Général

Profil

Paste
Télécharger (1,03 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / jquery_countdown_timer / js / jquery_countdown_timer_init.js @ 76df55b7

1
(function($){
2
  Drupal.behaviors.jquery_coundown_timer_init_popup = {
3
    attach: function(context, settings) {
4
      var note = $('#jquery-countdown-timer-note'),
5
      ts = new Date(Drupal.settings.jquery_countdown_timer.jquery_countdown_timer_date * 1000);
6
      $('#jquery-countdown-timer').not('.jquery-countdown-timer-processed').addClass('jquery-countdown-timer-processed').countdown({
7
        timestamp : ts,
8
        callback : function(days, hours, minutes, seconds){
9
          var dateStrings = new Array();
10
          dateStrings['@days'] = Drupal.formatPlural(days, '1 day', '@count days');
11
          dateStrings['@hours'] = Drupal.formatPlural(hours, '1 hour', '@count hours');
12
          dateStrings['@minutes'] = Drupal.formatPlural(minutes, '1 minute', '@count minutes');
13
          dateStrings['@seconds'] = Drupal.formatPlural(seconds, '1 second', '@count seconds');
14
          var message = Drupal.t('@days, @hours, @minutes and @seconds left', dateStrings);
15
          note.html(message);
16
        }
17
      });
18
    }
19
  }
20
})(jQuery);