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