jquery-countdown-rails 1.6.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jquery-countdown-rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/jquery.countdown-ar.js +2 -2
  4. data/vendor/assets/javascripts/jquery.countdown-bg.js +2 -2
  5. data/vendor/assets/javascripts/jquery.countdown-bn.js +0 -0
  6. data/vendor/assets/javascripts/jquery.countdown-bs.js +2 -2
  7. data/vendor/assets/javascripts/jquery.countdown-ca.js +2 -2
  8. data/vendor/assets/javascripts/jquery.countdown-cs.js +2 -2
  9. data/vendor/assets/javascripts/jquery.countdown-cy.js +1 -1
  10. data/vendor/assets/javascripts/jquery.countdown-da.js +2 -2
  11. data/vendor/assets/javascripts/jquery.countdown-de.js +2 -2
  12. data/vendor/assets/javascripts/jquery.countdown-el.js +2 -2
  13. data/vendor/assets/javascripts/jquery.countdown-es.js +2 -2
  14. data/vendor/assets/javascripts/jquery.countdown-et.js +2 -2
  15. data/vendor/assets/javascripts/jquery.countdown-fa.js +3 -3
  16. data/vendor/assets/javascripts/jquery.countdown-fi.js +2 -2
  17. data/vendor/assets/javascripts/jquery.countdown-fr.js +2 -2
  18. data/vendor/assets/javascripts/jquery.countdown-gl.js +2 -2
  19. data/vendor/assets/javascripts/jquery.countdown-gu.js +2 -2
  20. data/vendor/assets/javascripts/jquery.countdown-he.js +2 -2
  21. data/vendor/assets/javascripts/jquery.countdown-hr.js +2 -2
  22. data/vendor/assets/javascripts/jquery.countdown-hu.js +2 -2
  23. data/vendor/assets/javascripts/jquery.countdown-hy.js +2 -2
  24. data/vendor/assets/javascripts/jquery.countdown-id.js +2 -2
  25. data/vendor/assets/javascripts/jquery.countdown-it.js +2 -2
  26. data/vendor/assets/javascripts/jquery.countdown-ja.js +2 -2
  27. data/vendor/assets/javascripts/jquery.countdown-kn.js +2 -2
  28. data/vendor/assets/javascripts/jquery.countdown-ko.js +2 -2
  29. data/vendor/assets/javascripts/jquery.countdown-lt.js +2 -2
  30. data/vendor/assets/javascripts/jquery.countdown-lv.js +2 -2
  31. data/vendor/assets/javascripts/jquery.countdown-ml.js +2 -2
  32. data/vendor/assets/javascripts/jquery.countdown-ms.js +2 -2
  33. data/vendor/assets/javascripts/jquery.countdown-my.js +2 -2
  34. data/vendor/assets/javascripts/jquery.countdown-nb.js +2 -2
  35. data/vendor/assets/javascripts/jquery.countdown-nl.js +2 -2
  36. data/vendor/assets/javascripts/jquery.countdown-pl.js +2 -2
  37. data/vendor/assets/javascripts/jquery.countdown-pt-BR.js +2 -2
  38. data/vendor/assets/javascripts/jquery.countdown-ro.js +2 -2
  39. data/vendor/assets/javascripts/jquery.countdown-ru.js +2 -2
  40. data/vendor/assets/javascripts/jquery.countdown-sk.js +2 -2
  41. data/vendor/assets/javascripts/jquery.countdown-sl.js +2 -2
  42. data/vendor/assets/javascripts/jquery.countdown-sq.js +2 -2
  43. data/vendor/assets/javascripts/jquery.countdown-sr-SR.js +2 -2
  44. data/vendor/assets/javascripts/jquery.countdown-sr.js +2 -2
  45. data/vendor/assets/javascripts/jquery.countdown-sv.js +2 -2
  46. data/vendor/assets/javascripts/jquery.countdown-th.js +2 -2
  47. data/vendor/assets/javascripts/jquery.countdown-tr.js +2 -2
  48. data/vendor/assets/javascripts/jquery.countdown-uk.js +2 -2
  49. data/vendor/assets/javascripts/jquery.countdown-ur.js +13 -0
  50. data/vendor/assets/javascripts/jquery.countdown-uz.js +2 -2
  51. data/vendor/assets/javascripts/jquery.countdown-vi.js +2 -2
  52. data/vendor/assets/javascripts/jquery.countdown-zh-CN.js +2 -2
  53. data/vendor/assets/javascripts/jquery.countdown-zh-TW.js +2 -2
  54. data/vendor/assets/javascripts/jquery.countdown.js +365 -315
  55. data/vendor/assets/javascripts/jquery.plugin.js +344 -0
  56. data/vendor/assets/stylesheets/jquery.countdown.css +19 -16
  57. metadata +3 -1
@@ -2,12 +2,12 @@
2
2
  Malay initialisation for the jQuery countdown extension
3
3
  Written by Jason Ong (jason{at}portalgroove.com) May 2010. */
