File "jquery.downCount.js"
Full Path: /home/digimqhe/flashdigi.uk/assets/js/extra/jquery.downCount.js
File size: 1.12 KB
MIME-type: text/plain
Charset: utf-8
/** downCount */
(function(a){a.fn.downCount=function(b,c){var d=a.extend({date:null,offset:null,text_day:"days",text_hour:"hours",text_minute:"minutes",text_second:"seconds"},b);d.date||a.error("Date is not defined."),Date.parse(d.date)||a.error("Incorrect date format, it should look like this, 12/24/2012 12:00:00.");var e=this,f=function(){var a=new Date,b=a.getTime()+6e4*a.getTimezoneOffset(),c=new Date(b+36e5*d.offset);return c};var g=setInterval(function(){var a=new Date(d.date),b=f(),h=a-b;if(0>h)return clearInterval(g),void(c&&"function"==typeof c&&c());var i=Math.floor(h/86400000),j=Math.floor(h%86400000/3600000),k=Math.floor(h%3600000/60000),l=Math.floor(h%60000/1000);i=2<=(i+"").length?i:"0"+i,j=2<=(j+"").length?j:"0"+j,k=2<=(k+"").length?k:"0"+k,l=2<=(l+"").length?l:"0"+l;var m=1===i?"day":d.text_day,n=1===j?"hour":d.text_hour,o=1===k?"minute":d.text_minute,p=1===l?"second":d.text_second;e.find(".days").text(i),e.find(".hours").text(j),e.find(".minutes").text(k),e.find(".seconds").text(l),e.find(".days_ref").text(m),e.find(".hours_ref").text(n),e.find(".minutes_ref").text(o),e.find(".seconds_ref").text(p)},1e3)}})(jQuery);