/*! * Retro countdown renderer for epiclock * * Copyright (c) Eric Garside * Dual licensed under: * MIT: http://www.opensource.org/licenses/mit-license.php * GPLv3: http://www.opensource.org/licenses/gpl-3.0.html */ "use strict";(function($){var innerTemplate='';function animate() {var clock=this;setTimeout(function() {$('.a1',clock.container).removeClass('a1').addClass('a2');setTimeout(function() {$('.a2',clock.container).removeClass('a2').addClass('s');},150);},150);} $.epiclock.addRenderer('retro-countdown',function(element,value) {var digits=value.substring(1)==='m'?[value]:value.split('').reverse(),last=element.data('epiclock-last'),compare=last?last.split('').reverse():[],image=$.makeArray($('.epiclock-img',element)).reverse();$.each(digits,function(index,digit) {if(digit===compare[index]) {return;} $('.epiclock-animation',$(image[index]||$(innerTemplate).prependTo(element)).removeClass('d'+compare[index]).addClass('d'+digit)).removeClass('s').addClass('a1');});},function() {this.bind('rendered',animate);});}(jQuery));