4
4
  (function($) {
5
- $.countdown.regional['ms'] = {
5
+ $.countdown.regionalOptions['ms'] = {
6
6
  labels: ['Tahun', 'Bulan', 'Minggu', 'Hari', 'Jam', 'Minit', 'Saat'],
7
7
  labels1: ['Tahun', 'Bulan', 'Minggu', 'Hari', 'Jam', 'Minit', 'Saat'],
8
8
  compactLabels: ['t', 'b', 'm', 'h'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['ms']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['ms']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Burmese initialisation for the jQuery countdown extension
3
3
  Written by Win Lwin Moe (winnlwinmoe@gmail.com) Dec 2009. */
4
4
  (function($) {
5
- $.countdown.regional['my'] = {
5
+ $.countdown.regionalOptions['my'] = {
6
6
  labels: ['နွစ္', 'လ', 'ရက္သတဿတပတ္', 'ရက္', 'နာရီ', 'မိနစ္', 'စကဿကန့္'],
7
7
  labels1: ['နွစ္', 'လ', 'ရက္သတဿတပတ္', 'ရက္', 'နာရီ', 'မိနစ္', 'စကဿကန့္'],
8
8
  compactLabels: ['နွစ္', 'လ', 'ရက္သတဿတပတ္', 'ရက္'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['my']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['my']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Norwegian Bokmål translation
3
3
  Written by Kristian Ravnevand */
4
4
  (function($) {
5
- $.countdown.regional['nb'] = {
5
+ $.countdown.regionalOptions['nb'] = {
6
6
  labels: ['År', 'Måneder', 'Uker', 'Dager', 'Timer', 'Minutter', 'Sekunder'],
7
7
  labels1: ['År', 'Måned', 'Uke', 'Dag', 'Time', 'Minutt', 'Sekund'],
8
8
  compactLabels: ['Å', 'M', 'U', 'D'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['nb']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['nb']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Dutch initialisation for the jQuery countdown extension
3
3
  Written by Mathias Bynens <http://mathiasbynens.be/> Mar 2008. */
4
4
  (function($) {
5
- $.countdown.regional['nl'] = {
5
+ $.countdown.regionalOptions['nl'] = {
6
6
  labels: ['Jaren', 'Maanden', 'Weken', 'Dagen', 'Uren', 'Minuten', 'Seconden'],
7
7
  labels1: ['Jaar', 'Maand', 'Week', 'Dag', 'Uur', 'Minuut', 'Seconde'],
8
8
  compactLabels: ['j', 'm', 'w', 'd'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['nl']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['nl']);
13
13
  })(jQuery);
@@ -2,7 +2,7 @@
2
2
  * Polish initialisation for the jQuery countdown extension
3
3
  * Written by Pawel Lewtak lewtak@gmail.com (2008) */
4
4
  (function($) {
5
- $.countdown.regional['pl'] = {
5
+ $.countdown.regionalOptions['pl'] = {
6
6
  labels: ['lat', 'miesięcy', 'tygodni', 'dni', 'godzin', 'minut', 'sekund'],
7
7
  labels1: ['rok', 'miesiąc', 'tydzień', 'dzień', 'godzina', 'minuta', 'sekunda'],
8
8
  labels2: ['lata', 'miesiące', 'tygodnie', 'dni', 'godziny', 'minuty', 'sekundy'],
@@ -14,5 +14,5 @@
14
14
  },
15
15
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
16
16
  timeSeparator: ':', isRTL: false};
17
- $.countdown.setDefaults($.countdown.regional['pl']);
17
+ $.countdown.setDefaults($.countdown.regionalOptions['pl']);
18
18
  })(jQuery);
@@ -3,12 +3,12 @@
3
3
  Translated by Marcelo Pellicano de Oliveira (pellicano@gmail.com) Feb 2008.
4
4
  and Juan Roldan (juan.roldan[at]relayweb.com.br) Mar 2012. */
5
5
  (function($) {
6
- $.countdown.regional['pt-BR'] = {
6
+ $.countdown.regionalOptions['pt-BR'] = {
7
7
  labels: ['Anos', 'Meses', 'Semanas', 'Dias', 'Horas', 'Minutos', 'Segundos'],
8
8
  labels1: ['Ano', 'M�s', 'Semana', 'Dia', 'Hora', 'Minuto', 'Segundo'],
9
9
  compactLabels: ['a', 'm', 's', 'd'],
10
10
  whichLabels: null,
11
11
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
12
12
  timeSeparator: ':', isRTL: false};
13
- $.countdown.setDefaults($.countdown.regional['pt-BR']);
13
+ $.countdown.setDefaults($.countdown.regionalOptions['pt-BR']);
14
14
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  * Romanian initialisation for the jQuery countdown extension
3
3
  * Written by Edmond L. (webmond@gmail.com). */
4
4
  (function($) {
5
- $.countdown.regional['ro'] = {
5
+ $.countdown.regionalOptions['ro'] = {
6
6
  labels: ['Ani', 'Luni', 'Saptamani', 'Zile', 'Ore', 'Minute', 'Secunde'],
7
7
  labels1: ['An', 'Luna', 'Saptamana', 'Ziua', 'Ora', 'Minutul', 'Secunda'],
8
8
  compactLabels: ['A', 'L', 'S', 'Z'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['ro']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['ro']);
13
13
  })(jQuery);
@@ -2,7 +2,7 @@
2
2
  * Russian initialisation for the jQuery countdown extension
3
3
  * Written by Sergey K. (xslade{at}gmail.com) June 2010. */
4
4
  (function($) {
5
- $.countdown.regional['ru'] = {
5
+ $.countdown.regionalOptions['ru'] = {
6
6
  labels: ['Лет', 'Месяцев', 'Недель', 'Дней', 'Часов', 'Минут', 'Секунд'],
7
7
  labels1: ['Год', 'Месяц', 'Неделя', 'День', 'Час', 'Минута', 'Секунда'],
8
8
  labels2: ['Года', 'Месяца', 'Недели', 'Дня', 'Часа', 'Минуты', 'Секунды'],
@@ -15,5 +15,5 @@
15
15
  },
16
16
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
17
17
  timeSeparator: ':', isRTL: false};
18
- $.countdown.setDefaults($.countdown.regional['ru']);
18
+ $.countdown.setDefaults($.countdown.regionalOptions['ru']);
19
19
  })(jQuery);
@@ -2,7 +2,7 @@
2
2
  * Slovak initialisation for the jQuery countdown extension
3
3
  * Written by Roman Chlebec (creamd@c64.sk) (2008) */
4
4
  (function($) {
5
- $.countdown.regional['sk'] = {
5
+ $.countdown.regionalOptions['sk'] = {
6
6
  labels: ['Rokov', 'Mesiacov', 'Týždňov', 'Dní', 'Hodín', 'Minút', 'Sekúnd'],
7
7
  labels1: ['Rok', 'Mesiac', 'Týždeň', 'Deň', 'Hodina', 'Minúta', 'Sekunda'],
8
8
  labels2: ['Roky', 'Mesiace', 'Týždne', 'Dni', 'Hodiny', 'Minúty', 'Sekundy'],
@@ -12,5 +12,5 @@
12
12
  },
13
13
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
14
14
  timeSeparator: ':', isRTL: false};
15
- $.countdown.setDefaults($.countdown.regional['sk']);
15
+ $.countdown.setDefaults($.countdown.regionalOptions['sk']);
16
16
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  * Slovenian localisation for the jQuery countdown extension
3
3
  * Written by Borut Tomažin (debijan{at}gmail.com) (2011) */
4
4
  (function($) {
5
- $.countdown.regional['sl'] = {
5
+ $.countdown.regionalOptions['sl'] = {
6
6
  labels: ['Let', 'Mesecev', 'Tednov', 'Dni', 'Ur', 'Minut', 'Sekund'],
7
7
  labels1: ['Leto', 'Mesec', 'Teden', 'Dan', 'Ura', 'Minuta', 'Sekunda'],
8
8
  compactLabels: ['l', 'm', 't', 'd'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['sl']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['sl']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Albanian initialisation for the jQuery countdown extension
3
3
  Written by Erzen Komoni. */
4
4
  (function($) {
5
- $.countdown.regional['sq'] = {
5
+ $.countdown.regionalOptions['sq'] = {
6
6
  labels: ['Vite', 'Muaj', 'Javë', 'Ditë', 'Orë', 'Minuta', 'Sekonda'],
7
7
  labels1: ['Vit', 'Muaj', 'Javë', 'Dit', 'Orë', 'Minutë', 'Sekond'],
8
8
  compactLabels: ['V', 'M', 'J', 'D'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['sq']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['sq']);
13
13
  })(jQuery);
@@ -2,7 +2,7 @@
2
2
  * Serbian Latin initialisation for the jQuery countdown extension
3
3
  * Written by Predrag Leka lp@lemurcake.com (2010) */
4
4
  (function($) {
5
- $.countdown.regional['sr-SR'] = {
5
+ $.countdown.regionalOptions['sr-SR'] = {
6
6
  labels: ['Godina', 'Meseci', 'Nedelja', 'Dana', 'Časova', 'Minuta', 'Sekundi'],
7
7
  labels1: ['Godina', 'Mesec', 'Nedelja', 'Dan', 'Čas', 'Minut', 'Sekunda'],
8
8
  labels2: ['Godine', 'Meseca', 'Nedelje', 'Dana', 'Časa', 'Minuta', 'Sekunde'],
@@ -12,5 +12,5 @@
12
12
  },
13
13
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
14
14
  timeSeparator: ':', isRTL: false};
15
- $.countdown.setDefaults($.countdown.regional['sr-SR']);
15
+ $.countdown.setDefaults($.countdown.regionalOptions['sr-SR']);
16
16
  })(jQuery);
@@ -2,7 +2,7 @@
2
2
  * Serbian Cyrillic initialisation for the jQuery countdown extension
3
3
  * Written by Predrag Leka lp@lemurcake.com (2010) */
4
4
  (function($) {
5
- $.countdown.regional['sr'] = {
5
+ $.countdown.regionalOptions['sr'] = {
6
6
  labels: ['Година', 'Месеци', 'Недеља', 'Дана', 'Часова', 'Минута', 'Секунди'],
7
7
  labels1: ['Година', 'месец', 'Недеља', 'Дан', 'Час', 'Минут', 'Секунда'],
8
8
  labels2: ['Године', 'Месеца', 'Недеље', 'Дана', 'Часа', 'Минута', 'Секунде'],
@@ -12,5 +12,5 @@
12
12
  },
13
13
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
14
14
  timeSeparator: ':', isRTL: false};
15
- $.countdown.setDefaults($.countdown.regional['sr']);
15
+ $.countdown.setDefaults($.countdown.regionalOptions['sr']);
16
16
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Swedish initialisation for the jQuery countdown extension
3
3
  Written by Carl (carl@nordenfelt.com). */
4
4
  (function($) {
5
- $.countdown.regional['sv'] = {
5
+ $.countdown.regionalOptions['sv'] = {
6
6
  labels: ['År', 'Månader', 'Veckor', 'Dagar', 'Timmar', 'Minuter', 'Sekunder'],
7
7
  labels1: ['År', 'Månad', 'Vecka', 'Dag', 'Timme', 'Minut', 'Sekund'],
8
8
  compactLabels: ['Å', 'M', 'V', 'D'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['sv']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['sv']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Thai initialisation for the jQuery countdown extension
3
3
  Written by Pornchai Sakulsrimontri (li_sin_th@yahoo.com). */
4
4
  (function($) {
5
- $.countdown.regional['th'] = {
5
+ $.countdown.regionalOptions['th'] = {
6
6
  labels: ['ปี', 'เดือน', 'สัปดาห์', 'วัน', 'ชั่วโมง', 'นาที', 'วินาที'],
7
7
  labels1: ['ปี', 'เดือน', 'สัปดาห์', 'วัน', 'ชั่วโมง', 'นาที', 'วินาที'],
8
8
  compactLabels: ['ปี', 'เดือน', 'สัปดาห์', 'วัน'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['th']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['th']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  * Turkish initialisation for the jQuery countdown extension
3
3
  * Written by Bekir Ahmetoğlu (bekir@cerek.com) Aug 2008. */
4
4
  (function($) {
5
- $.countdown.regional['tr'] = {
5
+ $.countdown.regionalOptions['tr'] = {
6
6
  labels: ['Yıl', 'Ay', 'Hafta', 'Gün', 'Saat', 'Dakika', 'Saniye'],
7
7
  labels1: ['Yıl', 'Ay', 'Hafta', 'Gün', 'Saat', 'Dakika', 'Saniye'],
8
8
  compactLabels: ['y', 'a', 'h', 'g'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['tr']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['tr']);
13
13
  })(jQuery);
@@ -2,7 +2,7 @@
2
2
  * Ukrainian initialisation for the jQuery countdown extension
3
3
  * Written by Goloborodko M misha.gm@gmail.com (2009), corrections by Iгор Kоновал */
4
4
  (function($) {
5
- $.countdown.regional['uk'] = {
5
+ $.countdown.regionalOptions['uk'] = {
6
6
  labels: ['Років', 'Місяців', 'Тижнів', 'Днів', 'Годин', 'Хвилин', 'Секунд'],
7
7
  labels1: ['Рік', 'Місяць', 'Тиждень', 'День', 'Година', 'Хвилина', 'Секунда'],
8
8
  labels2: ['Роки', 'Місяці', 'Тижні', 'Дні', 'Години', 'Хвилини', 'Секунди'],
@@ -12,5 +12,5 @@
12
12
  },
13
13
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
14
14
  timeSeparator: ':', isRTL: false};
15
- $.countdown.setDefaults($.countdown.regional['uk']);
15
+ $.countdown.setDefaults($.countdown.regionalOptions['uk']);
16
16
  })(jQuery);
@@ -0,0 +1,13 @@
1
+ /* http://keith-wood.name/countdown.html
2
+ Urdu (اردو) initialisation for the jQuery countdown extension
3
+ Translated by Azhar Rasheed (azhar.rasheed19@gmail.com), November 2013. */
4
+ (function($) {
5
+ $.countdown.regionalOptions['ur'] = {
6
+ labels: ['سال','مہينے','ہفتے','دن','گھنٹے','منٹس','سيکنڑز'],
7
+ labels1: ['سال','ماہ','ہفتہ','دن','گھنٹہ','منٹ','سیکنڈز'],
8
+ compactLabels: ['(ق)', 'سینٹ', 'ایک', 'J'],
9
+ whichLabels: null,
10
+ digits: ['٠', '١', '٢', '٣', '۴', '۵', '۶', '۷', '٨', '٩'],
11
+ timeSeparator: ':', isRTL: true};
12
+ $.countdown.setDefaults($.countdown.regionalOptions['ur']);
13
+ })(jQuery);
@@ -2,12 +2,12 @@
2
2
  * Uzbek initialisation for the jQuery countdown extension
3
3
  * Written by Alisher U. (ulugbekov{at}gmail.com) August 2012. */
4
4
  (function($) {
5
- $.countdown.regional['uz'] = {
5
+ $.countdown.regionalOptions['uz'] = {
6
6
  labels: ['Yil', 'Oy', 'Hafta', 'Kun', 'Soat', 'Daqiqa', 'Soniya'],
7
7
  labels1: ['Yil', 'Oy', 'Hafta', 'Kun', 'Soat', 'Daqiqa', 'Soniya'],
8
8
  compactLabels: ['y', 'o', 'h', 'k'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['uz']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['uz']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  * Vietnamese initialisation for the jQuery countdown extension
3
3
  * Written by Pham Tien Hung phamtienhung@gmail.com (2010) */
4
4
  (function($) {
5
- $.countdown.regional['vi'] = {
5
+ $.countdown.regionalOptions['vi'] = {
6
6
  labels: ['Năm', 'Tháng', 'Tuần', 'Ngày', 'Giờ', 'Phút', 'Giây'],
7
7
  labels1: ['Năm', 'Tháng', 'Tuần', 'Ngày', 'Giờ', 'Phút', 'Giây'],
8
8
  compactLabels: ['năm', 'th', 'tu', 'ng'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['vi']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['vi']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Simplified Chinese initialisation for the jQuery countdown extension
3
3
  Written by Cloudream (cloudream@gmail.com). */
4
4
  (function($) {
5
- $.countdown.regional['zh-CN'] = {
5
+ $.countdown.regionalOptions['zh-CN'] = {
6
6
  labels: ['年', '月', '周', '天', '时', '分', '秒'],
7
7
  labels1: ['年', '月', '周', '天', '时', '分', '秒'],
8
8
  compactLabels: ['年', '月', '周', '天'], compactLabels1: ['年', '月', '周', '天'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['zh-CN']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['zh-CN']);
13
13
  })(jQuery);
@@ -2,12 +2,12 @@
2
2
  Traditional Chinese initialisation for the jQuery countdown extension
3
3
  Written by Cloudream (cloudream@gmail.com). */
4
4
  (function($) {
5
- $.countdown.regional['zh-TW'] = {
5
+ $.countdown.regionalOptions['zh-TW'] = {
6
6
  labels: ['年', '月', '周', '天', '時', '分', '秒'],
7
7
  labels1: ['年', '月', '周', '天', '時', '分', '秒'],
8
8
  compactLabels: ['年', '月', '周', '天'], compactLabels1: ['年', '月', '周', '天'],
9
9
  whichLabels: null,
10
10
  digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
11
11
  timeSeparator: ':', isRTL: false};
12
- $.countdown.setDefaults($.countdown.regional['zh-TW']);
12
+ $.countdown.setDefaults($.countdown.regionalOptions['zh-TW']);
13
13
  })(jQuery);
@@ -1,57 +1,184 @@
1
+ // Countdown dependency as a manifest
2
+ //= require jquery.plugin
3
+
1
4
  /* http://keith-wood.name/countdown.html
2
- Countdown for jQuery v1.6.3.
5
+ Countdown for jQuery v2.0.0.
3
6
  Written by Keith Wood (kbwood{at}iinet.com.au) January 2008.
4
7
  Available under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license.
5
8
  Please attribute the author if you use it. */
6
9
 
7
- /* Display a countdown timer.
8
- Attach it with options like:
9
- $('div selector').countdown(
10
- {until: new Date(2009, 1 - 1, 1, 0, 0, 0), onExpiry: happyNewYear}); */
11
-
12
10
  (function($) { // Hide scope, no $ conflict
13
11
 
14
- /* Countdown manager. */
15
- function Countdown() {
16
- this.regional = []; // Available regional settings, indexed by language code
17
- this.regional[''] = { // Default regional settings
18
- // The display texts for the counters
12
+ var pluginName = 'countdown';
13
+
14
+ var Y = 0; // Years
15
+ var O = 1; // Months
16
+ var W = 2; // Weeks
17
+ var D = 3; // Days
18
+ var H = 4; // Hours
19
+ var M = 5; // Minutes
20
+ var S = 6; // Seconds
21
+
22
+ /** Create the countdown plugin.
23
+ <p>Sets an element to show the time remaining until a given instant.</p>
24
+ <p>Expects HTML like:</p>
25
+ <pre>&lt;div>&lt;/div></pre>
26
+ <p>Provide inline configuration like:</p>
27
+ <pre>&lt;div data-countdown="name: 'value'">&lt;/div></pre>
28
+ @module Countdown
29
+ @augments JQPlugin
30
+ @example $(selector).countdown({until: +300}) */
31
+ $.JQPlugin.createPlugin({
32
+
33
+ /** The name of the plugin. */
34
+ name: pluginName,
35
+
36
+ /** Countdown expiry callback.
37
+ Triggered when the countdown expires.
38
+ @callback expiryCallback */
39
+
40
+ /** Countdown server synchronisation callback.
41
+ Triggered when the countdown is initialised.
42
+ @callback serverSyncCallback
43
+ @return {Date} The current date/time on the server as expressed in the local timezone. */
44
+
45
+ /** Countdown tick callback.
46
+ Triggered on every <code>tickInterval</code> ticks of the countdown.
47
+ @callback tickCallback
48
+ @param periods {number[]} The breakdown by period (years, months, weeks, days,
49
+ hours, minutes, seconds) of the time remaining/passed. */
50
+
51
+ /** Countdown which labels callback.
52
+ Triggered when the countdown is being display to determine which set of labels
53
+ (<code>labels</code>, <code>labels1</code>, ...) are to be used for the current period value.
54
+ @callback whichLabelsCallback
55
+ @param num {number} The current period value.
56
+ @return {number} The suffix for the label set to use. */
57
+
58
+ /** Default settings for the plugin.
59
+ @property until {Date|number|string} The date/time to count down to, or number of seconds
60
+ offset from now, or string of amounts and units for offset(s) from now:
61
+ 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds.
62
+ @example until: new Date(2013, 12-1, 25, 13, 30)
63
+ until: +300
64
+ until: '+1O -2D'
65
+ @property [since] {Date|number|string} The date/time to count up from, or
66
+ number of seconds offset from now, or string for unit offset(s):
67
+ 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds.
68
+ @example since: new Date(2013, 1-1, 1)
69
+ since: -300
70
+ since: '-1O +2D'
71
+ @property [timezone=null] {number} The timezone (hours or minutes from GMT) for the target times,
72
+ or null for client local timezone.
73
+ @example timezone: +10
74
+ timezone: -60
75
+ @property [serverSync=null] {serverSyncCallback} A function to retrieve the current server time
76
+ for synchronisation.
77
+ @property [format='dHMS'] {string} The format for display - upper case for always, lower case only if non-zero,
78
+ 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds.
79
+ @property [layout=''] {string} Build your own layout for the countdown.
80
+ @example layout: '{d<}{dn} {dl}{d>} {hnn}:{mnn}:{snn}'
81
+ @property [compact=false] {boolean} True to display in a compact format, false for an expanded one.
82
+ @property [padZeroes=false] {boolean} True to add leading zeroes
83
+ @property [significant=0] {number} The number of periods with non-zero values to show, zero for all.
84
+ @property [description=''] {string} The description displayed for the countdown.
85
+ @property [expiryUrl=''] {string} A URL to load upon expiry, replacing the current page.
86
+ @property [expiryText=''] {string} Text to display upon expiry, replacing the countdown. This may be HTML.
87
+ @property [alwaysExpire=false] {boolean} True to trigger <code>onExpiry</code> even if target time has passed.
88
+ @property [onExpiry=null] {expiryCallback} Callback when the countdown expires -
89
+ receives no parameters and <code>this</code> is the containing division.
90
+ @example onExpiry: function() {
91
+ ...
92
+ }
93
+ @property [onTick=null] {tickCallback} Callback when the countdown is updated -
94
+ receives <code>number[7]</code> being the breakdown by period
95
+ (years, months, weeks, days, hours, minutes, seconds - based on
96
+ <code>format</code>) and <code>this</code> is the containing division.
97
+ @example onTick: function(periods) {
98
+ var secs = $.countdown.periodsToSeconds(periods);
99
+ if (secs < 300) { // Last five minutes
100
+ ...
101
+ }
102
+ }
103
+ @property [tickInterval=1] {number} The interval (seconds) between <code>onTick</code> callbacks. */
104
+ defaultOptions: {
105
+ until: null,
106
+ since: null,
107
+ timezone: null,
108
+ serverSync: null,
109
+ format: 'dHMS',
110
+ layout: '',
111
+ compact: false,
112
+ padZeroes: false,
113
+ significant: 0,
114
+ description: '',
115
+ expiryUrl: '',
116
+ expiryText: '',
117
+ alwaysExpire: false,
118
+ onExpiry: null,
119
+ onTick: null,
120
+ tickInterval: 1
121
+ },
122
+
123
+ /** Localisations for the plugin.
124
+ Entries are objects indexed by the language code ('' being the default US/English).
125
+ Each object has the following attributes.
126
+ @property [labels=['Years','Months','Weeks','Days','Hours','Minutes','Seconds']] {string[]}
127
+ The display texts for the counter periods.
128
+ @property [labels1=['Year','Month','Week','Day','Hour','Minute','Second']] {string[]}
129
+ The display texts for the counter periods if they have a value of 1.
130
+ Add other <code>labels<em>n</em></code> attributes as necessary to
131
+ cater for other numeric idiosyncrasies of the localisation.
132
+ @property [compactLabels=['y','m','w','d']] {string[]} The compact texts for the counter periods.
133
+ @property [whichLabels=null] {whichLabelsCallback} A function to determine which
134
+ <code>labels<em>n</em></code> to use.
135
+ @example whichLabels: function(num) {
136
+ return (num > 1 ? 0 : 1);
137
+ }
138
+ @property [digits=['0','1',...,'9']] {number[]} The digits to display (0-9).
139
+ @property [timeSeparator=':'] {string} Separator for time periods in the compact layout.
140
+ @property [isRTL=false] {boolean} True for right-to-left languages, false for left-to-right. */
141
+ regionalOptions: { // Available regional settings, indexed by language/country code
142
+ '': { // Default regional settings - English/US
19
143
  labels: ['Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'],
20
- // The display texts for the counters if only one
21
144
  labels1: ['Year', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second'],
22
- compactLabels: ['y', 'm', 'w', 'd'], // The compact texts for the counters
23
- whichLabels: null, // Function to determine which labels to use
24
- digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], // The digits to display
25
- timeSeparator: ':', // Separator for time periods
26
- isRTL: false // True for right-to-left languages, false for left-to-right
27
- };
28
- this._defaults = {
29
- until: null, // new Date(year, mth - 1, day, hr, min, sec) - date/time to count down to
30
- // or numeric for seconds offset, or string for unit offset(s):
31
- // 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
32
- since: null, // new Date(year, mth - 1, day, hr, min, sec) - date/time to count up from
33
- // or numeric for seconds offset, or string for unit offset(s):
34
- // 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
35
- timezone: null, // The timezone (hours or minutes from GMT) for the target times,
36
- // or null for client local
37
- serverSync: null, // A function to retrieve the current server time for synchronisation
38
- format: 'dHMS', // Format for display - upper case for always, lower case only if non-zero,
39
- // 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
40
- layout: '', // Build your own layout for the countdown
41
- compact: false, // True to display in a compact format, false for an expanded one
42
- significant: 0, // The number of periods with values to show, zero for all
43
- description: '', // The description displayed for the countdown
44
- expiryUrl: '', // A URL to load upon expiry, replacing the current page
45
- expiryText: '', // Text to display upon expiry, replacing the countdown
46
- alwaysExpire: false, // True to trigger onExpiry even if never counted down
47
- onExpiry: null, // Callback when the countdown expires -
48
- // receives no parameters and 'this' is the containing division
49
- onTick: null, // Callback when the countdown is updated -
50
- // receives int[7] being the breakdown by period (based on format)
51
- // and 'this' is the containing division
52
- tickInterval: 1 // Interval (seconds) between onTick callbacks
53
- };
54
- $.extend(this._defaults, this.regional['']);
145
+ compactLabels: ['y', 'm', 'w', 'd'],
146
+ whichLabels: null,
147
+ digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
148
+ timeSeparator: ':',
149
+ isRTL: false
150
+ }
151
+ },
152
+
153
+ /** Names of getter methods - those that can't be chained. */
154
+ _getters: ['getTimes'],
155
+
156
+ /* Class name for the right-to-left marker. */
157
+ _rtlClass: pluginName + '-rtl',
158
+ /* Class name for the countdown section marker. */
159
+ _sectionClass: pluginName + '-section',
160
+ /* Class name for the period amount marker. */
161
+ _amountClass: pluginName + '-amount',
162
+ /* Class name for the period name marker. */
163
+ _periodClass: pluginName + '-period',
164
+ /* Class name for the countdown row marker. */
165
+ _rowClass: pluginName + '-row',
166
+ /* Class name for the holding countdown marker. */
167
+ _holdingClass: pluginName + '-holding',
168
+ /* Class name for the showing countdown marker. */
169
+ _showClass: pluginName + '-show',
170
+ /* Class name for the description marker. */
171
+ _descrClass: pluginName + '-descr',
172
+
173
+ /* List of currently active countdown elements. */
174
+ _timerElems: [],
175
+
176
+ /** Additional setup for the countdown.
177
+ Apply default localisations.
178
+ Create the timer. */
179
+ _init: function() {
180
+ var self = this;
181
+ this._super();
55
182
  this._serverSyncs = [];
56
183
  var now = (typeof Date.now == 'function' ? Date.now :
57
184
  function() { return new Date().getTime(); });
@@ -63,7 +190,7 @@ function Countdown() {
63
190
  // Integer milliseconds since unix epoch
64
191
  timestamp || now());
65
192
  if (drawStart - animationStartTime >= 1000) {
66
- plugin._updateTargets();
193
+ self._updateElems();
67
194
  animationStartTime = drawStart;
68
195
  }
69
196
  requestAnimationFrame(timerCallBack);
@@ -75,7 +202,7 @@ function Countdown() {
75
202
  var animationStartTime = 0;
76
203
  if (!requestAnimationFrame || $.noRequestAnimationFrame) {
77
204
  $.noRequestAnimationFrame = null;
78
- setInterval(function() { plugin._updateTargets(); }, 980); // Fall back to good old setInterval
205
+ setInterval(function() { self._updateElems(); }, 980); // Fall back to good old setInterval
79
206
  }
80
207
  else {
81
208
  animationStartTime = window.animationStartTime ||
@@ -83,58 +210,20 @@ function Countdown() {
83
210
  window.oAnimationStartTime || window.msAnimationStartTime || now();
84
211
  requestAnimationFrame(timerCallBack);
85
212
  }
86
- }
87
-
88
- var Y = 0; // Years
89
- var O = 1; // Months
90
- var W = 2; // Weeks
91
- var D = 3; // Days
92
- var H = 4; // Hours
93
- var M = 5; // Minutes
94
- var S = 6; // Seconds
95
-
96
- $.extend(Countdown.prototype, {
97
- /* Class name added to elements to indicate already configured with countdown. */
98
- markerClassName: 'hasCountdown',
99
- /* Name of the data property for instance settings. */
100
- propertyName: 'countdown',
101
-
102
- /* Class name for the right-to-left marker. */
103
- _rtlClass: 'countdown_rtl',
104
- /* Class name for the countdown section marker. */
105
- _sectionClass: 'countdown_section',
106
- /* Class name for the period amount marker. */
107
- _amountClass: 'countdown_amount',
108
- /* Class name for the countdown row marker. */
109
- _rowClass: 'countdown_row',
110
- /* Class name for the holding countdown marker. */
111
- _holdingClass: 'countdown_holding',
112
- /* Class name for the showing countdown marker. */
113
- _showClass: 'countdown_show',
114
- /* Class name for the description marker. */
115
- _descrClass: 'countdown_descr',
116
-
117
- /* List of currently active countdown targets. */
118
- _timerTargets: [],
213
+ },
119
214
 
120
- /* Override the default settings for all instances of the countdown widget.
121
- @param options (object) the new settings to use as defaults */
122
- setDefaults: function(options) {
123
- this._resetExtraLabels(this._defaults, options);
124
- $.extend(this._defaults, options || {});
125
- },
126
-
127
- /* Convert a date/time to UTC.
128
- @param tz (number) the hour or minute offset from GMT, e.g. +9, -360
129
- @param year (Date) the date/time in that timezone or
130
- (number) the year in that timezone
131
- @param month (number, optional) the month (0 - 11) (omit if year is a Date)
132
- @param day (number, optional) the day (omit if year is a Date)
133
- @param hours (number, optional) the hour (omit if year is a Date)
134
- @param mins (number, optional) the minute (omit if year is a Date)
135
- @param secs (number, optional) the second (omit if year is a Date)
136
- @param ms (number, optional) the millisecond (omit if year is a Date)
137
- @return (Date) the equivalent UTC date/time */
215
+ /** Convert a date/time to UTC.
216
+ @param tz {number} The hour or minute offset from GMT, e.g. +9, -360.
217
+ @param year {Date|number} the date/time in that timezone or the year in that timezone.
218
+ @param [month] {number} The month (0 - 11) (omit if <code>year</code> is a <code>Date</code>).
219
+ @param [day] {number} The day (omit if <code>year</code> is a <code>Date</code>).
220
+ @param [hours] {number} The hour (omit if <code>year</code> is a <code>Date</code>).
221
+ @param [mins] {number} The minute (omit if <code>year</code> is a <code>Date</code>).
222
+ @param [secs] {number} The second (omit if <code>year</code> is a <code>Date</code>).
223
+ @param [ms] {number} The millisecond (omit if <code>year</code> is a <code>Date</code>).
224
+ @return {Date} The equivalent UTC date/time.
225
+ @example $.countdown.UTCDate(+10, 2013, 12-1, 25, 12, 0)
226
+ $.countdown.UTCDate(-7, new Date(2013, 12-1, 25, 12, 0)) */
138
227
  UTCDate: function(tz, year, month, day, hours, mins, secs, ms) {
139
228
  if (typeof year == 'object' && year.constructor == Date) {
140
229
  ms = year.getMilliseconds();
@@ -157,113 +246,86 @@ $.extend(Countdown.prototype, {
157
246
  return d;
158
247
  },
159
248
 
160
- /* Convert a set of periods into seconds.
249
+ /** Convert a set of periods into seconds.
161
250
  Averaged for months and years.
162
- @param periods (number[7]) the periods per year/month/week/day/hour/minute/second
163
- @return (number) the corresponding number of seconds */
251
+ @param periods {number[]} The periods per year/month/week/day/hour/minute/second.
252
+ @return {number} The corresponding number of seconds.
253
+ @example var secs = $.countdown.periodsToSeconds(periods) */
164
254
  periodsToSeconds: function(periods) {
165
255
  return periods[0] * 31557600 + periods[1] * 2629800 + periods[2] * 604800 +
166
256
  periods[3] * 86400 + periods[4] * 3600 + periods[5] * 60 + periods[6];
167
257
  },
168
258
 
169
- /* Attach the countdown widget to a div.
170
- @param target (element) the containing division
171
- @param options (object) the initial settings for the countdown */
172
- _attachPlugin: function(target, options) {
173
- target = $(target);
174
- if (target.hasClass(this.markerClassName)) {
175
- return;
176
- }
177
- var inst = {options: $.extend({}, this._defaults), _periods: [0, 0, 0, 0, 0, 0, 0]};
178
- target.addClass(this.markerClassName).data(this.propertyName, inst);
179
- this._optionPlugin(target, options);
259
+ _instSettings: function(elem, options) {
260
+ return {_periods: [0, 0, 0, 0, 0, 0, 0]};
180
261
  },
181
262
 
182
- /* Add a target to the list of active ones.
183
- @param target (element) the countdown target */
184
- _addTarget: function(target) {
185
- if (!this._hasTarget(target)) {
186
- this._timerTargets.push(target);
263
+ /** Add an element to the list of active ones.
264
+ @private
265
+ @param elem {Element} The countdown element. */
266
+ _addElem: function(elem) {
267
+ if (!this._hasElem(elem)) {
268
+ this._timerElems.push(elem);
187
269
  }
188
270
  },
189
271
 
190
- /* See if a target is in the list of active ones.
191
- @param target (element) the countdown target
192
- @return (boolean) true if present, false if not */
193
- _hasTarget: function(target) {
194
- return ($.inArray(target, this._timerTargets) > -1);
272
+ /** See if an element is in the list of active ones.
273
+ @private
274
+ @param elem {Element} The countdown element.
275
+ @return {boolean} True if present, false if not. */
276
+ _hasElem: function(elem) {
277
+ return ($.inArray(elem, this._timerElems) > -1);
195
278
  },
196
279
 
197
- /* Remove a target from the list of active ones.
198
- @param target (element) the countdown target */
199
- _removeTarget: function(target) {
200
- this._timerTargets = $.map(this._timerTargets,
201
- function(value) { return (value == target ? null : value); }); // delete entry
280
+ /** Remove an element from the list of active ones.
281
+ @private
282
+ @param elem {Element} The countdown element. */
283
+ _removeElem: function(elem) {
284
+ this._timerElems = $.map(this._timerElems,
285
+ function(value) { return (value == elem ? null : value); }); // delete entry
202
286
  },
203
287
 
204
- /* Update each active timer target. */
205
- _updateTargets: function() {
206
- for (var i = this._timerTargets.length - 1; i >= 0; i--) {
207
- this._updateCountdown(this._timerTargets[i]);
288
+ /** Update each active timer element.
289
+ @private */
290
+ _updateElems: function() {
291
+ for (var i = this._timerElems.length - 1; i >= 0; i--) {
292
+ this._updateCountdown(this._timerElems[i]);
208
293
  }
209
294
  },
210
295
 
211
- /* Reconfigure the settings for a countdown div.
212
- @param target (element) the control to affect
213
- @param options (object) the new options for this instance or
214
- (string) an individual property name
215
- @param value (any) the individual property value (omit if options
216
- is an object or to retrieve the value of a setting)
217
- @return (any) if retrieving a value */
218
- _optionPlugin: function(target, options, value) {
219
- target = $(target);
220
- var inst = target.data(this.propertyName);
221
- if (!options || (typeof options == 'string' && value == null)) { // Get option
222
- var name = options;
223
- options = (inst || {}).options;
224
- return (options && name ? options[name] : options);
225
- }
226
-
227
- if (!target.hasClass(this.markerClassName)) {
228
- return;
229
- }
230
- options = options || {};
231
- if (typeof options == 'string') {
232
- var name = options;
233
- options = {};
234
- options[name] = value;
235
- }
296
+ _optionsChanged: function(elem, inst, options) {
236
297
  if (options.layout) {
237
298
  options.layout = options.layout.replace(/&lt;/g, '<').replace(/&gt;/g, '>');
238
299
  }
239
300
  this._resetExtraLabels(inst.options, options);
240
301
  var timezoneChanged = (inst.options.timezone != options.timezone);
241
302
  $.extend(inst.options, options);
242
- this._adjustSettings(target, inst,
303
+ this._adjustSettings(elem, inst,
243
304
  options.until != null || options.since != null || timezoneChanged);
244
305
  var now = new Date();
245
306
  if ((inst._since && inst._since < now) || (inst._until && inst._until > now)) {
246
- this._addTarget(target[0]);
307
+ this._addElem(elem[0]);
247
308
  }
248
- this._updateCountdown(target, inst);
309
+ this._updateCountdown(elem, inst);
249
310
  },
250
311
 
251
- /* Redisplay the countdown with an updated display.
252
- @param target (jQuery) the containing division
253
- @param inst (object) the current settings for this instance */
254
- _updateCountdown: function(target, inst) {
255
- var $target = $(target);
256
- inst = inst || $target.data(this.propertyName);
312
+ /** Redisplay the countdown with an updated display.
313
+ @private
314
+ @param elem {Element|jQuery} The containing division.
315
+ @param inst {object} The current settings for this instance. */
316
+ _updateCountdown: function(elem, inst) {
317
+ elem = elem.jquery ? elem : $(elem);
318
+ inst = inst || elem.data(this.name);
257
319
  if (!inst) {
258
320
  return;
259
321
  }
260
- $target.html(this._generateHTML(inst)).toggleClass(this._rtlClass, inst.options.isRTL);
322
+ elem.html(this._generateHTML(inst)).toggleClass(this._rtlClass, inst.options.isRTL);
261
323
  if ($.isFunction(inst.options.onTick)) {
262
324
  var periods = inst._hold != 'lap' ? inst._periods :
263
325
  this._calculatePeriods(inst, inst._show, inst.options.significant, new Date());
264
326
  if (inst.options.tickInterval == 1 ||
265
327
  this.periodsToSeconds(periods) % inst.options.tickInterval == 0) {
266
- inst.options.onTick.apply(target, [periods]);
328
+ inst.options.onTick.apply(elem[0], [periods]);
267
329
  }
268
330
  }
269
331
  var expired = inst._hold != 'pause' &&
@@ -271,15 +333,15 @@ $.extend(Countdown.prototype, {
271
333
  inst._now.getTime() >= inst._until.getTime());
272
334
  if (expired && !inst._expiring) {
273
335
  inst._expiring = true;
274
- if (this._hasTarget(target) || inst.options.alwaysExpire) {
275
- this._removeTarget(target);
336
+ if (this._hasElem(elem[0]) || inst.options.alwaysExpire) {
337
+ this._removeElem(elem[0]);
276
338
  if ($.isFunction(inst.options.onExpiry)) {
277
- inst.options.onExpiry.apply(target, []);
339
+ inst.options.onExpiry.apply(elem[0], []);
278
340
  }
279
341
  if (inst.options.expiryText) {
280
342
  var layout = inst.options.layout;
281
343
  inst.options.layout = inst.options.expiryText;
282
- this._updateCountdown(target, inst);
344
+ this._updateCountdown(elem[0], inst);
283
345
  inst.options.layout = layout;
284
346
  }
285
347
  if (inst.options.expiryUrl) {
@@ -289,14 +351,14 @@ $.extend(Countdown.prototype, {
289
351
  inst._expiring = false;
290
352
  }
291
353
  else if (inst._hold == 'pause') {
292
- this._removeTarget(target);
354
+ this._removeElem(elem[0]);
293
355
  }
294
- $target.data(this.propertyName, inst);
295
356
  },
296
357
 
297
- /* Reset any extra labelsn and compactLabelsn entries if changing labels.
298
- @param base (object) the options to be updated
299
- @param options (object) the new option values */
358
+ /** Reset any extra labelsn and compactLabelsn entries if changing labels.
359
+ @private
360
+ @param base {object} The options to be updated.
361
+ @param options {object} The new option values. */
300
362
  _resetExtraLabels: function(base, options) {
301
363
  var changingLabels = false;
302
364
  for (var n in options) {
@@ -314,11 +376,12 @@ $.extend(Countdown.prototype, {
314
376
  }
315
377
  },
316
378
 
317
- /* Calculate interal settings for an instance.
318
- @param target (element) the containing division
319
- @param inst (object) the current settings for this instance
320
- @param recalc (boolean) true if until or since are set */
321
- _adjustSettings: function(target, inst, recalc) {
379
+ /** Calculate internal settings for an instance.
380
+ @private
381
+ @param elem {jQuery} The containing division.
382
+ @param inst {object} The current settings for this instance.
383
+ @param recalc {boolean} True if until or since are set. */
384
+ _adjustSettings: function(elem, inst, recalc) {
322
385
  var now;
323
386
  var serverOffset = 0;
324
387
  var serverEntry = null;
@@ -334,7 +397,7 @@ $.extend(Countdown.prototype, {
334
397
  }
335
398
  else {
336
399
  var serverResult = ($.isFunction(inst.options.serverSync) ?
337
- inst.options.serverSync.apply(target, []) : null);
400
+ inst.options.serverSync.apply(elem[0], []) : null);
338
401
  now = new Date();
339
402
  serverOffset = (serverResult ? now.getTime() - serverResult.getTime() : 0);
340
403
  this._serverSyncs.push([inst.options.serverSync, serverOffset]);
@@ -357,42 +420,59 @@ $.extend(Countdown.prototype, {
357
420
  inst._show = this._determineShow(inst);
358
421
  },
359
422
 
360
- /* Remove the countdown widget from a div.
361
- @param target (element) the containing division */
362
- _destroyPlugin: function(target) {
363
- target = $(target);
364
- if (!target.hasClass(this.markerClassName)) {
365
- return;
366
- }
367
- this._removeTarget(target[0]);
368
- target.removeClass(this.markerClassName).empty().removeData(this.propertyName);
423
+ /** Remove the countdown widget from a div.
424
+ @param elem {jQuery} The containing division.
425
+ @param inst {object} The current instance object. */
426
+ _preDestroy: function(elem, inst) {
427
+ this._removeElem(elem[0]);
428
+ elem.empty();
369
429
  },
370
430
 
371
- /* Pause a countdown widget at the current time.
431
+ /** Pause a countdown widget at the current time.
372
432
  Stop it running but remember and display the current time.
373
- @param target (element) the containing division */
374
- _pausePlugin: function(target) {
375
- this._hold(target, 'pause');
433
+ @param elem {Element} The containing division.
434
+ @example $(selector).countdown('pause') */
435
+ pause: function(elem) {
436
+ this._hold(elem, 'pause');
376
437
  },
377
438
 
378
- /* Pause a countdown widget at the current time.
439
+ /** Pause a countdown widget at the current time.
379
440
  Stop the display but keep the countdown running.
380
- @param target (element) the containing division */
381
- _lapPlugin: function(target) {
382
- this._hold(target, 'lap');
383
- },
384
-
385
- /* Resume a paused countdown widget.
386
- @param target (element) the containing division */
387
- _resumePlugin: function(target) {
388
- this._hold(target, null);
389
- },
390
-
391
- /* Pause or resume a countdown widget.
392
- @param target (element) the containing division
393
- @param hold (string) the new hold setting */
394
- _hold: function(target, hold) {
395
- var inst = $.data(target, this.propertyName);
441
+ @param elem {Element} The containing division.
442
+ @example $(selector).countdown('lap') */
443
+ lap: function(elem) {
444
+ this._hold(elem, 'lap');
445
+ },
446
+
447
+ /** Resume a paused countdown widget.
448
+ @param elem {Element} The containing division.
449
+ @example $(selector).countdown('resume') */
450
+ resume: function(elem) {
451
+ this._hold(elem, null);
452
+ },
453
+
454
+ /** Toggle a paused countdown widget.
455
+ @param elem {Element} The containing division.
456
+ @example $(selector).countdown('toggle') */
457
+ toggle: function(elem) {
458
+ var inst = $.data(elem, this.name) || {};
459
+ this[!inst._hold ? 'pause' : 'resume'](elem);
460
+ },
461
+
462
+ /** Toggle a lapped countdown widget.
463
+ @param elem {Element} The containing division.
464
+ @example $(selector).countdown('toggleLap') */
465
+ toggleLap: function(elem) {
466
+ var inst = $.data(elem, this.name) || {};
467
+ this[!inst._hold ? 'lap' : 'resume'](elem);
468
+ },
469
+
470
+ /** Pause or resume a countdown widget.
471
+ @private
472
+ @param elem {Element} The containing division.
473
+ @param hold {string} The new hold setting. */
474
+ _hold: function(elem, hold) {
475
+ var inst = $.data(elem, this.name);
396
476
  if (inst) {
397
477
  if (inst._hold == 'pause' && !hold) {
398
478
  inst._periods = inst._savePeriods;
@@ -402,30 +482,32 @@ $.extend(Countdown.prototype, {
402
482
  sign + inst._periods[1] + 'o' + sign + inst._periods[2] + 'w' +
403
483
  sign + inst._periods[3] + 'd' + sign + inst._periods[4] + 'h' +
404
484
  sign + inst._periods[5] + 'm' + sign + inst._periods[6] + 's');
405
- this._addTarget(target);
485
+ this._addElem(elem);
406
486
  }
407
487
  inst._hold = hold;
408
488
  inst._savePeriods = (hold == 'pause' ? inst._periods : null);
409
- $.data(target, this.propertyName, inst);
410
- this._updateCountdown(target, inst);
489
+ $.data(elem, this.name, inst);
490
+ this._updateCountdown(elem, inst);
411
491
  }
412
492
  },
413
493
 
414
- /* Return the current time periods.
415
- @param target (element) the containing division
416
- @return (number[7]) the current periods for the countdown */
417
- _getTimesPlugin: function(target) {
418
- var inst = $.data(target, this.propertyName);
494
+ /** Return the current time periods.
495
+ @param elem {Element} The containing division.
496
+ @return {number[]} The current periods for the countdown.
497
+ @example var periods = $(selector).countdown('getTimes') */
498
+ getTimes: function(elem) {
499
+ var inst = $.data(elem, this.name);
419
500
  return (!inst ? null : (inst._hold == 'pause' ? inst._savePeriods : (!inst._hold ? inst._periods :
420
501
  this._calculatePeriods(inst, inst._show, inst.options.significant, new Date()))));
421
502
  },
422
503
 
423
- /* A time may be specified as an exact value or a relative one.
424
- @param setting (string or number or Date) - the date/time value
425
- as a relative or absolute value
426
- @param defaultTime (Date) the date/time to use if no other is supplied
427
- @return (Date) the corresponding date/time */
504
+ /** A time may be specified as an exact value or a relative one.
505
+ @private
506
+ @param setting {string|number|Date} The date/time value as a relative or absolute value.
507
+ @param defaultTime {Date} The date/time to use if no other is supplied.
508
+ @return {Date} The corresponding date/time. */
428
509
  _determineTime: function(setting, defaultTime) {
510
+ var self = this;
429
511
  var offsetNumeric = function(offset) { // e.g. +300, -2
430
512
  var time = new Date();
431
513
  time.setTime(time.getTime() + offset * 1000);
@@ -451,11 +533,11 @@ $.extend(Countdown.prototype, {
451
533
  case 'w': day += parseInt(matches[1], 10) * 7; break;
452
534
  case 'o':
453
535
  month += parseInt(matches[1], 10);
454
- day = Math.min(day, plugin._getDaysInMonth(year, month));
536
+ day = Math.min(day, self._getDaysInMonth(year, month));
455
537
  break;
456
538
  case 'y':
457
539
  year += parseInt(matches[1], 10);
458
- day = Math.min(day, plugin._getDaysInMonth(year, month));
540
+ day = Math.min(day, self._getDaysInMonth(year, month));
459
541
  break;
460
542
  }
461
543
  matches = pattern.exec(offset);
@@ -469,24 +551,28 @@ $.extend(Countdown.prototype, {
469
551
  return time;
470
552
  },
471
553
 
472
- /* Determine the number of days in a month.
473
- @param year (number) the year
474
- @param month (number) the month
475
- @return (number) the days in that month */
554
+ /** Determine the number of days in a month.
555
+ @private
556
+ @param year {number} The year.
557
+ @param month {number} The month.
558
+ @return {number} The days in that month. */
476
559
  _getDaysInMonth: function(year, month) {
477
560
  return 32 - new Date(year, month, 32).getDate();
478
561
  },
479
562
 
480
- /* Determine which set of labels should be used for an amount.
481
- @param num (number) the amount to be displayed
482
- @return (number) the set of labels to be used for this amount */
563
+ /** Default implementation to determine which set of labels should be used for an amount.
564
+ Use the <code>labels</code> attribute with the same numeric suffix (if it exists).
565
+ @private
566
+ @param num {number} The amount to be displayed.
567
+ @return {number} The set of labels to be used for this amount. */
483
568
  _normalLabels: function(num) {
484
569
  return num;
485
570
  },
486
571
 
487
- /* Generate the HTML to display the countdown widget.
488
- @param inst (object) the current settings for this instance
489
- @return (string) the new HTML for the countdown display */
572
+ /** Generate the HTML to display the countdown widget.
573
+ @private
574
+ @param inst {object} The current settings for this instance.
575
+ @return {string} The new HTML for the countdown display. */
490
576
  _generateHTML: function(inst) {
491
577
  var self = this;
492
578
  // Determine what to show
@@ -522,14 +608,16 @@ $.extend(Countdown.prototype, {
522
608
  return (show[period] ? self._translateDigits(inst, inst._periods[period]) +
523
609
  (labelsNum ? labelsNum[period] : labels[period]) + ' ' : '');
524
610
  };
611
+ var minDigits = (inst.options.padZeroes ? 2 : 1);
525
612
  var showFull = function(period) {
526
613
  var labelsNum = inst.options['labels' + whichLabels(inst._periods[period])];
527
614
  return ((!inst.options.significant && show[period]) ||
528
615
  (inst.options.significant && showSignificant[period]) ?
529
- '<span class="' + plugin._sectionClass + '">' +
530
- '<span class="' + plugin._amountClass + '">' +
531
- self._translateDigits(inst, inst._periods[period]) + '</span><br/>' +
532
- (labelsNum ? labelsNum[period] : labels[period]) + '</span>' : '');
616
+ '<span class="' + self._sectionClass + '">' +
617
+ '<span class="' + self._amountClass + '">' +
618
+ self._minDigits(inst, inst._periods[period], minDigits) + '</span>' +
619
+ '<span class="' + self._periodClass + '">' +
620
+ (labelsNum ? labelsNum[period] : labels[period]) + '</span></span>' : '');
533
621
  };
534
622
  return (inst.options.layout ? this._buildLayout(inst, show, inst.options.layout,
535
623
  inst.options.compact, inst.options.significant, showSignificant) :
@@ -551,14 +639,15 @@ $.extend(Countdown.prototype, {
551
639
  inst.options.description + '</span>' : '')));
552
640
  },
553
641
 
554
- /* Construct a custom layout.
555
- @param inst (object) the current settings for this instance
556
- @param show (string[7]) flags indicating which periods are requested
557
- @param layout (string) the customised layout
558
- @param compact (boolean) true if using compact labels
559
- @param significant (number) the number of periods with values to show, zero for all
560
- @param showSignificant (boolean[7]) other periods to show for significance
561
- @return (string) the custom HTML */
642
+ /** Construct a custom layout.
643
+ @private
644
+ @param inst {object} The current settings for this instance.
645
+ @param show {boolean[]} Flags indicating which periods are requested.
646
+ @param layout {string} The customised layout.
647
+ @param compact {boolean} True if using compact labels.
648
+ @param significant {number} The number of periods with values to show, zero for all.
649
+ @param showSignificant {boolean[]} Other periods to show for significance.
650
+ @return {string} The custom HTML. */
562
651
  _buildLayout: function(inst, show, layout, compact, significant, showSignificant) {
563
652
  var labels = inst.options[compact ? 'compactLabels' : 'labels'];
564
653
  var whichLabels = inst.options.whichLabels || this._normalLabels;
@@ -621,11 +710,12 @@ $.extend(Countdown.prototype, {
621
710
  return html;
622
711
  },
623
712
 
624
- /* Ensure a numeric value has at least n digits for display.
625
- @param inst (object) the current settings for this instance
626
- @param value (number) the value to display
627
- @param len (number) the minimum length
628
- @return (string) the display text */
713
+ /** Ensure a numeric value has at least n digits for display.
714
+ @private
715
+ @param inst {object} The current settings for this instance.
716
+ @param value {number} The value to display.
717
+ @param len {number} The minimum length.
718
+ @return {string} The display text. */
629
719
  _minDigits: function(inst, value, len) {
630
720
  value = '' + value;
631
721
  if (value.length >= len) {
@@ -635,20 +725,22 @@ $.extend(Countdown.prototype, {
635
725
  return this._translateDigits(inst, value.substr(value.length - len));
636
726
  },
637
727
 
638
- /* Translate digits into other representations.
639
- @param inst (object) the current settings for this instance
640
- @param value (string) the text to translate
641
- @return (string) the translated text */
728
+ /** Translate digits into other representations.
729
+ @private
730
+ @param inst {object} The current settings for this instance.
731
+ @param value {string} The text to translate.
732
+ @return {string} The translated text. */
642
733
  _translateDigits: function(inst, value) {
643
734
  return ('' + value).replace(/[0-9]/g, function(digit) {
644
735
  return inst.options.digits[digit];
645
736
  });
646
737
  },
647
738
 
648
- /* Translate the format into flags for each period.
649
- @param inst (object) the current settings for this instance
650
- @return (string[7]) flags indicating which periods are requested (?) or
651
- required (!) by year, month, week, day, hour, minute, second */
739
+ /** Translate the format into flags for each period.
740
+ @private
741
+ @param inst {object} The current settings for this instance.
742
+ @return {string[]} Flags indicating which periods are requested (?) or
743
+ required (!) by year, month, week, day, hour, minute, second. */
652
744
  _determineShow: function(inst) {
653
745
  var format = inst.options.format;
654
746
  var show = [];
@@ -662,13 +754,14 @@ $.extend(Countdown.prototype, {
662
754
  return show;
663
755
  },
664
756
 
665
- /* Calculate the requested periods between now and the target time.
666
- @param inst (object) the current settings for this instance
667
- @param show (string[7]) flags indicating which periods are requested/required
668
- @param significant (number) the number of periods with values to show, zero for all
669
- @param now (Date) the current date and time
670
- @return (number[7]) the current time periods (always positive)
671
- by year, month, week, day, hour, minute, second */
757
+ /** Calculate the requested periods between now and the target time.
758
+ @private
759
+ @param inst {object} The current settings for this instance.
760
+ @param show {string[]} Flags indicating which periods are requested/required.
761
+ @param significant {number} The number of periods with values to show, zero for all.
762
+ @param now {Date} The current date and time.
763
+ @return {number[]} The current time periods (always positive)
764
+ by year, month, week, day, hour, minute, second. */
672
765
  _calculatePeriods: function(inst, show, significant, now) {
673
766
  // Find endpoints
674
767
  inst._now = now;
@@ -692,8 +785,8 @@ $.extend(Countdown.prototype, {
692
785
  var periods = [0, 0, 0, 0, 0, 0, 0];
693
786
  if (show[Y] || show[O]) {
694
787
  // Treat end of months as the same
695
- var lastNow = plugin._getDaysInMonth(now.getFullYear(), now.getMonth());
696
- var lastUntil = plugin._getDaysInMonth(until.getFullYear(), until.getMonth());
788
+ var lastNow = this._getDaysInMonth(now.getFullYear(), now.getMonth());
789
+ var lastUntil = this._getDaysInMonth(until.getFullYear(), until.getMonth());
697
790
  var sameDay = (until.getDate() == now.getDate() ||
698
791
  (until.getDate() >= Math.min(lastNow, lastUntil) &&
699
792
  now.getDate() >= Math.min(lastNow, lastUntil)));
@@ -709,7 +802,7 @@ $.extend(Countdown.prototype, {
709
802
  // Adjust for months difference and end of month if necessary
710
803
  now = new Date(now.getTime());
711
804
  var wasLastDay = (now.getDate() == lastNow);
712
- var lastDay = plugin._getDaysInMonth(now.getFullYear() + periods[Y],
805
+ var lastDay = this._getDaysInMonth(now.getFullYear() + periods[Y],
713
806
  now.getMonth() + periods[O]);
714
807
  if (now.getDate() > lastDay) {
715
808
  now.setDate(lastDay);
@@ -762,49 +855,6 @@ $.extend(Countdown.prototype, {
762
855
  }
763
856
  return periods;
764
857
  }
765
- });
766
-
767
- // The list of commands that return values and don't permit chaining
768
- var getters = ['getTimes'];
769
-
770
- /* Determine whether a command is a getter and doesn't permit chaining.
771
- @param command (string, optional) the command to run
772
- @param otherArgs ([], optional) any other arguments for the command
773
- @return true if the command is a getter, false if not */
774
- function isNotChained(command, otherArgs) {
775
- if (command == 'option' && (otherArgs.length == 0 ||
776
- (otherArgs.length == 1 && typeof otherArgs[0] == 'string'))) {
777
- return true;
778
- }
779
- return $.inArray(command, getters) > -1;
780
- }
781
-
782
- /* Process the countdown functionality for a jQuery selection.
783
- @param options (object) the new settings to use for these instances (optional) or
784
- (string) the command to run (optional)
785
- @return (jQuery) for chaining further calls or
786
- (any) getter value */
787
- $.fn.countdown = function(options) {
788
- var otherArgs = Array.prototype.slice.call(arguments, 1);
789
- if (isNotChained(options, otherArgs)) {
790
- return plugin['_' + options + 'Plugin'].
791
- apply(plugin, [this[0]].concat(otherArgs));
792
- }
793
- return this.each(function() {
794
- if (typeof options == 'string') {
795
- if (!plugin['_' + options + 'Plugin']) {
796
- throw 'Unknown command: ' + options;
797
- }
798
- plugin['_' + options + 'Plugin'].
799
- apply(plugin, [this].concat(otherArgs));
800
- }
801
- else {
802
- plugin._attachPlugin(this, options || {});
803
- }
804
858
  });
805
- };
806
-
807
- /* Initialise the countdown functionality. */
808
- var plugin = $.countdown = new Countdown(); // Singleton instance
809
859
 
810
860
  })(jQuery);