vendor: 4,321 bytes, lines 1-158
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 7var Base = function() { 8 // dummy 9}; 10 11Base.extend = function(_instance, _static) { // subclass 12 13 "use strict"; 14 15 var extend = Base.prototype.extend; 16 17 // build the prototype 18 Base._prototyping = true; 19 20 var proto = new this(); 21 22 extend.call(proto, _instance); 23 24 proto.base = function() { 25 // call this method from any other method to invoke that method's ancestor 26 }; 27 28 delete Base._prototyping; 29 30 // create the wrapper for the constructor function 31 //var constructor = proto.constructor.valueOf(); //-dean 32 var constructor = proto.constructor; 33 var klass = proto.constructor = function() { 34 if (!Base._prototyping) { 35 if (this._constructing || this.constructor == klass) { // instantiation 36 this._constructing = true; 37 constructor.apply(this, arguments); 38 delete this._constructing; 39 } else if (arguments[0] !== null) { // casting 40 return (arguments[0].extend || extend).call(arguments[0], proto); 41 } 42 } 43 }; 44 45 // build the class interface 46 klass.ancestor = this; 47 klass.extend = this.extend; 48 klass.forEach = this.forEach; 49 klass.implement = this.implement; 50 klass.prototype = proto; 51 klass.toString = this.toString; 52 klass.valueOf = function(type) { 53 //return (type == "object") ? klass : constructor; //-dean 54 return (type == "object") ? klass : constructor.valueOf(); 55 }; 56 extend.call(klass, _static); 57 // class initialisation 58 if (typeof klass.init == "function") klass.init(); 59 return klass; 60}; 61 62Base.prototype = { 63 extend: function(source, value) { 64 if (arguments.length > 1) { // extending with a name/value pair 65 var ancestor = this[source]; 66 if (ancestor && (typeof value == "function") && // overriding a method? 67 // the valueOf() comparison is to avoid circular references 68 (!ancestor.valueOf || ancestor.valueOf() != value.valueOf()) && 69 /\bbase\b/.test(value)) { 70 // get the underlying method 71 var method = value.valueOf(); 72 // override 73 value = function() { 74 var previous = this.base || Base.prototype.base; 75 this.base = ancestor; 76 var returnValue = method.apply(this, arguments); 77 this.base = previous; 78 return returnValue; 79 }; 80 // point to the underlying method 81 value.valueOf = function(type) { 82 return (type == "object") ? value : method; 83 }; 84 value.toString = Base.toString; 85 } 86 this[source] = value; 87 } else if (source) { // extending with an object literal 88 var extend = Base.prototype.extend; 89 // if this object has a customised extend method then use it 90 if (!Base._prototyping && typeof this != "function") { 91 extend = this.extend || extend; 92 } 93 var proto = {toSource: null}; 94 // do the "toString" and other methods manually 95 var hidden = ["constructor", "toString", "valueOf"]; 96 // if we are prototyping then include the constructor 97 var i = Base._prototyping ? 0 : 1; 98 while (key = hidden[i++]) { 99 if (source[key] != proto[key]) { 100 extend.call(this, key, source[key]); 101 102 } 103 } 104 // copy each of the source object's properties to this object 105 for (var key in source) { 106 if (!proto[key]) extend.call(this, key, source[key]); 107 } 108 } 109 return this; 110 } 111}; 112 113// initialise 114Base = Base.extend({ 115 constructor: function() { 116 this.extend(arguments[0]); 117 } 118}, { 119 ancestor: Object, 120 version: "1.1", 121 122 forEach: function(object, block, context) { 123 for (var key in object) { 124 if (this.prototype[key] === undefined) { 125 block.call(context, object[key], key, object); 126 } 127 } 128 }, 129 130 implement: function() { 131 for (var i = 0; i < arguments.length; i++) { 132 if (typeof arguments[i] == "function") { 133 // if it's a function, call it 134 arguments[i](this.prototype); 135 } else { 136 // add the interface using the extend method 137 this.prototype.extend(arguments[i]); 138 } 139 } 140 return this; 141 }, 142 143 toString: function() { 144 return String(this.valueOf()); 145 } 146}); 147/*jshint smarttabs:true */ 148 149var FlipClock; 150 151/** 152 * FlipClock.js 153 * 154 * @author Justin Kimbrell 155 * @copyright 2013 - Objective HTML, LLC 156 * @licesnse http://www.opensource.org/licenses/mit-license.php 157 */ 158
159(function($) { 160 161 "use strict"; 162 163 /** 164 * FlipFlock Helper 165 * 166 * @param object A jQuery object or CSS select 167 * @param int An integer used to start the clock (no. seconds) 168 * @param object An object of properties to override the default 169 */ 170 171 FlipClock = function(obj, digit, options) { 172 if(digit instanceof Object && digit instanceof Date === false) { 173 options = digit; 174 digit = 0; 175 } 176 177 return new FlipClock.Factory(obj, digit, options); 178 }; 179 180 /** 181 * The global FlipClock.Lang object 182 */ 183 184 FlipClock.Lang = {}; 185 186 /** 187 * The Base FlipClock class is used to extend all other FlipFlock 188 * classes. It handles the callbacks and the basic setters/getters 189 * 190 * @param object An object of the default properties 191 * @param object An object of properties to override the default 192 */ 193 194 FlipClock.Base = Base.extend({ 195 196 /** 197 * Build Date 198 */ 199 200 buildDate: '2014-12-12', 201 202 /** 203 * Version 204 */ 205 206 version: '0.7.7', 207 208 /** 209 * Sets the default options 210 * 211 * @param object The default options 212 * @param object The override options 213 */ 214 215 constructor: function(_default, options) { 216 if(typeof _default !== "object") { 217 _default = {}; 218 } 219 if(typeof options !== "object") { 220 options = {}; 221 } 222 this.setOptions($.extend(true, {}, _default, options)); 223 }, 224 225 /** 226 * Delegates the callback to the defined method 227 * 228 * @param object The default options 229 * @param object The override options 230 */ 231 232 callback: function(method) { 233 if(typeof method === "function") { 234 var args = []; 235 236 for(var x = 1; x <= arguments.length; x++) { 237 if(arguments[x]) { 238 args.push(arguments[x]); 239 } 240 } 241 242 method.apply(this, args); 243 } 244 }, 245 246 /** 247 * Log a string into the console if it exists 248 * 249 * @param string The name of the option 250 * @return mixed 251 */ 252 253 log: function(str) { 254 if(window.console && console.log) { 255 console.log(str); 256 } 257 }, 258 259 /** 260 * Get an single option value. Returns false if option does not exist 261 * 262 * @param string The name of the option 263 * @return mixed 264 */ 265 266 getOption: function(index) { 267 if(this[index]) { 268 return this[index]; 269 } 270 return false; 271 }, 272 273 /** 274 * Get all options 275 * 276 * @return bool 277 */ 278 279 getOptions: function() { 280 return this; 281 }, 282 283 /** 284 * Set a single option value 285 * 286 * @param string The name of the option 287 * @param mixed The value of the option 288 */ 289 290 setOption: function(index, value) { 291 this[index] = value; 292 }, 293 294 /** 295 * Set a multiple options by passing a JSON object 296 * 297 * @param object The object with the options 298 * @param mixed The value of the option 299 */ 300 301 setOptions: function(options) { 302 for(var key in options) { 303 if(typeof options[key] !== "undefined") { 304 this.setOption(key, options[key]); 305 } 306 } 307 } 308 309 }); 310 311}(jQuery)); 312 313/*jshint smarttabs:true */ 314 315/** 316 * FlipClock.js 317 * 318 * @author Justin Kimbrell 319 * @copyright 2013 - Objective HTML, LLC 320 * @licesnse http://www.opensource.org/licenses/mit-license.php 321 */ 322 323(function($) { 324 325 "use strict"; 326 327 /** 328 * The FlipClock Face class is the base class in which to extend 329 * all other FlockClock.Face classes. 330 * 331 * @param object The parent FlipClock.Factory object 332 * @param object An object of properties to override the default 333 */ 334 335 FlipClock.Face = FlipClock.Base.extend({ 336 337 /** 338 * Sets whether or not the clock should start upon instantiation 339 */ 340 341 autoStart: true, 342 343 /** 344 * An array of jQuery objects used for the dividers (the colons) 345 */ 346 347 dividers: [], 348 349 /** 350 * An array of FlipClock.List objects 351 */ 352 353 factory: false, 354 355 /** 356 * An array of FlipClock.List objects 357 */ 358 359 lists: [], 360 361 /** 362 * Constructor 363 * 364 * @param object The parent FlipClock.Factory object 365 * @param object An object of properties to override the default 366 */ 367 368 constructor: function(factory, options) { 369 this.dividers = []; 370 this.lists = []; 371 this.base(options); 372 this.factory = factory; 373 }, 374 375 /** 376 * Build the clock face 377 */ 378 379 build: function() { 380 if(this.autoStart) { 381 this.start(); 382 } 383 }, 384 385 /** 386 * Creates a jQuery object used for the digit divider 387 * 388 * @param mixed The divider label text 389 * @param mixed Set true to exclude the dots in the divider. 390 * If not set, is false. 391 */ 392 393 createDivider: function(label, css, excludeDots) { 394 if(typeof css == "boolean" || !css) { 395 excludeDots = css; 396 css = label; 397 } 398 399 var dots = [ 400 '<span class="'+this.factory.classes.dot+' top"></span>', 401 '<span class="'+this.factory.classes.dot+' bottom"></span>' 402 ].join(''); 403 404 if(excludeDots) { 405 dots = ''; 406 } 407 408 label = this.factory.localize(label); 409 410 var html = [ 411 '<span class="'+this.factory.classes.divider+' '+(css ? css : '').toLowerCase()+'">', 412 '<span class="'+this.factory.classes.label+'">'+(label ? label : '')+'</span>', 413 dots, 414 '</span>' 415 ]; 416 417 var $html = $(html.join(''));
418 419 this.dividers.push($html); 420 421 return $html; 422 }, 423 424 /** 425 * Creates a FlipClock.List object and appends it to the DOM 426 * 427 * @param mixed The digit to select in the list 428 * @param object An object to override the default properties 429 */ 430 431 createList: function(digit, options) { 432 if(typeof digit === "object") { 433 options = digit; 434 digit = 0; 435 } 436 437 var obj = new FlipClock.List(this.factory, digit, options); 438 439 this.lists.push(obj); 440 441 return obj; 442 }, 443 444 /** 445 * Triggers when the clock is reset 446 */ 447 448 reset: function() { 449 this.factory.time = new FlipClock.Time( 450 this.factory, 451 this.factory.original ? Math.round(this.factory.original) : 0, 452 { 453 minimumDigits: this.factory.minimumDigits 454 } 455 ); 456 457 this.flip(this.factory.original, false); 458 }, 459 460 /** 461 * Append a newly created list to the clock 462 */ 463 464 appendDigitToClock: function(obj) { 465 obj.$el.append(false); 466 }, 467 468 /** 469 * Add a digit to the clock face 470 */ 471 472 addDigit: function(digit) { 473 var obj = this.createList(digit, { 474 classes: { 475 active: this.factory.classes.active, 476 before: this.factory.classes.before, 477 flip: this.factory.classes.flip 478 } 479 }); 480 481 this.appendDigitToClock(obj); 482 }, 483 484 /** 485 * Triggers when the clock is started 486 */ 487 488 start: function() {}, 489 490 /** 491 * Triggers when the time on the clock stops 492 */ 493 494 stop: function() {}, 495 496 /** 497 * Auto increments/decrements the value of the clock face 498 */ 499 500 autoIncrement: function() { 501 if(!this.factory.countdown) { 502 this.increment(); 503 } 504 else { 505 this.decrement(); 506 } 507 }, 508 509 /** 510 * Increments the value of the clock face 511 */ 512 513 increment: function() { 514 this.factory.time.addSecond(); 515 }, 516 517 /** 518 * Decrements the value of the clock face 519 */ 520 521 decrement: function() { 522 if(this.factory.time.getTimeSeconds() == 0) { 523 this.factory.stop() 524 } 525 else { 526 this.factory.time.subSecond(); 527 } 528 }, 529 530 /** 531 * Triggers when the numbers on the clock flip 532 */ 533 534 flip: function(time, doNotAddPlayClass) { 535 var t = this; 536 537 $.each(time, function(i, digit) { 538 var list = t.lists[i]; 539 540 if(list) { 541 if(!doNotAddPlayClass && digit != list.digit) { 542 list.play(); 543 } 544 545 list.select(digit); 546 } 547 else { 548 t.addDigit(digit); 549 } 550 }); 551 } 552 553 }); 554 555}(jQuery)); 556 557/*jshint smarttabs:true */ 558 559/** 560 * FlipClock.js 561 * 562 * @author Justin Kimbrell 563 * @copyright 2013 - Objective HTML, LLC 564 * @licesnse http://www.opensource.org/licenses/mit-license.php 565 */ 566 567(function($) { 568 569 "use strict"; 570 571 /** 572 * The FlipClock Factory class is used to build the clock and manage 573 * all the public methods. 574 * 575 * @param object A jQuery object or CSS selector used to fetch 576 the wrapping DOM nodes 577 * @param mixed This is the digit used to set the clock. If an 578 object is passed, 0 will be used. 579 * @param object An object of properties to override the default 580 */ 581 582 FlipClock.Factory = FlipClock.Base.extend({ 583 584 /** 585 * The clock's animation rate. 586 * 587 * Note, currently this property doesn't do anything. 588 * This property is here to be used in the future to 589 * programmaticaly set the clock's animation speed 590 */ 591 592 animationRate: 1000, 593 594 /** 595 * Auto start the clock on page load (True|False) 596 */ 597 598 autoStart: true, 599 600 /** 601 * The callback methods 602 */ 603 604 callbacks: { 605 destroy: false, 606 create: false, 607 init: false, 608 interval: false, 609 start: false, 610 stop: false, 611 reset: false 612 }, 613 614 /** 615 * The CSS classes 616 */ 617 618 classes: { 619 active: 'flip-clock-active', 620 before: 'flip-clock-before',
621 divider: 'flip-clock-divider', 622 dot: 'flip-clock-dot', 623 label: 'flip-clock-label', 624 flip: 'flip', 625 play: 'play', 626 wrapper: 'flip-clock-wrapper' 627 }, 628 629 /** 630 * The name of the clock face class in use 631 */ 632 633 clockFace: 'HourlyCounter', 634 635 /** 636 * The name of the clock face class in use 637 */ 638 639 countdown: false, 640 641 /** 642 * The name of the default clock face class to use if the defined 643 * clockFace variable is not a valid FlipClock.Face object 644 */ 645 646 defaultClockFace: 'HourlyCounter', 647 648 /** 649 * The default language 650 */ 651 652 defaultLanguage: 'english', 653 654 /** 655 * The jQuery object 656 */ 657 658 $el: false, 659 660 /** 661 * The FlipClock.Face object 662 */ 663 664 face: true, 665 666 /** 667 * The language object after it has been loaded 668 */ 669 670 lang: false, 671 672 /** 673 * The language being used to display labels (string) 674 */ 675 676 language: 'english', 677 678 /** 679 * The minimum digits the clock must have 680 */ 681 682 minimumDigits: 0, 683 684 /** 685 * The original starting value of the clock. Used for the reset method. 686 */ 687 688 original: false, 689 690 /** 691 * Is the clock running? (True|False) 692 */ 693 694 running: false, 695 696 /** 697 * The FlipClock.Time object 698 */ 699 700 time: false, 701 702 /** 703 * The FlipClock.Timer object 704 */ 705 706 timer: false, 707 708 /** 709 * The jQuery object (depcrecated) 710 */ 711 712 $wrapper: false, 713 714 /** 715 * Constructor 716 * 717 * @param object The wrapping jQuery object 718 * @param object Number of seconds used to start the clock 719 * @param object An object override options 720 */ 721 722 constructor: function(obj, digit, options) { 723 724 if(!options) { 725 options = {}; 726 } 727 728 this.lists = []; 729 this.running = false; 730 this.base(options); 731 732 this.$el = $(obj).addClass(this.classes.wrapper); 733 734 // Depcrated support of the $wrapper property. 735 this.$wrapper = this.$el; 736 737 this.original = (digit instanceof Date) ? digit : (digit ? Math.round(digit) : 0); 738 739 this.time = new FlipClock.Time(this, this.original, { 740 minimumDigits: this.minimumDigits, 741 animationRate: this.animationRate 742 }); 743 744 this.timer = new FlipClock.Timer(this, options); 745 746 this.loadLanguage(this.language); 747 748 this.loadClockFace(this.clockFace, options); 749 750 if(this.autoStart) { 751 this.start(); 752 } 753 754 }, 755 756 /** 757 * Load the FlipClock.Face object 758 * 759 * @param object The name of the FlickClock.Face class 760 * @param object An object override options 761 */ 762 763 loadClockFace: function(name, options) { 764 var face, suffix = 'Face', hasStopped = false; 765 766 name = name.ucfirst()+suffix; 767 768 if(this.face.stop) { 769 this.stop(); 770 hasStopped = true; 771 } 772 773 this.$el.html(''); 774 775 this.time.minimumDigits = this.minimumDigits; 776 777 if(FlipClock[name]) { 778 face = new FlipClock[name](this, options); 779 } 780 else { 781 face = new FlipClock[this.defaultClockFace+suffix](this, options); 782 } 783 784 face.build(); 785 786 this.face = face 787 788 if(hasStopped) { 789 this.start(); 790 } 791 792 return this.face; 793 }, 794 795 /** 796 * Load the FlipClock.Lang object 797 * 798 * @param object The name of the language to load 799 */ 800 801 loadLanguage: function(name) { 802 var lang; 803 804 if(FlipClock.Lang[name.ucfirst()]) { 805 lang = FlipClock.Lang[name.ucfirst()]; 806 } 807 else if(FlipClock.Lang[name]) { 808 lang = FlipClock.Lang[name]; 809 } 810 else { 811 lang = FlipClock.Lang[this.defaultLanguage]; 812 } 813 814 return this.lang = lang; 815 }, 816 817 /** 818 * Localize strings into various languages 819 * 820 * @param string The index of the localized string 821 * @param object Optionally pass a lang object 822 */ 823 824 localize: function(index, obj) { 825 var lang = this.lang; 826 827 if(!index) { 828 return null; 829 } 830 831 var lindex = index.toLowerCase(); 832 833 if(typeof obj == "object") { 834 lang = obj; 835 } 836 837 if(lang && lang[lindex]) { 838 return lang[lindex]; 839 } 840 841 return index; 842 }, 843 844 845 /** 846 * Starts the clock 847 */ 848 849 start: function(callback) { 850 var t = this; 851 852 if(!t.running && (!t.countdown || t.countdown && t.time.time > 0)) { 853 t.face.start(t.time); 854 t.timer.start(function() { 855 t.flip();
856 857 if(typeof callback === "function") { 858 callback(); 859 } 860 }); 861 } 862 else { 863 t.log('Trying to start timer when countdown already at 0'); 864 } 865 }, 866 867 /** 868 * Stops the clock 869 */ 870 871 stop: function(callback) { 872 this.face.stop(); 873 this.timer.stop(callback); 874 875 for(var x in this.lists) { 876 if (this.lists.hasOwnProperty(x)) { 877 this.lists[x].stop(); 878 } 879 } 880 }, 881 882 /** 883 * Reset the clock 884 */ 885 886 reset: function(callback) { 887 this.timer.reset(callback); 888 this.face.reset(); 889 }, 890 891 /** 892 * Sets the clock time 893 */ 894 895 setTime: function(time) { 896 this.time.time = time; 897 this.flip(true); 898 }, 899 900 /** 901 * Get the clock time 902 * 903 * @return object Returns a FlipClock.Time object 904 */ 905 906 getTime: function(time) { 907 return this.time; 908 }, 909 910 /** 911 * Changes the increment of time to up or down (add/sub) 912 */ 913 914 setCountdown: function(value) { 915 var running = this.running; 916 917 this.countdown = value ? true : false; 918 919 if(running) { 920 this.stop(); 921 this.start(); 922 } 923 }, 924 925 /** 926 * Flip the digits on the clock 927 * 928 * @param array An array of digits 929 */ 930 flip: function(doNotAddPlayClass) { 931 this.face.flip(false, doNotAddPlayClass); 932 } 933 934 }); 935 936}(jQuery)); 937 938/*jshint smarttabs:true */ 939 940/** 941 * FlipClock.js 942 * 943 * @author Justin Kimbrell 944 * @copyright 2013 - Objective HTML, LLC 945 * @licesnse http://www.opensource.org/licenses/mit-license.php 946 */ 947 948(function($) { 949 950 "use strict"; 951 952 /** 953 * The FlipClock List class is used to build the list used to create 954 * the card flip effect. This object fascilates selecting the correct 955 * node by passing a specific digit. 956 * 957 * @param object A FlipClock.Factory object 958 * @param mixed This is the digit used to set the clock. If an 959 * object is passed, 0 will be used. 960 * @param object An object of properties to override the default 961 */ 962 963 FlipClock.List = FlipClock.Base.extend({ 964 965 /** 966 * The digit (0-9) 967 */ 968 969 digit: 0, 970 971 /** 972 * The CSS classes 973 */ 974 975 classes: { 976 active: 'flip-clock-active', 977 before: 'flip-clock-before', 978 flip: 'flip' 979 }, 980 981 /** 982 * The parent FlipClock.Factory object 983 */ 984 985 factory: false, 986 987 /** 988 * The jQuery object 989 */ 990 991 $el: false, 992 993 /** 994 * The jQuery object (deprecated) 995 */ 996 997 $obj: false, 998 999 /** 1000 * The items in the list 1001 */ 1002 1003 items: [], 1004 1005 /** 1006 * The last digit 1007 */ 1008 1009 lastDigit: 0, 1010 1011 /** 1012 * Constructor 1013 * 1014 * @param object A FlipClock.Factory object 1015 * @param int An integer use to select the correct digit 1016 * @param object An object to override the default properties 1017 */ 1018 1019 constructor: function(factory, digit, options) { 1020 this.factory = factory; 1021 this.digit = digit; 1022 this.lastDigit = digit;
1023 this.$el = this.createList(); 1024 1025 // Depcrated support of the $obj property. 1026 this.$obj = this.$el; 1027 1028 if(digit > 0) { 1029 this.select(digit); 1030 } 1031 1032 this.factory.$el.append(this.$el); 1033 }, 1034 1035 /** 1036 * Select the digit in the list 1037 * 1038 * @param int A digit 0-9 1039 */ 1040 1041 select: function(digit) { 1042 if(typeof digit === "undefined") { 1043 digit = this.digit; 1044 } 1045 else { 1046 this.digit = digit; 1047 } 1048 1049 if(this.digit != this.lastDigit) { 1050 var $delete = this.$el.find('.'+this.classes.before).removeClass(this.classes.before); 1051 1052 this.$el.find('.'+this.classes.active).removeClass(this.classes.active) 1053 .addClass(this.classes.before); 1054 1055 this.appendListItem(this.classes.active, this.digit); 1056 1057 $delete.remove(); 1058 1059 this.lastDigit = this.digit; 1060 } 1061 }, 1062 1063 /** 1064 * Adds the play class to the DOM object 1065 */ 1066 1067 play: function() { 1068 this.$el.addClass(this.factory.classes.play); 1069 }, 1070 1071 /** 1072 * Removes the play class to the DOM object 1073 */ 1074 1075 stop: function() { 1076 var t = this; 1077 1078 setTimeout(function() { 1079 t.$el.removeClass(t.factory.classes.play); 1080 }, this.factory.timer.interval); 1081 }, 1082 1083 /** 1084 * Creates the list item HTML and returns as a string 1085 */ 1086 1087 createListItem: function(css, value) { 1088 return [ 1089 '<li class="'+(css ? css : '')+'">', 1090 '<a href="#">', 1091 '<div class="up">', 1092 '<div class="shadow"></div>', 1093 '<div class="inn">'+(value ? value : '')+'</div>', 1094 '</div>', 1095 '<div class="down">', 1096 '<div class="shadow"></div>', 1097 '<div class="inn">'+(value ? value : '')+'</div>', 1098 '</div>', 1099 '</a>', 1100 '</li>' 1101 ].join(''); 1102 }, 1103 1104 /** 1105 * Append the list item to the parent DOM node 1106 */ 1107 1108 appendListItem: function(css, value) { 1109 var html = this.createListItem(css, value); 1110 1111 this.$el.append(html); 1112 }, 1113 1114 /** 1115 * Create the list of digits and appends it to the DOM object 1116 */ 1117 1118 createList: function() { 1119 1120 var lastDigit = this.getPrevDigit() ? this.getPrevDigit() : this.digit; 1121 1122 var html = $([ 1123 '<ul class="'+this.classes.flip+' '+(this.factory.running ? this.factory.classes.play : '')+'">', 1124 this.createListItem(this.classes.before, lastDigit), 1125 this.createListItem(this.classes.active, this.digit), 1126 '</ul>' 1127 ].join('')); 1128 1129 return html; 1130 }, 1131 1132 getNextDigit: function() { 1133 return this.digit == 9 ? 0 : this.digit + 1; 1134 }, 1135 1136 getPrevDigit: function() { 1137 return this.digit == 0 ? 9 : this.digit - 1; 1138 } 1139 1140 }); 1141 1142 1143}(jQuery)); 1144 1145/*jshint smarttabs:true */ 1146 1147/** 1148 * FlipClock.js 1149 * 1150 * @author Justin Kimbrell 1151 * @copyright 2013 - Objective HTML, LLC 1152 * @licesnse http://www.opensource.org/licenses/mit-license.php 1153 */ 1154 1155(function($) { 1156 1157 "use strict"; 1158 1159 /** 1160 * Capitalize the first letter in a string 1161 * 1162 * @return string 1163 */ 1164 1165 String.prototype.ucfirst = function() { 1166 return this.substr(0, 1).toUpperCase() + this.substr(1); 1167 }; 1168 1169 /** 1170 * jQuery helper method 1171 * 1172 * @param int An integer used to start the clock (no. seconds) 1173 * @param object An object of properties to override the default 1174 */ 1175 1176 $.fn.FlipClock = function(digit, options) { 1177 return new FlipClock($(this), digit, options); 1178 }; 1179 1180 /** 1181 * jQuery helper method 1182 * 1183 * @param int An integer used to start the clock (no. seconds) 1184 * @param object An object of properties to override the default 1185 */ 1186 1187 $.fn.flipClock = function(digit, options) { 1188 return $.fn.FlipClock(digit, options); 1189 }; 1190 1191}(jQuery)); 1192 1193/*jshint smarttabs:true */ 1194 1195/** 1196 * FlipClock.js 1197 * 1198 * @author Justin Kimbrell 1199 * @copyright 2013 - Objective HTML, LLC 1200 * @licesnse http://www.opensource.org/licenses/mit-license.php 1201 */ 1202 1203(function($) { 1204 1205 "use strict"; 1206 1207 /** 1208 * The FlipClock Time class is used to manage all the time 1209 * calculations. 1210 * 1211 * @param object A FlipClock.Factory object 1212 * @param mixed This is the digit used to set the clock. If an 1213 * object is passed, 0 will be used. 1214 * @param object An object of properties to override the default 1215 */ 1216 1217 FlipClock.Time = FlipClock.Base.extend({ 1218 1219 /** 1220 * The time (in seconds) or a date object 1221 */ 1222 1223 time: 0, 1224 1225 /** 1226 * The parent FlipClock.Factory object 1227 */ 1228 1229 factory: false, 1230 1231 /** 1232 * The minimum number of digits the clock face must have 1233 */ 1234 1235 minimumDigits: 0, 1236 1237 /** 1238 * Constructor 1239 * 1240 * @param object A FlipClock.Factory object 1241 * @param int An integer use to select the correct digit 1242 * @param object An object to override the default properties 1243 */ 1244 1245 constructor: function(factory, time, options) { 1246 if(typeof options != "object") { 1247 options = {}; 1248 } 1249 1250 if(!options.minimumDigits) { 1251 options.minimumDigits = factory.minimumDigits; 1252 } 1253 1254 this.base(options); 1255 this.factory = factory; 1256 1257 if(time) { 1258 this.time = time; 1259 } 1260 }, 1261 1262 /** 1263 * Convert a string or integer to an array of digits 1264 * 1265 * @param mixed String or Integer of digits 1266 * @return array An array of digits 1267 */ 1268 1269 convertDigitsToArray: function(str) { 1270 var data = []; 1271 1272 str = str.toString(); 1273 1274 for(var x = 0;x < str.length; x++) {
1275 if(str[x].match(/^\d*$/g)) { 1276 data.push(str[x]); 1277 } 1278 } 1279 1280 return data; 1281 }, 1282 1283 /** 1284 * Get a specific digit from the time integer 1285 * 1286 * @param int The specific digit to select from the time 1287 * @return mixed Returns FALSE if no digit is found, otherwise 1288 * the method returns the defined digit 1289 */ 1290 1291 digit: function(i) { 1292 var timeStr = this.toString(); 1293 var length = timeStr.length; 1294 1295 if(timeStr[length - i]) { 1296 return timeStr[length - i]; 1297 } 1298 1299 return false; 1300 }, 1301 1302 /** 1303 * Formats any array of digits into a valid array of digits 1304 * 1305 * @param mixed An array of digits 1306 * @return array An array of digits 1307 */ 1308 1309 digitize: function(obj) { 1310 var data = []; 1311 1312 $.each(obj, function(i, value) { 1313 value = value.toString(); 1314 1315 if(value.length == 1) { 1316 value = '0'+value; 1317 } 1318 1319 for(var x = 0; x < value.length; x++) { 1320 data.push(value.charAt(x)); 1321 } 1322 }); 1323 1324 if(data.length > this.minimumDigits) { 1325 this.minimumDigits = data.length; 1326 } 1327 1328 if(this.minimumDigits > data.length) { 1329 for(var x = data.length; x < this.minimumDigits; x++) { 1330 data.unshift('0'); 1331 } 1332 } 1333 1334 return data; 1335 }, 1336 1337 /** 1338 * Gets a new Date object for the current time 1339 * 1340 * @return array Returns a Date object 1341 */ 1342 1343 getDateObject: function() { 1344 if(this.time instanceof Date) { 1345 return this.time; 1346 } 1347 1348 return new Date((new Date()).getTime() + this.getTimeSeconds() * 1000); 1349 }, 1350 1351 /** 1352 * Gets a digitized daily counter 1353 * 1354 * @return object Returns a digitized object 1355 */ 1356 1357 getDayCounter: function(includeSeconds) { 1358 var digits = [ 1359 this.getDays(), 1360 this.getHours(true), 1361 this.getMinutes(true) 1362 ]; 1363 1364 if(includeSeconds) { 1365 digits.push(this.getSeconds(true)); 1366 } 1367 1368 return this.digitize(digits); 1369 }, 1370 1371 /** 1372 * Gets number of days 1373 * 1374 * @param bool Should perform a modulus? If not sent, then no. 1375 * @return int Retuns a floored integer 1376 */ 1377 1378 getDays: function(mod) { 1379 var days = this.getTimeSeconds() / 60 / 60 / 24; 1380 1381 if(mod) { 1382 days = days % 7; 1383 } 1384 1385 return Math.floor(days); 1386 }, 1387 1388 /** 1389 * Gets an hourly breakdown 1390 * 1391 * @return object Returns a digitized object 1392 */ 1393 1394 getHourCounter: function() { 1395 var obj = this.digitize([ 1396 this.getHours(), 1397 this.getMinutes(true),
1398 this.getSeconds(true) 1399 ]); 1400 1401 return obj; 1402 }, 1403 1404 /** 1405 * Gets an hourly breakdown 1406 * 1407 * @return object Returns a digitized object 1408 */ 1409 1410 getHourly: function() { 1411 return this.getHourCounter(); 1412 }, 1413 1414 /** 1415 * Gets number of hours 1416 * 1417 * @param bool Should perform a modulus? If not sent, then no. 1418 * @return int Retuns a floored integer 1419 */ 1420 1421 getHours: function(mod) { 1422 var hours = this.getTimeSeconds() / 60 / 60; 1423 1424 if(mod) { 1425 hours = hours % 24; 1426 } 1427 1428 return Math.floor(hours); 1429 }, 1430 1431 /** 1432 * Gets the twenty-four hour time 1433 * 1434 * @return object returns a digitized object 1435 */ 1436 1437 getMilitaryTime: function(date, showSeconds) { 1438 if(typeof showSeconds === "undefined") { 1439 showSeconds = true; 1440 } 1441 1442 if(!date) { 1443 date = this.getDateObject(); 1444 } 1445 1446 var data = [ 1447 date.getHours(), 1448 date.getMinutes() 1449 ]; 1450 1451 if(showSeconds === true) { 1452 data.push(date.getSeconds()); 1453 } 1454 1455 return this.digitize(data); 1456 }, 1457 1458 /** 1459 * Gets number of minutes 1460 * 1461 * @param bool Should perform a modulus? If not sent, then no. 1462 * @return int Retuns a floored integer 1463 */ 1464 1465 getMinutes: function(mod) { 1466 var minutes = this.getTimeSeconds() / 60; 1467 1468 if(mod) { 1469 minutes = minutes % 60; 1470 } 1471 1472 return Math.floor(minutes); 1473 }, 1474 1475 /** 1476 * Gets a minute breakdown 1477 */ 1478 1479 getMinuteCounter: function() { 1480 var obj = this.digitize([ 1481 this.getMinutes(),
1482 this.getSeconds(true) 1483 ]); 1484 1485 return obj; 1486 }, 1487 1488 /** 1489 * Gets time count in seconds regardless of if targetting date or not. 1490 * 1491 * @return int Returns a floored integer 1492 */ 1493 1494 getTimeSeconds: function(date) { 1495 if(!date) { 1496 date = new Date(); 1497 } 1498 1499 if (this.time instanceof Date) { 1500 if (this.factory.countdown) { 1501 return Math.max(this.time.getTime()/1000 - date.getTime()/1000,0); 1502 } else { 1503 return date.getTime()/1000 - this.time.getTime()/1000 ; 1504 } 1505 } else { 1506 return this.time; 1507 } 1508 }, 1509 1510 /** 1511 * Gets the current twelve hour time 1512 * 1513 * @return object Returns a digitized object 1514 */ 1515 1516 getTime: function(date, showSeconds) { 1517 if(typeof showSeconds === "undefined") { 1518 showSeconds = true; 1519 } 1520 1521 if(!date) { 1522 date = this.getDateObject(); 1523 } 1524 1525 console.log(date); 1526 1527 1528 var hours = date.getHours(); 1529 var merid = hours > 12 ? 'PM' : 'AM'; 1530 var data = [ 1531 hours > 12 ? hours - 12 : (hours === 0 ? 12 : hours), 1532 date.getMinutes() 1533 ]; 1534 1535 if(showSeconds === true) { 1536 data.push(date.getSeconds()); 1537 } 1538 1539 return this.digitize(data); 1540 }, 1541 1542 /** 1543 * Gets number of seconds 1544 * 1545 * @param bool Should perform a modulus? If not sent, then no. 1546 * @return int Retuns a ceiled integer 1547 */ 1548 1549 getSeconds: function(mod) { 1550 var seconds = this.getTimeSeconds(); 1551 1552 if(mod) { 1553 if(seconds == 60) { 1554 seconds = 0; 1555 } 1556 else { 1557 seconds = seconds % 60; 1558 } 1559 } 1560 1561 return Math.ceil(seconds); 1562 }, 1563 1564 /** 1565 * Gets number of weeks 1566 * 1567 * @param bool Should perform a modulus? If not sent, then no. 1568 * @return int Retuns a floored integer 1569 */ 1570 1571 getWeeks: function(mod) { 1572 var weeks = this.getTimeSeconds() / 60 / 60 / 24 / 7; 1573 1574 if(mod) { 1575 weeks = weeks % 52; 1576 } 1577 1578 return Math.floor(weeks); 1579 }, 1580 1581 /** 1582 * Removes a specific number of leading zeros from the array. 1583 * This method prevents you from removing too many digits, even 1584 * if you try. 1585 * 1586 * @param int Total number of digits to remove 1587 * @return array An array of digits 1588 */ 1589 1590 removeLeadingZeros: function(totalDigits, digits) { 1591 var total = 0; 1592 var newArray = []; 1593 1594 $.each(digits, function(i, digit) { 1595 if(i < totalDigits) { 1596 total += parseInt(digits[i], 10); 1597 } 1598 else { 1599 newArray.push(digits[i]); 1600 } 1601 }); 1602 1603 if(total === 0) { 1604 return newArray; 1605 } 1606 1607 return digits; 1608 }, 1609 1610 /** 1611 * Adds X second to the current time 1612 */ 1613 1614 addSeconds: function(x) { 1615 if(this.time instanceof Date) { 1616 this.time.setSeconds(this.time.getSeconds() + x); 1617 } 1618 else { 1619 this.time += x; 1620 } 1621 }, 1622 1623 /** 1624 * Adds 1 second to the current time 1625 */ 1626 1627 addSecond: function() { 1628 this.addSeconds(1); 1629 }, 1630 1631 /** 1632 * Substracts X seconds from the current time 1633 */ 1634 1635 subSeconds: function(x) { 1636 if(this.time instanceof Date) { 1637 this.time.setSeconds(this.time.getSeconds() - x); 1638 } 1639 else { 1640 this.time -= x; 1641 } 1642 }, 1643 1644 /** 1645 * Substracts 1 second from the current time 1646 */ 1647 1648 subSecond: function() { 1649 this.subSeconds(1); 1650 }, 1651 1652 /** 1653 * Converts the object to a human readable string 1654 */ 1655 1656 toString: function() { 1657 return this.getTimeSeconds().toString(); 1658 } 1659 1660 /* 1661 getYears: function() { 1662 return Math.floor(this.time / 60 / 60 / 24 / 7 / 52); 1663 }, 1664 1665 getDecades: function() { 1666 return Math.floor(this.getWeeks() / 10); 1667 }*/ 1668 }); 1669 1670}(jQuery)); 1671 1672/*jshint smarttabs:true */ 1673 1674/** 1675 * FlipClock.js 1676 * 1677 * @author Justin Kimbrell 1678 * @copyright 2013 - Objective HTML, LLC 1679 * @licesnse http://www.opensource.org/licenses/mit-license.php 1680 */ 1681 1682(function($) { 1683 1684 "use strict"; 1685 1686 /** 1687 * The FlipClock.Timer object managers the JS timers 1688 * 1689 * @param object The parent FlipClock.Factory object 1690 * @param object Override the default options 1691 */ 1692 1693 FlipClock.Timer = FlipClock.Base.extend({ 1694 1695 /** 1696 * Callbacks 1697 */ 1698 1699 callbacks: { 1700 destroy: false, 1701 create: false, 1702 init: false, 1703 interval: false, 1704 start: false, 1705 stop: false, 1706 reset: false 1707 }, 1708 1709 /** 1710 * FlipClock timer count (how many intervals have passed) 1711 */ 1712 1713 count: 0, 1714 1715 /** 1716 * The parent FlipClock.Factory object 1717 */ 1718 1719 factory: false, 1720 1721 /**
1722 * Timer interval (1 second by default) 1723 */ 1724 1725 interval: 1000, 1726 1727 /** 1728 * The rate of the animation in milliseconds (not currently in use) 1729 */ 1730 1731 animationRate: 1000, 1732 1733 /** 1734 * Constructor 1735 * 1736 * @return void 1737 */ 1738 1739 constructor: function(factory, options) { 1740 this.base(options); 1741 this.factory = factory; 1742 this.callback(this.callbacks.init); 1743 this.callback(this.callbacks.create); 1744 }, 1745 1746 /** 1747 * This method gets the elapsed the time as an interger 1748 * 1749 * @return void 1750 */ 1751 1752 getElapsed: function() { 1753 return this.count * this.interval; 1754 }, 1755 1756 /** 1757 * This method gets the elapsed the time as a Date object 1758 * 1759 * @return void 1760 */ 1761 1762 getElapsedTime: function() { 1763 return new Date(this.time + this.getElapsed()); 1764 }, 1765 1766 /** 1767 * This method is resets the timer 1768 * 1769 * @param callback This method resets the timer back to 0 1770 * @return void 1771 */ 1772 1773 reset: function(callback) { 1774 clearInterval(this.timer); 1775 this.count = 0; 1776 this._setInterval(callback); 1777 this.callback(this.callbacks.reset); 1778 }, 1779 1780 /** 1781 * This method is starts the timer 1782 * 1783 * @param callback A function that is called once the timer is destroyed 1784 * @return void 1785 */ 1786 1787 start: function(callback) { 1788 this.factory.running = true; 1789 this._createTimer(callback); 1790 this.callback(this.callbacks.start); 1791 }, 1792 1793 /** 1794 * This method is stops the timer 1795 * 1796 * @param callback A function that is called once the timer is destroyed 1797 * @return void 1798 */ 1799 1800 stop: function(callback) { 1801 this.factory.running = false; 1802 this._clearInterval(callback); 1803 this.callback(this.callbacks.stop); 1804 this.callback(callback); 1805 }, 1806 1807 /** 1808 * Clear the timer interval 1809 * 1810 * @return void 1811 */ 1812 1813 _clearInterval: function() { 1814 clearInterval(this.timer); 1815 }, 1816 1817 /** 1818 * Create the timer object 1819 * 1820 * @param callback A function that is called once the timer is created 1821 * @return void 1822 */ 1823 1824 _createTimer: function(callback) { 1825 this._setInterval(callback); 1826 }, 1827 1828 /** 1829 * Destroy the timer object 1830 * 1831 * @param callback A function that is called once the timer is destroyed 1832 * @return void 1833 */ 1834 1835 _destroyTimer: function(callback) { 1836 this._clearInterval(); 1837 this.timer = false; 1838 this.callback(callback); 1839 this.callback(this.callbacks.destroy); 1840 }, 1841 1842 /** 1843 * This method is called each time the timer interval is ran 1844 * 1845 * @param callback A function that is called once the timer is destroyed 1846 * @return void 1847 */ 1848 1849 _interval: function(callback) { 1850 this.callback(this.callbacks.interval); 1851 this.callback(callback); 1852 this.count++; 1853 }, 1854 1855 /** 1856 * This sets the timer interval 1857 * 1858 * @param callback A function that is called once the timer is destroyed 1859 * @return void 1860 */ 1861 1862 _setInterval: function(callback) { 1863 var t = this; 1864 1865 t._interval(callback); 1866 1867 t.timer = setInterval(function() { 1868 t._interval(callback); 1869 }, this.interval); 1870 } 1871 1872 }); 1873 1874}(jQuery)); 1875 1876(function($) { 1877 1878 /** 1879 * Twenty-Four Hour Clock Face 1880 * 1881 * This class will generate a twenty-four our clock for FlipClock.js 1882 * 1883 * @param object The parent FlipClock.Factory object 1884 * @param object An object of properties to override the default 1885 */ 1886 1887 FlipClock.TwentyFourHourClockFace = FlipClock.Face.extend({ 1888 1889 /** 1890 * Constructor 1891 * 1892 * @param object The parent FlipClock.Factory object 1893 * @param object An object of properties to override the default 1894 */ 1895 1896 constructor: function(factory, options) { 1897 this.base(factory, options); 1898 }, 1899 1900 /** 1901 * Build the clock face 1902 * 1903 * @param object Pass the time that should be used to display on the clock. 1904 */ 1905 1906 build: function(time) { 1907 var t = this; 1908 var children = this.factory.$el.find('ul'); 1909 1910 if(!this.factory.time.time) { 1911 this.factory.original = new Date(); 1912 1913 this.factory.time = new FlipClock.Time(this.factory, this.factory.original); 1914 } 1915 1916 var time = time ? time : this.factory.time.getMilitaryTime(false, this.showSeconds); 1917 1918 if(time.length > children.length) { 1919 $.each(time, function(i, digit) { 1920 t.createList(digit); 1921 }); 1922 } 1923 1924 this.createDivider(); 1925 this.createDivider(); 1926 1927 $(this.dividers[0]).insertBefore(this.lists[this.lists.length - 2].$el); 1928 $(this.dividers[1]).insertBefore(this.lists[this.lists.length - 4].$el); 1929 1930 this.base(); 1931 }, 1932 1933 /** 1934 * Flip the clock face 1935 */ 1936 1937 flip: function(time, doNotAddPlayClass) { 1938 this.autoIncrement(); 1939 1940 time = time ? time : this.factory.time.getMilitaryTime(false, this.showSeconds); 1941 1942 this.base(time, doNotAddPlayClass); 1943 } 1944 1945 }); 1946 1947}(jQuery)); 1948(function($) { 1949 1950 /** 1951 * Counter Clock Face 1952 * 1953 * This class will generate a generice flip counter. The timer has been
1954 * disabled. clock.increment() and clock.decrement() have been added. 1955 * 1956 * @param object The parent FlipClock.Factory object 1957 * @param object An object of properties to override the default 1958 */ 1959 1960 FlipClock.CounterFace = FlipClock.Face.extend({ 1961 1962 /** 1963 * Tells the counter clock face if it should auto-increment 1964 */ 1965 1966 shouldAutoIncrement: false, 1967 1968 /** 1969 * Constructor 1970 * 1971 * @param object The parent FlipClock.Factory object 1972 * @param object An object of properties to override the default 1973 */ 1974 1975 constructor: function(factory, options) { 1976 1977 if(typeof options != "object") { 1978 options = {}; 1979 } 1980 1981 factory.autoStart = options.autoStart ? true : false; 1982 1983 if(options.autoStart) { 1984 this.shouldAutoIncrement = true; 1985 } 1986 1987 factory.increment = function() { 1988 factory.countdown = false; 1989 factory.setTime(factory.getTime().getTimeSeconds() + 1); 1990 }; 1991 1992 factory.decrement = function() { 1993 factory.countdown = true; 1994 var time = factory.getTime().getTimeSeconds(); 1995 if(time > 0) { 1996 factory.setTime(time - 1); 1997 } 1998 }; 1999 2000 factory.setValue = function(digits) { 2001 factory.setTime(digits); 2002 }; 2003 2004 factory.setCounter = function(digits) { 2005 factory.setTime(digits); 2006 }; 2007 2008 this.base(factory, options); 2009 }, 2010 2011 /** 2012 * Build the clock face 2013 */ 2014 2015 build: function() { 2016 var t = this; 2017 var children = this.factory.$el.find('ul'); 2018 var time = this.factory.getTime().digitize([this.factory.getTime().time]); 2019 2020 if(time.length > children.length) { 2021 $.each(time, function(i, digit) { 2022 var list = t.createList(digit); 2023 2024 list.select(digit); 2025 }); 2026 2027 } 2028 2029 $.each(this.lists, function(i, list) { 2030 list.play(); 2031 }); 2032 2033 this.base(); 2034 }, 2035 2036 /** 2037 * Flip the clock face 2038 */ 2039 2040 flip: function(time, doNotAddPlayClass) { 2041 if(this.shouldAutoIncrement) { 2042 this.autoIncrement(); 2043 } 2044 2045 if(!time) { 2046 time = this.factory.getTime().digitize([this.factory.getTime().time]); 2047 } 2048 2049 this.base(time, doNotAddPlayClass); 2050 }, 2051 2052 /** 2053 * Reset the clock face 2054 */ 2055 2056 reset: function() { 2057 this.factory.time = new FlipClock.Time( 2058 this.factory, 2059 this.factory.original ? Math.round(this.factory.original) : 0 2060 ); 2061 2062 this.flip();
2063 } 2064 }); 2065 2066}(jQuery)); 2067(function($) { 2068 2069 /** 2070 * Daily Counter Clock Face 2071 * 2072 * This class will generate a daily counter for FlipClock.js. A 2073 * daily counter will track days, hours, minutes, and seconds. If 2074 * the number of available digits is exceeded in the count, a new 2075 * digit will be created. 2076 * 2077 * @param object The parent FlipClock.Factory object 2078 * @param object An object of properties to override the default 2079 */ 2080 2081 FlipClock.DailyCounterFace = FlipClock.Face.extend({ 2082 2083 showSeconds: true, 2084 2085 /** 2086 * Constructor 2087 * 2088 * @param object The parent FlipClock.Factory object 2089 * @param object An object of properties to override the default 2090 */ 2091 2092 constructor: function(factory, options) { 2093 this.base(factory, options); 2094 }, 2095 2096 /** 2097 * Build the clock face 2098 */ 2099 2100 build: function(time) { 2101 var t = this; 2102 var children = this.factory.$el.find('ul'); 2103 var offset = 0; 2104 2105 time = time ? time : this.factory.time.getDayCounter(this.showSeconds); 2106 2107 if(time.length > children.length) { 2108 $.each(time, function(i, digit) { 2109 t.createList(digit); 2110 }); 2111 } 2112 2113 if(this.showSeconds) { 2114 $(this.createDivider('Seconds')).insertBefore(this.lists[this.lists.length - 2].$el); 2115 } 2116 else 2117 { 2118 offset = 2; 2119 } 2120 2121 $(this.createDivider('Minutes')).insertBefore(this.lists[this.lists.length - 4 + offset].$el); 2122 $(this.createDivider('Hours')).insertBefore(this.lists[this.lists.length - 6 + offset].$el); 2123 $(this.createDivider('Days', true)).insertBefore(this.lists[0].$el); 2124 2125 this.base(); 2126 }, 2127 2128 /** 2129 * Flip the clock face 2130 */ 2131 2132 flip: function(time, doNotAddPlayClass) { 2133 if(!time) { 2134 time = this.factory.time.getDayCounter(this.showSeconds); 2135 } 2136 2137 this.autoIncrement(); 2138 2139 this.base(time, doNotAddPlayClass); 2140 } 2141 2142 }); 2143 2144}(jQuery)); 2145(function($) { 2146 2147 /** 2148 * Hourly Counter Clock Face 2149 * 2150 * This class will generate an hourly counter for FlipClock.js. An 2151 * hour counter will track hours, minutes, and seconds. If number of 2152 * available digits is exceeded in the count, a new digit will be 2153 * created. 2154 * 2155 * @param object The parent FlipClock.Factory object 2156 * @param object An object of properties to override the default 2157 */ 2158 2159 FlipClock.HourlyCounterFace = FlipClock.Face.extend({ 2160 2161 // clearExcessDigits: true, 2162 2163 /** 2164 * Constructor 2165 * 2166 * @param object The parent FlipClock.Factory object 2167 * @param object An object of properties to override the default 2168 */ 2169 2170 constructor: function(factory, options) { 2171 this.base(factory, options); 2172 }, 2173 2174 /** 2175 * Build the clock face 2176 */ 2177 2178 build: function(excludeHours, time) { 2179 var t = this; 2180 var children = this.factory.$el.find('ul'); 2181 2182 time = time ? time : this.factory.time.getHourCounter(); 2183 2184 if(time.length > children.length) { 2185 $.each(time, function(i, digit) { 2186 t.createList(digit); 2187 }); 2188 } 2189 2190 $(this.createDivider('Seconds')).insertBefore(this.lists[this.lists.length - 2].$el); 2191 $(this.createDivider('Minutes')).insertBefore(this.lists[this.lists.length - 4].$el); 2192 2193 if(!excludeHours) { 2194 $(this.createDivider('Hours', true)).insertBefore(this.lists[0].$el); 2195 } 2196 2197 this.base(); 2198 }, 2199 2200 /** 2201 * Flip the clock face 2202 */ 2203 2204 flip: function(time, doNotAddPlayClass) { 2205 if(!time) { 2206 time = this.factory.time.getHourCounter(); 2207 } 2208 2209 this.autoIncrement(); 2210 2211 this.base(time, doNotAddPlayClass); 2212 }, 2213 2214 /** 2215 * Append a newly created list to the clock 2216 */ 2217 2218 appendDigitToClock: function(obj) { 2219 this.base(obj); 2220 2221 this.dividers[0].insertAfter(this.dividers[0].next()); 2222 } 2223 2224 }); 2225 2226}(jQuery)); 2227(function($) { 2228 2229 /** 2230 * Minute Counter Clock Face 2231 * 2232 * This class will generate a minute counter for FlipClock.js. A 2233 * minute counter will track minutes and seconds. If an hour is 2234 * reached, the counter will reset back to 0. (4 digits max) 2235 * 2236 * @param object The parent FlipClock.Factory object 2237 * @param object An object of properties to override the default 2238 */ 2239
2240 FlipClock.MinuteCounterFace = FlipClock.HourlyCounterFace.extend({ 2241 2242 clearExcessDigits: false, 2243 2244 /** 2245 * Constructor 2246 * 2247 * @param object The parent FlipClock.Factory object 2248 * @param object An object of properties to override the default 2249 */ 2250 2251 constructor: function(factory, options) { 2252 this.base(factory, options); 2253 }, 2254 2255 /** 2256 * Build the clock face 2257 */ 2258 2259 build: function() { 2260 this.base(true, this.factory.time.getMinuteCounter()); 2261 }, 2262 2263 /** 2264 * Flip the clock face 2265 */ 2266 2267 flip: function(time, doNotAddPlayClass) { 2268 if(!time) { 2269 time = this.factory.time.getMinuteCounter(); 2270 } 2271 2272 this.base(time, doNotAddPlayClass); 2273 } 2274 2275 }); 2276 2277}(jQuery)); 2278(function($) { 2279 2280 /** 2281 * Twelve Hour Clock Face 2282 * 2283 * This class will generate a twelve hour clock for FlipClock.js 2284 * 2285 * @param object The parent FlipClock.Factory object 2286 * @param object An object of properties to override the default 2287 */ 2288 2289 FlipClock.TwelveHourClockFace = FlipClock.TwentyFourHourClockFace.extend({ 2290 2291 /** 2292 * The meridium jQuery DOM object 2293 */ 2294 2295 meridium: false, 2296 2297 /** 2298 * The meridium text as string for easy access 2299 */ 2300 2301 meridiumText: 'AM', 2302 2303 /** 2304 * Build the clock face 2305 * 2306 * @param object Pass the time that should be used to display on the clock. 2307 */ 2308 2309 build: function() { 2310 var t = this; 2311 2312 var time = this.factory.time.getTime(false, this.showSeconds); 2313 2314 this.base(time); 2315 this.meridiumText = this.getMeridium(); 2316 this.meridium = $([ 2317 '<ul class="flip-clock-meridium">', 2318 '<li>', 2319 '<a href="#">'+this.meridiumText+'</a>', 2320 '</li>', 2321 '</ul>' 2322 ].join('')); 2323 2324 this.meridium.insertAfter(this.lists[this.lists.length-1].$el); 2325 }, 2326 2327 /** 2328 * Flip the clock face 2329 */ 2330 2331 flip: function(time, doNotAddPlayClass) { 2332 if(this.meridiumText != this.getMeridium()) { 2333 this.meridiumText = this.getMeridium(); 2334 this.meridium.find('a').html(this.meridiumText); 2335 } 2336 this.base(this.factory.time.getTime(false, this.showSeconds), doNotAddPlayClass); 2337 }, 2338 2339 /** 2340 * Get the current meridium 2341 * 2342 * @return string Returns the meridium (AM|PM) 2343 */ 2344 2345 getMeridium: function() { 2346 return new Date().getHours() >= 12 ? 'PM' : 'AM'; 2347 }, 2348 2349 /** 2350 * Is it currently in the post-medirium? 2351 * 2352 * @return bool Returns true or false 2353 */ 2354 2355 isPM: function() { 2356 return this.getMeridium() == 'PM' ? true : false; 2357 }, 2358 2359 /** 2360 * Is it currently before the post-medirium? 2361 * 2362 * @return bool Returns true or false 2363 */ 2364 2365 isAM: function() { 2366 return this.getMeridium() == 'AM' ? true : false; 2367 } 2368 2369 }); 2370 2371}(jQuery)); 2372(function($) { 2373 2374 /** 2375 * FlipClock Arabic Language Pack 2376 * 2377 * This class will be used to translate tokens into the Arabic language. 2378 * 2379 */ 2380 2381 FlipClock.Lang.Arabic = { 2382 2383 'years' : 'سÙÙØ§Øª', 2384 'months' : 'Ø´ÙÙØ±', 2385 'days' : 'Ø£ÙØ§Ù ', 2386 'hours' : 'ساعات', 2387 'minutes' : 'Ø¯ÙØ§Ø¦Ù', 2388 'seconds' : 'Ø«ÙØ§ÙÙ' 2389 2390 }; 2391 2392 /* Create various aliases for convenience */ 2393 2394 FlipClock.Lang['ar'] = FlipClock.Lang.Arabic; 2395 FlipClock.Lang['ar-ar'] = FlipClock.Lang.Arabic; 2396 FlipClock.Lang['arabic'] = FlipClock.Lang.Arabic; 2397 2398}(jQuery)); 2399(function($) { 2400 2401 /** 2402 * FlipClock Danish Language Pack 2403 * 2404 * This class will used to translate tokens into the Danish language. 2405 * 2406 */ 2407 2408 FlipClock.Lang.Danish = { 2409 2410 'years' : 'à r', 2411 'months' : 'MÃ¥neder', 2412 'days' : 'Dage', 2413 'hours' : 'Timer', 2414 'minutes' : 'Minutter', 2415 'seconds' : 'Sekunder' 2416 2417 }; 2418 2419 /* Create various aliases for convenience */ 2420 2421 FlipClock.Lang['da'] = FlipClock.Lang.Danish; 2422 FlipClock.Lang['da-dk'] = FlipClock.Lang.Danish; 2423 FlipClock.Lang['danish'] = FlipClock.Lang.Danish; 2424 2425}(jQuery)); 2426(function($) { 2427 2428 /** 2429 * FlipClock German Language Pack 2430 * 2431 * This class will used to translate tokens into the German language. 2432 * 2433 */ 2434 2435 FlipClock.Lang.German = { 2436 2437 'years' : 'Jahre', 2438 'months' : 'Monate', 2439 'days' : 'Tage', 2440 'hours' : 'Stunden', 2441 'minutes' : 'Minuten', 2442 'seconds' : 'Sekunden' 2443 2444 }; 2445 2446 /* Create various aliases for convenience */ 2447 2448 FlipClock.Lang['de'] = FlipClock.Lang.German; 2449 FlipClock.Lang['de-de'] = FlipClock.Lang.German; 2450 FlipClock.Lang['german'] = FlipClock.Lang.German; 2451 2452}(jQuery)); 2453(function($) { 2454 2455 /**
2456 * FlipClock English Language Pack 2457 * 2458 * This class will used to translate tokens into the English language. 2459 * 2460 */ 2461 2462 FlipClock.Lang.English = { 2463 2464 'years' : 'Years', 2465 'months' : 'Months', 2466 'days' : 'Days', 2467 'hours' : 'Hours', 2468 'minutes' : 'Minutes', 2469 'seconds' : 'Seconds' 2470 2471 }; 2472 2473 /* Create various aliases for convenience */ 2474 2475 FlipClock.Lang['en'] = FlipClock.Lang.English; 2476 FlipClock.Lang['en-us'] = FlipClock.Lang.English; 2477 FlipClock.Lang['english'] = FlipClock.Lang.English; 2478 2479}(jQuery)); 2480(function($) { 2481 2482 /** 2483 * FlipClock Spanish Language Pack 2484 * 2485 * This class will used to translate tokens into the Spanish language. 2486 * 2487 */ 2488 2489 FlipClock.Lang.Spanish = { 2490 2491 'years' : 'Años', 2492 'months' : 'Meses', 2493 'days' : 'DÍas', 2494 'hours' : 'Horas', 2495 'minutes' : 'Minutos', 2496 'seconds' : 'Segundo' 2497 2498 }; 2499 2500 /* Create various aliases for convenience */ 2501 2502 FlipClock.Lang['es'] = FlipClock.Lang.Spanish; 2503 FlipClock.Lang['es-es'] = FlipClock.Lang.Spanish; 2504 FlipClock.Lang['spanish'] = FlipClock.Lang.Spanish; 2505 2506}(jQuery)); 2507(function($) { 2508 2509 /** 2510 * FlipClock Finnish Language Pack 2511 * 2512 * This class will used to translate tokens into the Finnish language. 2513 * 2514 */ 2515 2516 FlipClock.Lang.Finnish = { 2517 2518 'years' : 'Vuotta', 2519 'months' : 'Kuukautta', 2520 'days' : 'Päivää', 2521 'hours' : 'Tuntia', 2522 'minutes' : 'Minuuttia', 2523 'seconds' : 'Sekuntia' 2524 2525 }; 2526 2527 /* Create various aliases for convenience */ 2528 2529 FlipClock.Lang['fi'] = FlipClock.Lang.Finnish; 2530 FlipClock.Lang['fi-fi'] = FlipClock.Lang.Finnish; 2531 FlipClock.Lang['finnish'] = FlipClock.Lang.Finnish; 2532 2533}(jQuery)); 2534 2535(function($) { 2536 2537 /** 2538 * FlipClock Canadian French Language Pack 2539 * 2540 * This class will used to translate tokens into the Canadian French language. 2541 * 2542 */ 2543 2544 FlipClock.Lang.French = { 2545 2546 'years' : 'Ans', 2547 'months' : 'Mois', 2548 'days' : 'Jours', 2549 'hours' : 'Heures', 2550 'minutes' : 'Minutes', 2551 'seconds' : 'Secondes' 2552 2553 }; 2554 2555 /* Create various aliases for convenience */ 2556 2557 FlipClock.Lang['fr'] = FlipClock.Lang.French; 2558 FlipClock.Lang['fr-ca'] = FlipClock.Lang.French; 2559 FlipClock.Lang['french'] = FlipClock.Lang.French; 2560 2561}(jQuery)); 2562 2563(function($) { 2564 2565 /** 2566 * FlipClock Italian Language Pack 2567 * 2568 * This class will used to translate tokens into the Italian language. 2569 * 2570 */ 2571 2572 FlipClock.Lang.Italian = { 2573 2574 'years' : 'Anni', 2575 'months' : 'Mesi', 2576 'days' : 'Giorni', 2577 'hours' : 'Ore', 2578 'minutes' : 'Minuti', 2579 'seconds' : 'Secondi' 2580 2581 }; 2582 2583 /* Create various aliases for convenience */ 2584 2585 FlipClock.Lang['it'] = FlipClock.Lang.Italian; 2586 FlipClock.Lang['it-it'] = FlipClock.Lang.Italian; 2587 FlipClock.Lang['italian'] = FlipClock.Lang.Italian; 2588 2589}(jQuery)); 2590 2591(function($) { 2592 2593 /** 2594 * FlipClock Latvian Language Pack 2595 * 2596 * This class will used to translate tokens into the Latvian language. 2597 * 2598 */ 2599 2600 FlipClock.Lang.Latvian = { 2601 2602 'years' : 'Gadi', 2603 'months' : 'MÄneÅ¡i', 2604 'days' : 'Dienas', 2605 'hours' : 'Stundas', 2606 'minutes' : 'MinÅ«tes', 2607 'seconds' : 'Sekundes' 2608 2609 }; 2610 2611 /* Create various aliases for convenience */ 2612 2613 FlipClock.Lang['lv'] = FlipClock.Lang.Latvian; 2614 FlipClock.Lang['lv-lv'] = FlipClock.Lang.Latvian; 2615 FlipClock.Lang['latvian'] = FlipClock.Lang.Latvian; 2616 2617}(jQuery)); 2618(function($) { 2619 2620 /** 2621 * FlipClock Dutch Language Pack 2622 * 2623 * This class will used to translate tokens into the Dutch language. 2624 */ 2625 2626 FlipClock.Lang.Dutch = { 2627 2628 'years' : 'Jaren', 2629 'months' : 'Maanden', 2630 'days' : 'Dagen', 2631 'hours' : 'Uren', 2632 'minutes' : 'Minuten', 2633 'seconds' : 'Seconden' 2634 2635 }; 2636 2637 /* Create various aliases for convenience */ 2638 2639 FlipClock.Lang['nl'] = FlipClock.Lang.Dutch; 2640 FlipClock.Lang['nl-be'] = FlipClock.Lang.Dutch; 2641 FlipClock.Lang['dutch'] = FlipClock.Lang.Dutch; 2642 2643}(jQuery)); 2644 2645(function($) { 2646 2647 /**
2648 * FlipClock Norwegian-BokmÃ¥l Language Pack 2649 * 2650 * This class will used to translate tokens into the Norwegian language. 2651 * 2652 */ 2653 2654 FlipClock.Lang.Norwegian = { 2655 2656 'years' : 'à r', 2657 'months' : 'MÃ¥neder', 2658 'days' : 'Dager', 2659 'hours' : 'Timer', 2660 'minutes' : 'Minutter', 2661 'seconds' : 'Sekunder' 2662 2663 }; 2664 2665 /* Create various aliases for convenience */ 2666 2667 FlipClock.Lang['no'] = FlipClock.Lang.Norwegian; 2668 FlipClock.Lang['nb'] = FlipClock.Lang.Norwegian; 2669 FlipClock.Lang['no-nb'] = FlipClock.Lang.Norwegian; 2670 FlipClock.Lang['norwegian'] = FlipClock.Lang.Norwegian; 2671 2672}(jQuery)); 2673 2674(function($) { 2675 2676 /** 2677 * FlipClock Portuguese Language Pack 2678 * 2679 * This class will used to translate tokens into the Portuguese language. 2680 * 2681 */ 2682 2683 FlipClock.Lang.Portuguese = { 2684 2685 'years' : 'Anos', 2686 'months' : 'Meses', 2687 'days' : 'Dias', 2688 'hours' : 'Horas', 2689 'minutes' : 'Minutos', 2690 'seconds' : 'Segundos' 2691 2692 }; 2693 2694 /* Create various aliases for convenience */ 2695 2696 FlipClock.Lang['pt'] = FlipClock.Lang.Portuguese; 2697 FlipClock.Lang['pt-br'] = FlipClock.Lang.Portuguese; 2698 FlipClock.Lang['portuguese'] = FlipClock.Lang.Portuguese; 2699 2700}(jQuery)); 2701(function($) { 2702 2703 /** 2704 * FlipClock Russian Language Pack 2705 * 2706 * This class will used to translate tokens into the Russian language. 2707 * 2708 */ 2709 2710 FlipClock.Lang.Russian = { 2711 2712 'years' : 'леÑ', 2713 'months' : 'меÑÑÑев', 2714 'days' : 'дней', 2715 'hours' : 'ÑаÑов', 2716 'minutes' : 'минÑÑ', 2717 'seconds' : 'ÑекÑнд' 2718 2719 }; 2720 2721 /* Create various aliases for convenience */ 2722 2723 FlipClock.Lang['ru'] = FlipClock.Lang.Russian; 2724 FlipClock.Lang['ru-ru'] = FlipClock.Lang.Russian; 2725 FlipClock.Lang['russian'] = FlipClock.Lang.Russian; 2726 2727}(jQuery)); 2728(function($) { 2729 2730 /** 2731 * FlipClock Swedish Language Pack 2732 * 2733 * This class will used to translate tokens into the Swedish language. 2734 * 2735 */ 2736 2737 FlipClock.Lang.Swedish = { 2738 2739 'years' : 'à r', 2740 'months' : 'MÃ¥nader', 2741 'days' : 'Dagar', 2742 'hours' : 'Timmar', 2743 'minutes' : 'Minuter', 2744 'seconds' : 'Sekunder' 2745 2746 }; 2747 2748 /* Create various aliases for convenience */ 2749 2750 FlipClock.Lang['sv'] = FlipClock.Lang.Swedish; 2751 FlipClock.Lang['sv-se'] = FlipClock.Lang.Swedish; 2752 FlipClock.Lang['swedish'] = FlipClock.Lang.Swedish; 2753 2754}(jQuery)); 2755 2756(function($) { 2757 2758 /** 2759 * FlipClock Chinese Language Pack 2760 * 2761 * This class will used to translate tokens into the Chinese language. 2762 * 2763 */ 2764 2765 FlipClock.Lang.Chinese = { 2766 2767 'years' : 'å¹´', 2768 'months' : 'æ', 2769 'days' : 'æ¥', 2770 'hours' : 'æ¶', 2771 'minutes' : 'å', 2772 'seconds' : 'ç§' 2773 2774 }; 2775 2776 /* Create various aliases for convenience */ 2777 2778 FlipClock.Lang['zh'] = FlipClock.Lang.Chinese; 2779 FlipClock.Lang['zh-cn'] = FlipClock.Lang.Chinese; 2780 FlipClock.Lang['chinese'] = FlipClock.Lang.Chinese; 2781 2782}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.