Projet

Général

Profil

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

root / drupal7 / sites / all / modules / jquery_countdown_timer / js / jquery_countdown_timer_init.js @ 651307cd

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(weeks,days, hours, minutes, seconds){
9
          var dateStrings = new Array();
10
          dateStrings['@weeks'] = Drupal.formatPlural(weeks, '1 week', '@count weeks');
11
          dateStrings['@days'] = Drupal.formatPlural(days, '1 day', '@count days');
12
          dateStrings['@hours'] = Drupal.formatPlural(hours, '1 hour', '@count hours');
13
          dateStrings['@minutes'] = Drupal.formatPlural(minutes, '1 minute', '@count minutes');
14
          dateStrings['@seconds'] = Drupal.formatPlural(seconds, '1 second', '@count seconds');
15
          var message = Drupal.t('@weeks, @days, @hours, @minutes and @seconds left', dateStrings);
16
          note.html(message);
17
        }
18
      });
19
    }
20
  }
21
})(jQuery);