flipclock.js 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782
  1. /*
  2. Base.js, version 1.1a
  3. Copyright 2006-2010, Dean Edwards
  4. License: http://www.opensource.org/licenses/mit-license.php
  5. */
  6. var Base = function() {
  7. // dummy
  8. };
  9. Base.extend = function(_instance, _static) { // subclass
  10. "use strict";
  11. var extend = Base.prototype.extend;
  12. // build the prototype
  13. Base._prototyping = true;
  14. var proto = new this();
  15. extend.call(proto, _instance);
  16. proto.base = function() {
  17. // call this method from any other method to invoke that method's ancestor
  18. };
  19. delete Base._prototyping;
  20. // create the wrapper for the constructor function
  21. //var constructor = proto.constructor.valueOf(); //-dean
  22. var constructor = proto.constructor;
  23. var klass = proto.constructor = function() {
  24. if (!Base._prototyping) {
  25. if (this._constructing || this.constructor == klass) { // instantiation
  26. this._constructing = true;
  27. constructor.apply(this, arguments);
  28. delete this._constructing;
  29. } else if (arguments[0] !== null) { // casting
  30. return (arguments[0].extend || extend).call(arguments[0], proto);
  31. }
  32. }
  33. };
  34. // build the class interface
  35. klass.ancestor = this;
  36. klass.extend = this.extend;
  37. klass.forEach = this.forEach;
  38. klass.implement = this.implement;
  39. klass.prototype = proto;
  40. klass.toString = this.toString;
  41. klass.valueOf = function(type) {
  42. //return (type == "object") ? klass : constructor; //-dean
  43. return (type == "object") ? klass : constructor.valueOf();
  44. };
  45. extend.call(klass, _static);
  46. // class initialisation
  47. if (typeof klass.init == "function") klass.init();
  48. return klass;
  49. };
  50. Base.prototype = {
  51. extend: function(source, value) {
  52. if (arguments.length > 1) { // extending with a name/value pair
  53. var ancestor = this[source];
  54. if (ancestor && (typeof value == "function") && // overriding a method?
  55. // the valueOf() comparison is to avoid circular references
  56. (!ancestor.valueOf || ancestor.valueOf() != value.valueOf()) &&
  57. /\bbase\b/.test(value)) {
  58. // get the underlying method
  59. var method = value.valueOf();
  60. // override
  61. value = function() {
  62. var previous = this.base || Base.prototype.base;
  63. this.base = ancestor;
  64. var returnValue = method.apply(this, arguments);
  65. this.base = previous;
  66. return returnValue;
  67. };
  68. // point to the underlying method
  69. value.valueOf = function(type) {
  70. return (type == "object") ? value : method;
  71. };
  72. value.toString = Base.toString;
  73. }
  74. this[source] = value;
  75. } else if (source) { // extending with an object literal
  76. var extend = Base.prototype.extend;
  77. // if this object has a customised extend method then use it
  78. if (!Base._prototyping && typeof this != "function") {
  79. extend = this.extend || extend;
  80. }
  81. var proto = {toSource: null};
  82. // do the "toString" and other methods manually
  83. var hidden = ["constructor", "toString", "valueOf"];
  84. // if we are prototyping then include the constructor
  85. var i = Base._prototyping ? 0 : 1;
  86. while (key = hidden[i++]) {
  87. if (source[key] != proto[key]) {
  88. extend.call(this, key, source[key]);
  89. }
  90. }
  91. // copy each of the source object's properties to this object
  92. for (var key in source) {
  93. if (!proto[key]) extend.call(this, key, source[key]);
  94. }
  95. }
  96. return this;
  97. }
  98. };
  99. // initialise
  100. Base = Base.extend({
  101. constructor: function() {
  102. this.extend(arguments[0]);
  103. }
  104. }, {
  105. ancestor: Object,
  106. version: "1.1",
  107. forEach: function(object, block, context) {
  108. for (var key in object) {
  109. if (this.prototype[key] === undefined) {
  110. block.call(context, object[key], key, object);
  111. }
  112. }
  113. },
  114. implement: function() {
  115. for (var i = 0; i < arguments.length; i++) {
  116. if (typeof arguments[i] == "function") {
  117. // if it's a function, call it
  118. arguments[i](this.prototype);
  119. } else {
  120. // add the interface using the extend method
  121. this.prototype.extend(arguments[i]);
  122. }
  123. }
  124. return this;
  125. },
  126. toString: function() {
  127. return String(this.valueOf());
  128. }
  129. });
  130. /*jshint smarttabs:true */
  131. var FlipClock;
  132. /**
  133. * FlipClock.js
  134. *
  135. * @author Justin Kimbrell
  136. * @copyright 2013 - Objective HTML, LLC
  137. * @licesnse http://www.opensource.org/licenses/mit-license.php
  138. */
  139. (function($) {
  140. "use strict";
  141. /**
  142. * FlipFlock Helper
  143. *
  144. * @param object A jQuery object or CSS select
  145. * @param int An integer used to start the clock (no. seconds)
  146. * @param object An object of properties to override the default
  147. */
  148. FlipClock = function(obj, digit, options) {
  149. if(digit instanceof Object && digit instanceof Date === false) {
  150. options = digit;
  151. digit = 0;
  152. }
  153. return new FlipClock.Factory(obj, digit, options);
  154. };
  155. /**
  156. * The global FlipClock.Lang object
  157. */
  158. FlipClock.Lang = {};
  159. /**
  160. * The Base FlipClock class is used to extend all other FlipFlock
  161. * classes. It handles the callbacks and the basic setters/getters
  162. *
  163. * @param object An object of the default properties
  164. * @param object An object of properties to override the default
  165. */
  166. FlipClock.Base = Base.extend({
  167. /**
  168. * Build Date
  169. */
  170. buildDate: '2014-12-12',
  171. /**
  172. * Version
  173. */
  174. version: '0.7.7',
  175. /**
  176. * Sets the default options
  177. *
  178. * @param object The default options
  179. * @param object The override options
  180. */
  181. constructor: function(_default, options) {
  182. if(typeof _default !== "object") {
  183. _default = {};
  184. }
  185. if(typeof options !== "object") {
  186. options = {};
  187. }
  188. this.setOptions($.extend(true, {}, _default, options));
  189. },
  190. /**
  191. * Delegates the callback to the defined method
  192. *
  193. * @param object The default options
  194. * @param object The override options
  195. */
  196. callback: function(method) {
  197. if(typeof method === "function") {
  198. var args = [];
  199. for(var x = 1; x <= arguments.length; x++) {
  200. if(arguments[x]) {
  201. args.push(arguments[x]);
  202. }
  203. }
  204. method.apply(this, args);
  205. }
  206. },
  207. /**
  208. * Log a string into the console if it exists
  209. *
  210. * @param string The name of the option
  211. * @return mixed
  212. */
  213. log: function(str) {
  214. if(window.console && console.log) {
  215. console.log(str);
  216. }
  217. },
  218. /**
  219. * Get an single option value. Returns false if option does not exist
  220. *
  221. * @param string The name of the option
  222. * @return mixed
  223. */
  224. getOption: function(index) {
  225. if(this[index]) {
  226. return this[index];
  227. }
  228. return false;
  229. },
  230. /**
  231. * Get all options
  232. *
  233. * @return bool
  234. */
  235. getOptions: function() {
  236. return this;
  237. },
  238. /**
  239. * Set a single option value
  240. *
  241. * @param string The name of the option
  242. * @param mixed The value of the option
  243. */
  244. setOption: function(index, value) {
  245. this[index] = value;
  246. },
  247. /**
  248. * Set a multiple options by passing a JSON object
  249. *
  250. * @param object The object with the options
  251. * @param mixed The value of the option
  252. */
  253. setOptions: function(options) {
  254. for(var key in options) {
  255. if(typeof options[key] !== "undefined") {
  256. this.setOption(key, options[key]);
  257. }
  258. }
  259. }
  260. });
  261. }(jQuery));
  262. /*jshint smarttabs:true */
  263. /**
  264. * FlipClock.js
  265. *
  266. * @author Justin Kimbrell
  267. * @copyright 2013 - Objective HTML, LLC
  268. * @licesnse http://www.opensource.org/licenses/mit-license.php
  269. */
  270. (function($) {
  271. "use strict";
  272. /**
  273. * The FlipClock Face class is the base class in which to extend
  274. * all other FlockClock.Face classes.
  275. *
  276. * @param object The parent FlipClock.Factory object
  277. * @param object An object of properties to override the default
  278. */
  279. FlipClock.Face = FlipClock.Base.extend({
  280. /**
  281. * Sets whether or not the clock should start upon instantiation
  282. */
  283. autoStart: true,
  284. /**
  285. * An array of jQuery objects used for the dividers (the colons)
  286. */
  287. dividers: [],
  288. /**
  289. * An array of FlipClock.List objects
  290. */
  291. factory: false,
  292. /**
  293. * An array of FlipClock.List objects
  294. */
  295. lists: [],
  296. /**
  297. * Constructor
  298. *
  299. * @param object The parent FlipClock.Factory object
  300. * @param object An object of properties to override the default
  301. */
  302. constructor: function(factory, options) {
  303. this.dividers = [];
  304. this.lists = [];
  305. this.base(options);
  306. this.factory = factory;
  307. },
  308. /**
  309. * Build the clock face
  310. */
  311. build: function() {
  312. if(this.autoStart) {
  313. this.start();
  314. }
  315. },
  316. /**
  317. * Creates a jQuery object used for the digit divider
  318. *
  319. * @param mixed The divider label text
  320. * @param mixed Set true to exclude the dots in the divider.
  321. * If not set, is false.
  322. */
  323. createDivider: function(label, css, excludeDots) {
  324. if(typeof css == "boolean" || !css) {
  325. excludeDots = css;
  326. css = label;
  327. }
  328. var dots = [
  329. '<span class="'+this.factory.classes.dot+' top"></span>',
  330. '<span class="'+this.factory.classes.dot+' bottom"></span>'
  331. ].join('');
  332. if(excludeDots) {
  333. dots = '';
  334. }
  335. label = this.factory.localize(label);
  336. var html = [
  337. '<span class="'+this.factory.classes.divider+' '+(css ? css : '').toLowerCase()+'">',
  338. '<span class="'+this.factory.classes.label+'">'+(label ? label : '')+'</span>',
  339. dots,
  340. '</span>'
  341. ];
  342. var $html = $(html.join(''));
  343. this.dividers.push($html);
  344. return $html;
  345. },
  346. /**
  347. * Creates a FlipClock.List object and appends it to the DOM
  348. *
  349. * @param mixed The digit to select in the list
  350. * @param object An object to override the default properties
  351. */
  352. createList: function(digit, options) {
  353. if(typeof digit === "object") {
  354. options = digit;
  355. digit = 0;
  356. }
  357. var obj = new FlipClock.List(this.factory, digit, options);
  358. this.lists.push(obj);
  359. return obj;
  360. },
  361. /**
  362. * Triggers when the clock is reset
  363. */
  364. reset: function() {
  365. this.factory.time = new FlipClock.Time(
  366. this.factory,
  367. this.factory.original ? Math.round(this.factory.original) : 0,
  368. {
  369. minimumDigits: this.factory.minimumDigits
  370. }
  371. );
  372. this.flip(this.factory.original, false);
  373. },
  374. /**
  375. * Append a newly created list to the clock
  376. */
  377. appendDigitToClock: function(obj) {
  378. obj.$el.append(false);
  379. },
  380. /**
  381. * Add a digit to the clock face
  382. */
  383. addDigit: function(digit) {
  384. var obj = this.createList(digit, {
  385. classes: {
  386. active: this.factory.classes.active,
  387. before: this.factory.classes.before,
  388. flip: this.factory.classes.flip
  389. }
  390. });
  391. this.appendDigitToClock(obj);
  392. },
  393. /**
  394. * Triggers when the clock is started
  395. */
  396. start: function() {},
  397. /**
  398. * Triggers when the time on the clock stops
  399. */
  400. stop: function() {},
  401. /**
  402. * Auto increments/decrements the value of the clock face
  403. */
  404. autoIncrement: function() {
  405. if(!this.factory.countdown) {
  406. this.increment();
  407. }
  408. else {
  409. this.decrement();
  410. }
  411. },
  412. /**
  413. * Increments the value of the clock face
  414. */
  415. increment: function() {
  416. this.factory.time.addSecond();
  417. },
  418. /**
  419. * Decrements the value of the clock face
  420. */
  421. decrement: function() {
  422. if(this.factory.time.getTimeSeconds() == 0) {
  423. this.factory.stop()
  424. }
  425. else {
  426. this.factory.time.subSecond();
  427. }
  428. },
  429. /**
  430. * Triggers when the numbers on the clock flip
  431. */
  432. flip: function(time, doNotAddPlayClass) {
  433. var t = this;
  434. $.each(time, function(i, digit) {
  435. var list = t.lists[i];
  436. if(list) {
  437. if(!doNotAddPlayClass && digit != list.digit) {
  438. list.play();
  439. }
  440. list.select(digit);
  441. }
  442. else {
  443. t.addDigit(digit);
  444. }
  445. });
  446. }
  447. });
  448. }(jQuery));
  449. /*jshint smarttabs:true */
  450. /**
  451. * FlipClock.js
  452. *
  453. * @author Justin Kimbrell
  454. * @copyright 2013 - Objective HTML, LLC
  455. * @licesnse http://www.opensource.org/licenses/mit-license.php
  456. */
  457. (function($) {
  458. "use strict";
  459. /**
  460. * The FlipClock Factory class is used to build the clock and manage
  461. * all the public methods.
  462. *
  463. * @param object A jQuery object or CSS selector used to fetch
  464. the wrapping DOM nodes
  465. * @param mixed This is the digit used to set the clock. If an
  466. object is passed, 0 will be used.
  467. * @param object An object of properties to override the default
  468. */
  469. FlipClock.Factory = FlipClock.Base.extend({
  470. /**
  471. * The clock's animation rate.
  472. *
  473. * Note, currently this property doesn't do anything.
  474. * This property is here to be used in the future to
  475. * programmaticaly set the clock's animation speed
  476. */
  477. animationRate: 1000,
  478. /**
  479. * Auto start the clock on page load (True|False)
  480. */
  481. autoStart: true,
  482. /**
  483. * The callback methods
  484. */
  485. callbacks: {
  486. destroy: false,
  487. create: false,
  488. init: false,
  489. interval: false,
  490. start: false,
  491. stop: false,
  492. reset: false
  493. },
  494. /**
  495. * The CSS classes
  496. */
  497. classes: {
  498. active: 'flip-clock-active',
  499. before: 'flip-clock-before',
  500. divider: 'flip-clock-divider',
  501. dot: 'flip-clock-dot',
  502. label: 'flip-clock-label',
  503. flip: 'flip',
  504. play: 'play',
  505. wrapper: 'flip-clock-wrapper'
  506. },
  507. /**
  508. * The name of the clock face class in use
  509. */
  510. clockFace: 'HourlyCounter',
  511. /**
  512. * The name of the clock face class in use
  513. */
  514. countdown: false,
  515. /**
  516. * The name of the default clock face class to use if the defined
  517. * clockFace variable is not a valid FlipClock.Face object
  518. */
  519. defaultClockFace: 'HourlyCounter',
  520. /**
  521. * The default language
  522. */
  523. defaultLanguage: 'english',
  524. /**
  525. * The jQuery object
  526. */
  527. $el: false,
  528. /**
  529. * The FlipClock.Face object
  530. */
  531. face: true,
  532. /**
  533. * The language object after it has been loaded
  534. */
  535. lang: false,
  536. /**
  537. * The language being used to display labels (string)
  538. */
  539. language: 'english',
  540. /**
  541. * The minimum digits the clock must have
  542. */
  543. minimumDigits: 0,
  544. /**
  545. * The original starting value of the clock. Used for the reset method.
  546. */
  547. original: false,
  548. /**
  549. * Is the clock running? (True|False)
  550. */
  551. running: false,
  552. /**
  553. * The FlipClock.Time object
  554. */
  555. time: false,
  556. /**
  557. * The FlipClock.Timer object
  558. */
  559. timer: false,
  560. /**
  561. * The jQuery object (depcrecated)
  562. */
  563. $wrapper: false,
  564. /**
  565. * Constructor
  566. *
  567. * @param object The wrapping jQuery object
  568. * @param object Number of seconds used to start the clock
  569. * @param object An object override options
  570. */
  571. constructor: function(obj, digit, options) {
  572. if(!options) {
  573. options = {};
  574. }
  575. this.lists = [];
  576. this.running = false;
  577. this.base(options);
  578. this.$el = $(obj).addClass(this.classes.wrapper);
  579. // Depcrated support of the $wrapper property.
  580. this.$wrapper = this.$el;
  581. this.original = (digit instanceof Date) ? digit : (digit ? Math.round(digit) : 0);
  582. this.time = new FlipClock.Time(this, this.original, {
  583. minimumDigits: this.minimumDigits,
  584. animationRate: this.animationRate
  585. });
  586. this.timer = new FlipClock.Timer(this, options);
  587. this.loadLanguage(this.language);
  588. this.loadClockFace(this.clockFace, options);
  589. if(this.autoStart) {
  590. this.start();
  591. }
  592. },
  593. /**
  594. * Load the FlipClock.Face object
  595. *
  596. * @param object The name of the FlickClock.Face class
  597. * @param object An object override options
  598. */
  599. loadClockFace: function(name, options) {
  600. var face, suffix = 'Face', hasStopped = false;
  601. name = name.ucfirst()+suffix;
  602. if(this.face.stop) {
  603. this.stop();
  604. hasStopped = true;
  605. }
  606. this.$el.html('');
  607. this.time.minimumDigits = this.minimumDigits;
  608. if(FlipClock[name]) {
  609. face = new FlipClock[name](this, options);
  610. }
  611. else {
  612. face = new FlipClock[this.defaultClockFace+suffix](this, options);
  613. }
  614. face.build();
  615. this.face = face
  616. if(hasStopped) {
  617. this.start();
  618. }
  619. return this.face;
  620. },
  621. /**
  622. * Load the FlipClock.Lang object
  623. *
  624. * @param object The name of the language to load
  625. */
  626. loadLanguage: function(name) {
  627. var lang;
  628. if(FlipClock.Lang[name.ucfirst()]) {
  629. lang = FlipClock.Lang[name.ucfirst()];
  630. }
  631. else if(FlipClock.Lang[name]) {
  632. lang = FlipClock.Lang[name];
  633. }
  634. else {
  635. lang = FlipClock.Lang[this.defaultLanguage];
  636. }
  637. return this.lang = lang;
  638. },
  639. /**
  640. * Localize strings into various languages
  641. *
  642. * @param string The index of the localized string
  643. * @param object Optionally pass a lang object
  644. */
  645. localize: function(index, obj) {
  646. var lang = this.lang;
  647. if(!index) {
  648. return null;
  649. }
  650. var lindex = index.toLowerCase();
  651. if(typeof obj == "object") {
  652. lang = obj;
  653. }
  654. if(lang && lang[lindex]) {
  655. return lang[lindex];
  656. }
  657. return index;
  658. },
  659. /**
  660. * Starts the clock
  661. */
  662. start: function(callback) {
  663. var t = this;
  664. if(!t.running && (!t.countdown || t.countdown && t.time.time > 0)) {
  665. t.face.start(t.time);
  666. t.timer.start(function() {
  667. t.flip();
  668. if(typeof callback === "function") {
  669. callback();
  670. }
  671. });
  672. }
  673. else {
  674. t.log('Trying to start timer when countdown already at 0');
  675. }
  676. },
  677. /**
  678. * Stops the clock
  679. */
  680. stop: function(callback) {
  681. this.face.stop();
  682. this.timer.stop(callback);
  683. for(var x in this.lists) {
  684. if (this.lists.hasOwnProperty(x)) {
  685. this.lists[x].stop();
  686. }
  687. }
  688. },
  689. /**
  690. * Reset the clock
  691. */
  692. reset: function(callback) {
  693. this.timer.reset(callback);
  694. this.face.reset();
  695. },
  696. /**
  697. * Sets the clock time
  698. */
  699. setTime: function(time) {
  700. this.time.time = time;
  701. this.flip(true);
  702. },
  703. /**
  704. * Get the clock time
  705. *
  706. * @return object Returns a FlipClock.Time object
  707. */
  708. getTime: function(time) {
  709. return this.time;
  710. },
  711. /**
  712. * Changes the increment of time to up or down (add/sub)
  713. */
  714. setCountdown: function(value) {
  715. var running = this.running;
  716. this.countdown = value ? true : false;
  717. if(running) {
  718. this.stop();
  719. this.start();
  720. }
  721. },
  722. /**
  723. * Flip the digits on the clock
  724. *
  725. * @param array An array of digits
  726. */
  727. flip: function(doNotAddPlayClass) {
  728. this.face.flip(false, doNotAddPlayClass);
  729. }
  730. });
  731. }(jQuery));
  732. /*jshint smarttabs:true */
  733. /**
  734. * FlipClock.js
  735. *
  736. * @author Justin Kimbrell
  737. * @copyright 2013 - Objective HTML, LLC
  738. * @licesnse http://www.opensource.org/licenses/mit-license.php
  739. */
  740. (function($) {
  741. "use strict";
  742. /**
  743. * The FlipClock List class is used to build the list used to create
  744. * the card flip effect. This object fascilates selecting the correct
  745. * node by passing a specific digit.
  746. *
  747. * @param object A FlipClock.Factory object
  748. * @param mixed This is the digit used to set the clock. If an
  749. * object is passed, 0 will be used.
  750. * @param object An object of properties to override the default
  751. */
  752. FlipClock.List = FlipClock.Base.extend({
  753. /**
  754. * The digit (0-9)
  755. */
  756. digit: 0,
  757. /**
  758. * The CSS classes
  759. */
  760. classes: {
  761. active: 'flip-clock-active',
  762. before: 'flip-clock-before',
  763. flip: 'flip'
  764. },
  765. /**
  766. * The parent FlipClock.Factory object
  767. */
  768. factory: false,
  769. /**
  770. * The jQuery object
  771. */
  772. $el: false,
  773. /**
  774. * The jQuery object (deprecated)
  775. */
  776. $obj: false,
  777. /**
  778. * The items in the list
  779. */
  780. items: [],
  781. /**
  782. * The last digit
  783. */
  784. lastDigit: 0,
  785. /**
  786. * Constructor
  787. *
  788. * @param object A FlipClock.Factory object
  789. * @param int An integer use to select the correct digit
  790. * @param object An object to override the default properties
  791. */
  792. constructor: function(factory, digit, options) {
  793. this.factory = factory;
  794. this.digit = digit;
  795. this.lastDigit = digit;
  796. this.$el = this.createList();
  797. // Depcrated support of the $obj property.
  798. this.$obj = this.$el;
  799. if(digit > 0) {
  800. this.select(digit);
  801. }
  802. this.factory.$el.append(this.$el);
  803. },
  804. /**
  805. * Select the digit in the list
  806. *
  807. * @param int A digit 0-9
  808. */
  809. select: function(digit) {
  810. if(typeof digit === "undefined") {
  811. digit = this.digit;
  812. }
  813. else {
  814. this.digit = digit;
  815. }
  816. if(this.digit != this.lastDigit) {
  817. var $delete = this.$el.find('.'+this.classes.before).removeClass(this.classes.before);
  818. this.$el.find('.'+this.classes.active).removeClass(this.classes.active)
  819. .addClass(this.classes.before);
  820. this.appendListItem(this.classes.active, this.digit);
  821. $delete.remove();
  822. this.lastDigit = this.digit;
  823. }
  824. },
  825. /**
  826. * Adds the play class to the DOM object
  827. */
  828. play: function() {
  829. this.$el.addClass(this.factory.classes.play);
  830. },
  831. /**
  832. * Removes the play class to the DOM object
  833. */
  834. stop: function() {
  835. var t = this;
  836. setTimeout(function() {
  837. t.$el.removeClass(t.factory.classes.play);
  838. }, this.factory.timer.interval);
  839. },
  840. /**
  841. * Creates the list item HTML and returns as a string
  842. */
  843. createListItem: function(css, value) {
  844. return [
  845. '<li class="'+(css ? css : '')+'">',
  846. '<a href="#">',
  847. '<div class="up">',
  848. '<div class="shadow"></div>',
  849. '<div class="inn">'+(value ? value : '')+'</div>',
  850. '</div>',
  851. '<div class="down">',
  852. '<div class="shadow"></div>',
  853. '<div class="inn">'+(value ? value : '')+'</div>',
  854. '</div>',
  855. '</a>',
  856. '</li>'
  857. ].join('');
  858. },
  859. /**
  860. * Append the list item to the parent DOM node
  861. */
  862. appendListItem: function(css, value) {
  863. var html = this.createListItem(css, value);
  864. this.$el.append(html);
  865. },
  866. /**
  867. * Create the list of digits and appends it to the DOM object
  868. */
  869. createList: function() {
  870. var lastDigit = this.getPrevDigit() ? this.getPrevDigit() : this.digit;
  871. var html = $([
  872. '<ul class="'+this.classes.flip+' '+(this.factory.running ? this.factory.classes.play : '')+'">',
  873. this.createListItem(this.classes.before, lastDigit),
  874. this.createListItem(this.classes.active, this.digit),
  875. '</ul>'
  876. ].join(''));
  877. return html;
  878. },
  879. getNextDigit: function() {
  880. return this.digit == 9 ? 0 : this.digit + 1;
  881. },
  882. getPrevDigit: function() {
  883. return this.digit == 0 ? 9 : this.digit - 1;
  884. }
  885. });
  886. }(jQuery));
  887. /*jshint smarttabs:true */
  888. /**
  889. * FlipClock.js
  890. *
  891. * @author Justin Kimbrell
  892. * @copyright 2013 - Objective HTML, LLC
  893. * @licesnse http://www.opensource.org/licenses/mit-license.php
  894. */
  895. (function($) {
  896. "use strict";
  897. /**
  898. * Capitalize the first letter in a string
  899. *
  900. * @return string
  901. */
  902. String.prototype.ucfirst = function() {
  903. return this.substr(0, 1).toUpperCase() + this.substr(1);
  904. };
  905. /**
  906. * jQuery helper method
  907. *
  908. * @param int An integer used to start the clock (no. seconds)
  909. * @param object An object of properties to override the default
  910. */
  911. $.fn.FlipClock = function(digit, options) {
  912. return new FlipClock($(this), digit, options);
  913. };
  914. /**
  915. * jQuery helper method
  916. *
  917. * @param int An integer used to start the clock (no. seconds)
  918. * @param object An object of properties to override the default
  919. */
  920. $.fn.flipClock = function(digit, options) {
  921. return $.fn.FlipClock(digit, options);
  922. };
  923. }(jQuery));
  924. /*jshint smarttabs:true */
  925. /**
  926. * FlipClock.js
  927. *
  928. * @author Justin Kimbrell
  929. * @copyright 2013 - Objective HTML, LLC
  930. * @licesnse http://www.opensource.org/licenses/mit-license.php
  931. */
  932. (function($) {
  933. "use strict";
  934. /**
  935. * The FlipClock Time class is used to manage all the time
  936. * calculations.
  937. *
  938. * @param object A FlipClock.Factory object
  939. * @param mixed This is the digit used to set the clock. If an
  940. * object is passed, 0 will be used.
  941. * @param object An object of properties to override the default
  942. */
  943. FlipClock.Time = FlipClock.Base.extend({
  944. /**
  945. * The time (in seconds) or a date object
  946. */
  947. time: 0,
  948. /**
  949. * The parent FlipClock.Factory object
  950. */
  951. factory: false,
  952. /**
  953. * The minimum number of digits the clock face must have
  954. */
  955. minimumDigits: 0,
  956. /**
  957. * Constructor
  958. *
  959. * @param object A FlipClock.Factory object
  960. * @param int An integer use to select the correct digit
  961. * @param object An object to override the default properties
  962. */
  963. constructor: function(factory, time, options) {
  964. if(typeof options != "object") {
  965. options = {};
  966. }
  967. if(!options.minimumDigits) {
  968. options.minimumDigits = factory.minimumDigits;
  969. }
  970. this.base(options);
  971. this.factory = factory;
  972. if(time) {
  973. this.time = time;
  974. }
  975. },
  976. /**
  977. * Convert a string or integer to an array of digits
  978. *
  979. * @param mixed String or Integer of digits
  980. * @return array An array of digits
  981. */
  982. convertDigitsToArray: function(str) {
  983. var data = [];
  984. str = str.toString();
  985. for(var x = 0;x < str.length; x++) {
  986. if(str[x].match(/^\d*$/g)) {
  987. data.push(str[x]);
  988. }
  989. }
  990. return data;
  991. },
  992. /**
  993. * Get a specific digit from the time integer
  994. *
  995. * @param int The specific digit to select from the time
  996. * @return mixed Returns FALSE if no digit is found, otherwise
  997. * the method returns the defined digit
  998. */
  999. digit: function(i) {
  1000. var timeStr = this.toString();
  1001. var length = timeStr.length;
  1002. if(timeStr[length - i]) {
  1003. return timeStr[length - i];
  1004. }
  1005. return false;
  1006. },
  1007. /**
  1008. * Formats any array of digits into a valid array of digits
  1009. *
  1010. * @param mixed An array of digits
  1011. * @return array An array of digits
  1012. */
  1013. digitize: function(obj) {
  1014. var data = [];
  1015. $.each(obj, function(i, value) {
  1016. value = value.toString();
  1017. if(value.length == 1) {
  1018. value = '0'+value;
  1019. }
  1020. for(var x = 0; x < value.length; x++) {
  1021. data.push(value.charAt(x));
  1022. }
  1023. });
  1024. if(data.length > this.minimumDigits) {
  1025. this.minimumDigits = data.length;
  1026. }
  1027. if(this.minimumDigits > data.length) {
  1028. for(var x = data.length; x < this.minimumDigits; x++) {
  1029. data.unshift('0');
  1030. }
  1031. }
  1032. return data;
  1033. },
  1034. /**
  1035. * Gets a new Date object for the current time
  1036. *
  1037. * @return array Returns a Date object
  1038. */
  1039. getDateObject: function() {
  1040. if(this.time instanceof Date) {
  1041. return this.time;
  1042. }
  1043. return new Date((new Date()).getTime() + this.getTimeSeconds() * 1000);
  1044. },
  1045. /**
  1046. * Gets a digitized daily counter
  1047. *
  1048. * @return object Returns a digitized object
  1049. */
  1050. getDayCounter: function(includeSeconds) {
  1051. var digits = [
  1052. this.getDays(),
  1053. this.getHours(true),
  1054. this.getMinutes(true)
  1055. ];
  1056. if(includeSeconds) {
  1057. digits.push(this.getSeconds(true));
  1058. }
  1059. return this.digitize(digits);
  1060. },
  1061. /**
  1062. * Gets number of days
  1063. *
  1064. * @param bool Should perform a modulus? If not sent, then no.
  1065. * @return int Retuns a floored integer
  1066. */
  1067. getDays: function(mod) {
  1068. var days = this.getTimeSeconds() / 60 / 60 / 24;
  1069. if(mod) {
  1070. days = days % 7;
  1071. }
  1072. return Math.floor(days);
  1073. },
  1074. /**
  1075. * Gets an hourly breakdown
  1076. *
  1077. * @return object Returns a digitized object
  1078. */
  1079. getHourCounter: function() {
  1080. var obj = this.digitize([
  1081. this.getHours(),
  1082. this.getMinutes(true),
  1083. this.getSeconds(true)
  1084. ]);
  1085. return obj;
  1086. },
  1087. /**
  1088. * Gets an hourly breakdown
  1089. *
  1090. * @return object Returns a digitized object
  1091. */
  1092. getHourly: function() {
  1093. return this.getHourCounter();
  1094. },
  1095. /**
  1096. * Gets number of hours
  1097. *
  1098. * @param bool Should perform a modulus? If not sent, then no.
  1099. * @return int Retuns a floored integer
  1100. */
  1101. getHours: function(mod) {
  1102. var hours = this.getTimeSeconds() / 60 / 60;
  1103. if(mod) {
  1104. hours = hours % 24;
  1105. }
  1106. return Math.floor(hours);
  1107. },
  1108. /**
  1109. * Gets the twenty-four hour time
  1110. *
  1111. * @return object returns a digitized object
  1112. */
  1113. getMilitaryTime: function(date, showSeconds) {
  1114. if(typeof showSeconds === "undefined") {
  1115. showSeconds = true;
  1116. }
  1117. if(!date) {
  1118. date = this.getDateObject();
  1119. }
  1120. var data = [
  1121. date.getHours(),
  1122. date.getMinutes()
  1123. ];
  1124. if(showSeconds === true) {
  1125. data.push(date.getSeconds());
  1126. }
  1127. return this.digitize(data);
  1128. },
  1129. /**
  1130. * Gets number of minutes
  1131. *
  1132. * @param bool Should perform a modulus? If not sent, then no.
  1133. * @return int Retuns a floored integer
  1134. */
  1135. getMinutes: function(mod) {
  1136. var minutes = this.getTimeSeconds() / 60;
  1137. if(mod) {
  1138. minutes = minutes % 60;
  1139. }
  1140. return Math.floor(minutes);
  1141. },
  1142. /**
  1143. * Gets a minute breakdown
  1144. */
  1145. getMinuteCounter: function() {
  1146. var obj = this.digitize([
  1147. this.getMinutes(),
  1148. this.getSeconds(true)
  1149. ]);
  1150. return obj;
  1151. },
  1152. /**
  1153. * Gets time count in seconds regardless of if targetting date or not.
  1154. *
  1155. * @return int Returns a floored integer
  1156. */
  1157. getTimeSeconds: function(date) {
  1158. if(!date) {
  1159. date = new Date();
  1160. }
  1161. if (this.time instanceof Date) {
  1162. if (this.factory.countdown) {
  1163. return Math.max(this.time.getTime()/1000 - date.getTime()/1000,0);
  1164. } else {
  1165. return date.getTime()/1000 - this.time.getTime()/1000 ;
  1166. }
  1167. } else {
  1168. return this.time;
  1169. }
  1170. },
  1171. /**
  1172. * Gets the current twelve hour time
  1173. *
  1174. * @return object Returns a digitized object
  1175. */
  1176. getTime: function(date, showSeconds) {
  1177. if(typeof showSeconds === "undefined") {
  1178. showSeconds = true;
  1179. }
  1180. if(!date) {
  1181. date = this.getDateObject();
  1182. }
  1183. console.log(date);
  1184. var hours = date.getHours();
  1185. var merid = hours > 12 ? 'PM' : 'AM';
  1186. var data = [
  1187. hours > 12 ? hours - 12 : (hours === 0 ? 12 : hours),
  1188. date.getMinutes()
  1189. ];
  1190. if(showSeconds === true) {
  1191. data.push(date.getSeconds());
  1192. }
  1193. return this.digitize(data);
  1194. },
  1195. /**
  1196. * Gets number of seconds
  1197. *
  1198. * @param bool Should perform a modulus? If not sent, then no.
  1199. * @return int Retuns a ceiled integer
  1200. */
  1201. getSeconds: function(mod) {
  1202. var seconds = this.getTimeSeconds();
  1203. if(mod) {
  1204. if(seconds == 60) {
  1205. seconds = 0;
  1206. }
  1207. else {
  1208. seconds = seconds % 60;
  1209. }
  1210. }
  1211. return Math.ceil(seconds);
  1212. },
  1213. /**
  1214. * Gets number of weeks
  1215. *
  1216. * @param bool Should perform a modulus? If not sent, then no.
  1217. * @return int Retuns a floored integer
  1218. */
  1219. getWeeks: function(mod) {
  1220. var weeks = this.getTimeSeconds() / 60 / 60 / 24 / 7;
  1221. if(mod) {
  1222. weeks = weeks % 52;
  1223. }
  1224. return Math.floor(weeks);
  1225. },
  1226. /**
  1227. * Removes a specific number of leading zeros from the array.
  1228. * This method prevents you from removing too many digits, even
  1229. * if you try.
  1230. *
  1231. * @param int Total number of digits to remove
  1232. * @return array An array of digits
  1233. */
  1234. removeLeadingZeros: function(totalDigits, digits) {
  1235. var total = 0;
  1236. var newArray = [];
  1237. $.each(digits, function(i, digit) {
  1238. if(i < totalDigits) {
  1239. total += parseInt(digits[i], 10);
  1240. }
  1241. else {
  1242. newArray.push(digits[i]);
  1243. }
  1244. });
  1245. if(total === 0) {
  1246. return newArray;
  1247. }
  1248. return digits;
  1249. },
  1250. /**
  1251. * Adds X second to the current time
  1252. */
  1253. addSeconds: function(x) {
  1254. if(this.time instanceof Date) {
  1255. this.time.setSeconds(this.time.getSeconds() + x);
  1256. }
  1257. else {
  1258. this.time += x;
  1259. }
  1260. },
  1261. /**
  1262. * Adds 1 second to the current time
  1263. */
  1264. addSecond: function() {
  1265. this.addSeconds(1);
  1266. },
  1267. /**
  1268. * Substracts X seconds from the current time
  1269. */
  1270. subSeconds: function(x) {
  1271. if(this.time instanceof Date) {
  1272. this.time.setSeconds(this.time.getSeconds() - x);
  1273. }
  1274. else {
  1275. this.time -= x;
  1276. }
  1277. },
  1278. /**
  1279. * Substracts 1 second from the current time
  1280. */
  1281. subSecond: function() {
  1282. this.subSeconds(1);
  1283. },
  1284. /**
  1285. * Converts the object to a human readable string
  1286. */
  1287. toString: function() {
  1288. return this.getTimeSeconds().toString();
  1289. }
  1290. /*
  1291. getYears: function() {
  1292. return Math.floor(this.time / 60 / 60 / 24 / 7 / 52);
  1293. },
  1294. getDecades: function() {
  1295. return Math.floor(this.getWeeks() / 10);
  1296. }*/
  1297. });
  1298. }(jQuery));
  1299. /*jshint smarttabs:true */
  1300. /**
  1301. * FlipClock.js
  1302. *
  1303. * @author Justin Kimbrell
  1304. * @copyright 2013 - Objective HTML, LLC
  1305. * @licesnse http://www.opensource.org/licenses/mit-license.php
  1306. */
  1307. (function($) {
  1308. "use strict";
  1309. /**
  1310. * The FlipClock.Timer object managers the JS timers
  1311. *
  1312. * @param object The parent FlipClock.Factory object
  1313. * @param object Override the default options
  1314. */
  1315. FlipClock.Timer = FlipClock.Base.extend({
  1316. /**
  1317. * Callbacks
  1318. */
  1319. callbacks: {
  1320. destroy: false,
  1321. create: false,
  1322. init: false,
  1323. interval: false,
  1324. start: false,
  1325. stop: false,
  1326. reset: false
  1327. },
  1328. /**
  1329. * FlipClock timer count (how many intervals have passed)
  1330. */
  1331. count: 0,
  1332. /**
  1333. * The parent FlipClock.Factory object
  1334. */
  1335. factory: false,
  1336. /**
  1337. * Timer interval (1 second by default)
  1338. */
  1339. interval: 1000,
  1340. /**
  1341. * The rate of the animation in milliseconds (not currently in use)
  1342. */
  1343. animationRate: 1000,
  1344. /**
  1345. * Constructor
  1346. *
  1347. * @return void
  1348. */
  1349. constructor: function(factory, options) {
  1350. this.base(options);
  1351. this.factory = factory;
  1352. this.callback(this.callbacks.init);
  1353. this.callback(this.callbacks.create);
  1354. },
  1355. /**
  1356. * This method gets the elapsed the time as an interger
  1357. *
  1358. * @return void
  1359. */
  1360. getElapsed: function() {
  1361. return this.count * this.interval;
  1362. },
  1363. /**
  1364. * This method gets the elapsed the time as a Date object
  1365. *
  1366. * @return void
  1367. */
  1368. getElapsedTime: function() {
  1369. return new Date(this.time + this.getElapsed());
  1370. },
  1371. /**
  1372. * This method is resets the timer
  1373. *
  1374. * @param callback This method resets the timer back to 0
  1375. * @return void
  1376. */
  1377. reset: function(callback) {
  1378. clearInterval(this.timer);
  1379. this.count = 0;
  1380. this._setInterval(callback);
  1381. this.callback(this.callbacks.reset);
  1382. },
  1383. /**
  1384. * This method is starts the timer
  1385. *
  1386. * @param callback A function that is called once the timer is destroyed
  1387. * @return void
  1388. */
  1389. start: function(callback) {
  1390. this.factory.running = true;
  1391. this._createTimer(callback);
  1392. this.callback(this.callbacks.start);
  1393. },
  1394. /**
  1395. * This method is stops the timer
  1396. *
  1397. * @param callback A function that is called once the timer is destroyed
  1398. * @return void
  1399. */
  1400. stop: function(callback) {
  1401. this.factory.running = false;
  1402. this._clearInterval(callback);
  1403. this.callback(this.callbacks.stop);
  1404. this.callback(callback);
  1405. },
  1406. /**
  1407. * Clear the timer interval
  1408. *
  1409. * @return void
  1410. */
  1411. _clearInterval: function() {
  1412. clearInterval(this.timer);
  1413. },
  1414. /**
  1415. * Create the timer object
  1416. *
  1417. * @param callback A function that is called once the timer is created
  1418. * @return void
  1419. */
  1420. _createTimer: function(callback) {
  1421. this._setInterval(callback);
  1422. },
  1423. /**
  1424. * Destroy the timer object
  1425. *
  1426. * @param callback A function that is called once the timer is destroyed
  1427. * @return void
  1428. */
  1429. _destroyTimer: function(callback) {
  1430. this._clearInterval();
  1431. this.timer = false;
  1432. this.callback(callback);
  1433. this.callback(this.callbacks.destroy);
  1434. },
  1435. /**
  1436. * This method is called each time the timer interval is ran
  1437. *
  1438. * @param callback A function that is called once the timer is destroyed
  1439. * @return void
  1440. */
  1441. _interval: function(callback) {
  1442. this.callback(this.callbacks.interval);
  1443. this.callback(callback);
  1444. this.count++;
  1445. },
  1446. /**
  1447. * This sets the timer interval
  1448. *
  1449. * @param callback A function that is called once the timer is destroyed
  1450. * @return void
  1451. */
  1452. _setInterval: function(callback) {
  1453. var t = this;
  1454. t._interval(callback);
  1455. t.timer = setInterval(function() {
  1456. t._interval(callback);
  1457. }, this.interval);
  1458. }
  1459. });
  1460. }(jQuery));
  1461. (function($) {
  1462. /**
  1463. * Twenty-Four Hour Clock Face
  1464. *
  1465. * This class will generate a twenty-four our clock for FlipClock.js
  1466. *
  1467. * @param object The parent FlipClock.Factory object
  1468. * @param object An object of properties to override the default
  1469. */
  1470. FlipClock.TwentyFourHourClockFace = FlipClock.Face.extend({
  1471. /**
  1472. * Constructor
  1473. *
  1474. * @param object The parent FlipClock.Factory object
  1475. * @param object An object of properties to override the default
  1476. */
  1477. constructor: function(factory, options) {
  1478. this.base(factory, options);
  1479. },
  1480. /**
  1481. * Build the clock face
  1482. *
  1483. * @param object Pass the time that should be used to display on the clock.
  1484. */
  1485. build: function(time) {
  1486. var t = this;
  1487. var children = this.factory.$el.find('ul');
  1488. if(!this.factory.time.time) {
  1489. this.factory.original = new Date();
  1490. this.factory.time = new FlipClock.Time(this.factory, this.factory.original);
  1491. }
  1492. var time = time ? time : this.factory.time.getMilitaryTime(false, this.showSeconds);
  1493. if(time.length > children.length) {
  1494. $.each(time, function(i, digit) {
  1495. t.createList(digit);
  1496. });
  1497. }
  1498. this.createDivider();
  1499. this.createDivider();
  1500. $(this.dividers[0]).insertBefore(this.lists[this.lists.length - 2].$el);
  1501. $(this.dividers[1]).insertBefore(this.lists[this.lists.length - 4].$el);
  1502. this.base();
  1503. },
  1504. /**
  1505. * Flip the clock face
  1506. */
  1507. flip: function(time, doNotAddPlayClass) {
  1508. this.autoIncrement();
  1509. time = time ? time : this.factory.time.getMilitaryTime(false, this.showSeconds);
  1510. this.base(time, doNotAddPlayClass);
  1511. }
  1512. });
  1513. }(jQuery));
  1514. (function($) {
  1515. /**
  1516. * Counter Clock Face
  1517. *
  1518. * This class will generate a generice flip counter. The timer has been
  1519. * disabled. clock.increment() and clock.decrement() have been added.
  1520. *
  1521. * @param object The parent FlipClock.Factory object
  1522. * @param object An object of properties to override the default
  1523. */
  1524. FlipClock.CounterFace = FlipClock.Face.extend({
  1525. /**
  1526. * Tells the counter clock face if it should auto-increment
  1527. */
  1528. shouldAutoIncrement: false,
  1529. /**
  1530. * Constructor
  1531. *
  1532. * @param object The parent FlipClock.Factory object
  1533. * @param object An object of properties to override the default
  1534. */
  1535. constructor: function(factory, options) {
  1536. if(typeof options != "object") {
  1537. options = {};
  1538. }
  1539. factory.autoStart = options.autoStart ? true : false;
  1540. if(options.autoStart) {
  1541. this.shouldAutoIncrement = true;
  1542. }
  1543. factory.increment = function() {
  1544. factory.countdown = false;
  1545. factory.setTime(factory.getTime().getTimeSeconds() + 1);
  1546. };
  1547. factory.decrement = function() {
  1548. factory.countdown = true;
  1549. var time = factory.getTime().getTimeSeconds();
  1550. if(time > 0) {
  1551. factory.setTime(time - 1);
  1552. }
  1553. };
  1554. factory.setValue = function(digits) {
  1555. factory.setTime(digits);
  1556. };
  1557. factory.setCounter = function(digits) {
  1558. factory.setTime(digits);
  1559. };
  1560. this.base(factory, options);
  1561. },
  1562. /**
  1563. * Build the clock face
  1564. */
  1565. build: function() {
  1566. var t = this;
  1567. var children = this.factory.$el.find('ul');
  1568. var time = this.factory.getTime().digitize([this.factory.getTime().time]);
  1569. if(time.length > children.length) {
  1570. $.each(time, function(i, digit) {
  1571. var list = t.createList(digit);
  1572. list.select(digit);
  1573. });
  1574. }
  1575. $.each(this.lists, function(i, list) {
  1576. list.play();
  1577. });
  1578. this.base();
  1579. },
  1580. /**
  1581. * Flip the clock face
  1582. */
  1583. flip: function(time, doNotAddPlayClass) {
  1584. if(this.shouldAutoIncrement) {
  1585. this.autoIncrement();
  1586. }
  1587. if(!time) {
  1588. time = this.factory.getTime().digitize([this.factory.getTime().time]);
  1589. }
  1590. this.base(time, doNotAddPlayClass);
  1591. },
  1592. /**
  1593. * Reset the clock face
  1594. */
  1595. reset: function() {
  1596. this.factory.time = new FlipClock.Time(
  1597. this.factory,
  1598. this.factory.original ? Math.round(this.factory.original) : 0
  1599. );
  1600. this.flip();
  1601. }
  1602. });
  1603. }(jQuery));
  1604. (function($) {
  1605. /**
  1606. * Daily Counter Clock Face
  1607. *
  1608. * This class will generate a daily counter for FlipClock.js. A
  1609. * daily counter will track days, hours, minutes, and seconds. If
  1610. * the number of available digits is exceeded in the count, a new
  1611. * digit will be created.
  1612. *
  1613. * @param object The parent FlipClock.Factory object
  1614. * @param object An object of properties to override the default
  1615. */
  1616. FlipClock.DailyCounterFace = FlipClock.Face.extend({
  1617. showSeconds: true,
  1618. /**
  1619. * Constructor
  1620. *
  1621. * @param object The parent FlipClock.Factory object
  1622. * @param object An object of properties to override the default
  1623. */
  1624. constructor: function(factory, options) {
  1625. this.base(factory, options);
  1626. },
  1627. /**
  1628. * Build the clock face
  1629. */
  1630. build: function(time) {
  1631. var t = this;
  1632. var children = this.factory.$el.find('ul');
  1633. var offset = 0;
  1634. time = time ? time : this.factory.time.getDayCounter(this.showSeconds);
  1635. if(time.length > children.length) {
  1636. $.each(time, function(i, digit) {
  1637. t.createList(digit);
  1638. });
  1639. }
  1640. if(this.showSeconds) {
  1641. $(this.createDivider('Seconds')).insertBefore(this.lists[this.lists.length - 2].$el);
  1642. }
  1643. else
  1644. {
  1645. offset = 2;
  1646. }
  1647. $(this.createDivider('Minutes')).insertBefore(this.lists[this.lists.length - 4 + offset].$el);
  1648. $(this.createDivider('Hours')).insertBefore(this.lists[this.lists.length - 6 + offset].$el);
  1649. $(this.createDivider('Days', true)).insertBefore(this.lists[0].$el);
  1650. this.base();
  1651. },
  1652. /**
  1653. * Flip the clock face
  1654. */
  1655. flip: function(time, doNotAddPlayClass) {
  1656. if(!time) {
  1657. time = this.factory.time.getDayCounter(this.showSeconds);
  1658. }
  1659. this.autoIncrement();
  1660. this.base(time, doNotAddPlayClass);
  1661. }
  1662. });
  1663. }(jQuery));
  1664. (function($) {
  1665. /**
  1666. * Hourly Counter Clock Face
  1667. *
  1668. * This class will generate an hourly counter for FlipClock.js. An
  1669. * hour counter will track hours, minutes, and seconds. If number of
  1670. * available digits is exceeded in the count, a new digit will be
  1671. * created.
  1672. *
  1673. * @param object The parent FlipClock.Factory object
  1674. * @param object An object of properties to override the default
  1675. */
  1676. FlipClock.HourlyCounterFace = FlipClock.Face.extend({
  1677. // clearExcessDigits: true,
  1678. /**
  1679. * Constructor
  1680. *
  1681. * @param object The parent FlipClock.Factory object
  1682. * @param object An object of properties to override the default
  1683. */
  1684. constructor: function(factory, options) {
  1685. this.base(factory, options);
  1686. },
  1687. /**
  1688. * Build the clock face
  1689. */
  1690. build: function(excludeHours, time) {
  1691. var t = this;
  1692. var children = this.factory.$el.find('ul');
  1693. time = time ? time : this.factory.time.getHourCounter();
  1694. if(time.length > children.length) {
  1695. $.each(time, function(i, digit) {
  1696. t.createList(digit);
  1697. });
  1698. }
  1699. $(this.createDivider('Seconds')).insertBefore(this.lists[this.lists.length - 2].$el);
  1700. $(this.createDivider('Minutes')).insertBefore(this.lists[this.lists.length - 4].$el);
  1701. if(!excludeHours) {
  1702. $(this.createDivider('Hours', true)).insertBefore(this.lists[0].$el);
  1703. }
  1704. this.base();
  1705. },
  1706. /**
  1707. * Flip the clock face
  1708. */
  1709. flip: function(time, doNotAddPlayClass) {
  1710. if(!time) {
  1711. time = this.factory.time.getHourCounter();
  1712. }
  1713. this.autoIncrement();
  1714. this.base(time, doNotAddPlayClass);
  1715. },
  1716. /**
  1717. * Append a newly created list to the clock
  1718. */
  1719. appendDigitToClock: function(obj) {
  1720. this.base(obj);
  1721. this.dividers[0].insertAfter(this.dividers[0].next());
  1722. }
  1723. });
  1724. }(jQuery));
  1725. (function($) {
  1726. /**
  1727. * Minute Counter Clock Face
  1728. *
  1729. * This class will generate a minute counter for FlipClock.js. A
  1730. * minute counter will track minutes and seconds. If an hour is
  1731. * reached, the counter will reset back to 0. (4 digits max)
  1732. *
  1733. * @param object The parent FlipClock.Factory object
  1734. * @param object An object of properties to override the default
  1735. */
  1736. FlipClock.MinuteCounterFace = FlipClock.HourlyCounterFace.extend({
  1737. clearExcessDigits: false,
  1738. /**
  1739. * Constructor
  1740. *
  1741. * @param object The parent FlipClock.Factory object
  1742. * @param object An object of properties to override the default
  1743. */
  1744. constructor: function(factory, options) {
  1745. this.base(factory, options);
  1746. },
  1747. /**
  1748. * Build the clock face
  1749. */
  1750. build: function() {
  1751. this.base(true, this.factory.time.getMinuteCounter());
  1752. },
  1753. /**
  1754. * Flip the clock face
  1755. */
  1756. flip: function(time, doNotAddPlayClass) {
  1757. if(!time) {
  1758. time = this.factory.time.getMinuteCounter();
  1759. }
  1760. this.base(time, doNotAddPlayClass);
  1761. }
  1762. });
  1763. }(jQuery));
  1764. (function($) {
  1765. /**
  1766. * Twelve Hour Clock Face
  1767. *
  1768. * This class will generate a twelve hour clock for FlipClock.js
  1769. *
  1770. * @param object The parent FlipClock.Factory object
  1771. * @param object An object of properties to override the default
  1772. */
  1773. FlipClock.TwelveHourClockFace = FlipClock.TwentyFourHourClockFace.extend({
  1774. /**
  1775. * The meridium jQuery DOM object
  1776. */
  1777. meridium: false,
  1778. /**
  1779. * The meridium text as string for easy access
  1780. */
  1781. meridiumText: 'AM',
  1782. /**
  1783. * Build the clock face
  1784. *
  1785. * @param object Pass the time that should be used to display on the clock.
  1786. */
  1787. build: function() {
  1788. var t = this;
  1789. var time = this.factory.time.getTime(false, this.showSeconds);
  1790. this.base(time);
  1791. this.meridiumText = this.getMeridium();
  1792. this.meridium = $([
  1793. '<ul class="flip-clock-meridium">',
  1794. '<li>',
  1795. '<a href="#">'+this.meridiumText+'</a>',
  1796. '</li>',
  1797. '</ul>'
  1798. ].join(''));
  1799. this.meridium.insertAfter(this.lists[this.lists.length-1].$el);
  1800. },
  1801. /**
  1802. * Flip the clock face
  1803. */
  1804. flip: function(time, doNotAddPlayClass) {
  1805. if(this.meridiumText != this.getMeridium()) {
  1806. this.meridiumText = this.getMeridium();
  1807. this.meridium.find('a').html(this.meridiumText);
  1808. }
  1809. this.base(this.factory.time.getTime(false, this.showSeconds), doNotAddPlayClass);
  1810. },
  1811. /**
  1812. * Get the current meridium
  1813. *
  1814. * @return string Returns the meridium (AM|PM)
  1815. */
  1816. getMeridium: function() {
  1817. return new Date().getHours() >= 12 ? 'PM' : 'AM';
  1818. },
  1819. /**
  1820. * Is it currently in the post-medirium?
  1821. *
  1822. * @return bool Returns true or false
  1823. */
  1824. isPM: function() {
  1825. return this.getMeridium() == 'PM' ? true : false;
  1826. },
  1827. /**
  1828. * Is it currently before the post-medirium?
  1829. *
  1830. * @return bool Returns true or false
  1831. */
  1832. isAM: function() {
  1833. return this.getMeridium() == 'AM' ? true : false;
  1834. }
  1835. });
  1836. }(jQuery));
  1837. (function($) {
  1838. /**
  1839. * FlipClock Arabic Language Pack
  1840. *
  1841. * This class will be used to translate tokens into the Arabic language.
  1842. *
  1843. */
  1844. FlipClock.Lang.Arabic = {
  1845. 'years' : 'سنوات',
  1846. 'months' : 'شهور',
  1847. 'days' : 'أيام',
  1848. 'hours' : 'ساعات',
  1849. 'minutes' : 'دقائق',
  1850. 'seconds' : 'ثواني'
  1851. };
  1852. /* Create various aliases for convenience */
  1853. FlipClock.Lang['ar'] = FlipClock.Lang.Arabic;
  1854. FlipClock.Lang['ar-ar'] = FlipClock.Lang.Arabic;
  1855. FlipClock.Lang['arabic'] = FlipClock.Lang.Arabic;
  1856. }(jQuery));
  1857. (function($) {
  1858. /**
  1859. * FlipClock Danish Language Pack
  1860. *
  1861. * This class will used to translate tokens into the Danish language.
  1862. *
  1863. */
  1864. FlipClock.Lang.Danish = {
  1865. 'years' : 'År',
  1866. 'months' : 'Måneder',
  1867. 'days' : 'Dage',
  1868. 'hours' : 'Timer',
  1869. 'minutes' : 'Minutter',
  1870. 'seconds' : 'Sekunder'
  1871. };
  1872. /* Create various aliases for convenience */
  1873. FlipClock.Lang['da'] = FlipClock.Lang.Danish;
  1874. FlipClock.Lang['da-dk'] = FlipClock.Lang.Danish;
  1875. FlipClock.Lang['danish'] = FlipClock.Lang.Danish;
  1876. }(jQuery));
  1877. (function($) {
  1878. /**
  1879. * FlipClock German Language Pack
  1880. *
  1881. * This class will used to translate tokens into the German language.
  1882. *
  1883. */
  1884. FlipClock.Lang.German = {
  1885. 'years' : 'Jahre',
  1886. 'months' : 'Monate',
  1887. 'days' : 'Tage',
  1888. 'hours' : 'Stunden',
  1889. 'minutes' : 'Minuten',
  1890. 'seconds' : 'Sekunden'
  1891. };
  1892. /* Create various aliases for convenience */
  1893. FlipClock.Lang['de'] = FlipClock.Lang.German;
  1894. FlipClock.Lang['de-de'] = FlipClock.Lang.German;
  1895. FlipClock.Lang['german'] = FlipClock.Lang.German;
  1896. }(jQuery));
  1897. (function($) {
  1898. /**
  1899. * FlipClock English Language Pack
  1900. *
  1901. * This class will used to translate tokens into the English language.
  1902. *
  1903. */
  1904. FlipClock.Lang.English = {
  1905. 'years' : 'Years',
  1906. 'months' : 'Months',
  1907. 'days' : 'Days',
  1908. 'hours' : 'Hours',
  1909. 'minutes' : 'Minutes',
  1910. 'seconds' : 'Seconds'
  1911. };
  1912. /* Create various aliases for convenience */
  1913. FlipClock.Lang['en'] = FlipClock.Lang.English;
  1914. FlipClock.Lang['en-us'] = FlipClock.Lang.English;
  1915. FlipClock.Lang['english'] = FlipClock.Lang.English;
  1916. }(jQuery));
  1917. (function($) {
  1918. /**
  1919. * FlipClock Spanish Language Pack
  1920. *
  1921. * This class will used to translate tokens into the Spanish language.
  1922. *
  1923. */
  1924. FlipClock.Lang.Spanish = {
  1925. 'years' : 'Años',
  1926. 'months' : 'Meses',
  1927. 'days' : 'Días',
  1928. 'hours' : 'Horas',
  1929. 'minutes' : 'Minutos',
  1930. 'seconds' : 'Segundos'
  1931. };
  1932. /* Create various aliases for convenience */
  1933. FlipClock.Lang['es'] = FlipClock.Lang.Spanish;
  1934. FlipClock.Lang['es-es'] = FlipClock.Lang.Spanish;
  1935. FlipClock.Lang['spanish'] = FlipClock.Lang.Spanish;
  1936. }(jQuery));
  1937. (function($) {
  1938. /**
  1939. * FlipClock Finnish Language Pack
  1940. *
  1941. * This class will used to translate tokens into the Finnish language.
  1942. *
  1943. */
  1944. FlipClock.Lang.Finnish = {
  1945. 'years' : 'Vuotta',
  1946. 'months' : 'Kuukautta',
  1947. 'days' : 'Päivää',
  1948. 'hours' : 'Tuntia',
  1949. 'minutes' : 'Minuuttia',
  1950. 'seconds' : 'Sekuntia'
  1951. };
  1952. /* Create various aliases for convenience */
  1953. FlipClock.Lang['fi'] = FlipClock.Lang.Finnish;
  1954. FlipClock.Lang['fi-fi'] = FlipClock.Lang.Finnish;
  1955. FlipClock.Lang['finnish'] = FlipClock.Lang.Finnish;
  1956. }(jQuery));
  1957. (function($) {
  1958. /**
  1959. * FlipClock Canadian French Language Pack
  1960. *
  1961. * This class will used to translate tokens into the Canadian French language.
  1962. *
  1963. */
  1964. FlipClock.Lang.French = {
  1965. 'years' : 'Ans',
  1966. 'months' : 'Mois',
  1967. 'days' : 'Jours',
  1968. 'hours' : 'Heures',
  1969. 'minutes' : 'Minutes',
  1970. 'seconds' : 'Secondes'
  1971. };
  1972. /* Create various aliases for convenience */
  1973. FlipClock.Lang['fr'] = FlipClock.Lang.French;
  1974. FlipClock.Lang['fr-ca'] = FlipClock.Lang.French;
  1975. FlipClock.Lang['french'] = FlipClock.Lang.French;
  1976. }(jQuery));
  1977. (function($) {
  1978. /**
  1979. * FlipClock Italian Language Pack
  1980. *
  1981. * This class will used to translate tokens into the Italian language.
  1982. *
  1983. */
  1984. FlipClock.Lang.Italian = {
  1985. 'years' : 'Anni',
  1986. 'months' : 'Mesi',
  1987. 'days' : 'Giorni',
  1988. 'hours' : 'Ore',
  1989. 'minutes' : 'Minuti',
  1990. 'seconds' : 'Secondi'
  1991. };
  1992. /* Create various aliases for convenience */
  1993. FlipClock.Lang['it'] = FlipClock.Lang.Italian;
  1994. FlipClock.Lang['it-it'] = FlipClock.Lang.Italian;
  1995. FlipClock.Lang['italian'] = FlipClock.Lang.Italian;
  1996. }(jQuery));
  1997. (function($) {
  1998. /**
  1999. * FlipClock Latvian Language Pack
  2000. *
  2001. * This class will used to translate tokens into the Latvian language.
  2002. *
  2003. */
  2004. FlipClock.Lang.Latvian = {
  2005. 'years' : 'Gadi',
  2006. 'months' : 'Mēneši',
  2007. 'days' : 'Dienas',
  2008. 'hours' : 'Stundas',
  2009. 'minutes' : 'Minūtes',
  2010. 'seconds' : 'Sekundes'
  2011. };
  2012. /* Create various aliases for convenience */
  2013. FlipClock.Lang['lv'] = FlipClock.Lang.Latvian;
  2014. FlipClock.Lang['lv-lv'] = FlipClock.Lang.Latvian;
  2015. FlipClock.Lang['latvian'] = FlipClock.Lang.Latvian;
  2016. }(jQuery));
  2017. (function($) {
  2018. /**
  2019. * FlipClock Dutch Language Pack
  2020. *
  2021. * This class will used to translate tokens into the Dutch language.
  2022. */
  2023. FlipClock.Lang.Dutch = {
  2024. 'years' : 'Jaren',
  2025. 'months' : 'Maanden',
  2026. 'days' : 'Dagen',
  2027. 'hours' : 'Uren',
  2028. 'minutes' : 'Minuten',
  2029. 'seconds' : 'Seconden'
  2030. };
  2031. /* Create various aliases for convenience */
  2032. FlipClock.Lang['nl'] = FlipClock.Lang.Dutch;
  2033. FlipClock.Lang['nl-be'] = FlipClock.Lang.Dutch;
  2034. FlipClock.Lang['dutch'] = FlipClock.Lang.Dutch;
  2035. }(jQuery));
  2036. (function($) {
  2037. /**
  2038. * FlipClock Norwegian-Bokmål Language Pack
  2039. *
  2040. * This class will used to translate tokens into the Norwegian language.
  2041. *
  2042. */
  2043. FlipClock.Lang.Norwegian = {
  2044. 'years' : 'År',
  2045. 'months' : 'Måneder',
  2046. 'days' : 'Dager',
  2047. 'hours' : 'Timer',
  2048. 'minutes' : 'Minutter',
  2049. 'seconds' : 'Sekunder'
  2050. };
  2051. /* Create various aliases for convenience */
  2052. FlipClock.Lang['no'] = FlipClock.Lang.Norwegian;
  2053. FlipClock.Lang['nb'] = FlipClock.Lang.Norwegian;
  2054. FlipClock.Lang['no-nb'] = FlipClock.Lang.Norwegian;
  2055. FlipClock.Lang['norwegian'] = FlipClock.Lang.Norwegian;
  2056. }(jQuery));
  2057. (function($) {
  2058. /**
  2059. * FlipClock Portuguese Language Pack
  2060. *
  2061. * This class will used to translate tokens into the Portuguese language.
  2062. *
  2063. */
  2064. FlipClock.Lang.Portuguese = {
  2065. 'years' : 'Anos',
  2066. 'months' : 'Meses',
  2067. 'days' : 'Dias',
  2068. 'hours' : 'Horas',
  2069. 'minutes' : 'Minutos',
  2070. 'seconds' : 'Segundos'
  2071. };
  2072. /* Create various aliases for convenience */
  2073. FlipClock.Lang['pt'] = FlipClock.Lang.Portuguese;
  2074. FlipClock.Lang['pt-br'] = FlipClock.Lang.Portuguese;
  2075. FlipClock.Lang['portuguese'] = FlipClock.Lang.Portuguese;
  2076. }(jQuery));
  2077. (function($) {
  2078. /**
  2079. * FlipClock Russian Language Pack
  2080. *
  2081. * This class will used to translate tokens into the Russian language.
  2082. *
  2083. */
  2084. FlipClock.Lang.Russian = {
  2085. 'years' : 'лет',
  2086. 'months' : 'месяцев',
  2087. 'days' : 'дней',
  2088. 'hours' : 'часов',
  2089. 'minutes' : 'минут',
  2090. 'seconds' : 'секунд'
  2091. };
  2092. /* Create various aliases for convenience */
  2093. FlipClock.Lang['ru'] = FlipClock.Lang.Russian;
  2094. FlipClock.Lang['ru-ru'] = FlipClock.Lang.Russian;
  2095. FlipClock.Lang['russian'] = FlipClock.Lang.Russian;
  2096. }(jQuery));
  2097. (function($) {
  2098. /**
  2099. * FlipClock Swedish Language Pack
  2100. *
  2101. * This class will used to translate tokens into the Swedish language.
  2102. *
  2103. */
  2104. FlipClock.Lang.Swedish = {
  2105. 'years' : 'År',
  2106. 'months' : 'Månader',
  2107. 'days' : 'Dagar',
  2108. 'hours' : 'Timmar',
  2109. 'minutes' : 'Minuter',
  2110. 'seconds' : 'Sekunder'
  2111. };
  2112. /* Create various aliases for convenience */
  2113. FlipClock.Lang['sv'] = FlipClock.Lang.Swedish;
  2114. FlipClock.Lang['sv-se'] = FlipClock.Lang.Swedish;
  2115. FlipClock.Lang['swedish'] = FlipClock.Lang.Swedish;
  2116. }(jQuery));
  2117. (function($) {
  2118. /**
  2119. * FlipClock Chinese Language Pack
  2120. *
  2121. * This class will used to translate tokens into the Chinese language.
  2122. *
  2123. */
  2124. FlipClock.Lang.Chinese = {
  2125. 'years' : '年',
  2126. 'months' : '月',
  2127. 'days' : '日',
  2128. 'hours' : '时',
  2129. 'minutes' : '分',
  2130. 'seconds' : '秒'
  2131. };
  2132. /* Create various aliases for convenience */
  2133. FlipClock.Lang['zh'] = FlipClock.Lang.Chinese;
  2134. FlipClock.Lang['zh-cn'] = FlipClock.Lang.Chinese;
  2135. FlipClock.Lang['chinese'] = FlipClock.Lang.Chinese;
  2136. }(jQuery));