Some minor funding changes.
[wolnelektury.git] / apps / pdcounter / static / pdcounter / pdcounter.js
index 0352076..a1ff537 100755 (executable)
@@ -1,8 +1,7 @@
 (function($) {
     $(function() {
 
-
-        $('#countdown').each(function() {
+        $('.countdown').each(function() {
             var $this = $(this);
 
             var serverTime = function() {
                 $.countdown.setDefaults($.countdown.regional['']);
             }
 
-            var d = new Date($this.attr('data-year'), 0, 1);
-            function re() {location.reload()};
-            $this.countdown({until: d, format: 'ydHMS', serverSync: serverTime,
-                onExpiry: re, alwaysExpire: true});
-
+            var options = {
+                until: new Date($this.attr('data-until')),
+                format: 'ydHMS',
+                serverSync: serverTime,
+                onExpiry: function(){location.reload()}, // TODO: no reload
+            };
+            if ($this.hasClass('inline')) {
+                options.layout = '{d<}{dn} {dl} {d>}{hnn}{sep}{mnn}{sep}{snn}';
+            }
+            
+            $this.countdown(options);
         });
 
 
     });
-})(jQuery);
\ No newline at end of file
+})(jQuery);