flipclockjs-rails 0.5.5.1 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/flipclockjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/flipclock.js +525 -334
- data/vendor/assets/javascripts/flipclock.min.js +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1000338f302f4f0f26849e8dd01ade93ce3d2970
|
4
|
+
data.tar.gz: 2889f501b070538663a00f9d40091ab9ffd38a3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e11845cd77e97b15aac6c29e387dc8ddce03021e6bf94c6c4e82cc4ce3025a9f0344959cc78269709bedba81a7b6c7f11be79252335147eb67053db81dc003f
|
7
|
+
data.tar.gz: 1ae5e39ffc6faa99a31e501e80ef63e3252bddf80a530b3eb93337d09de5ff2cdd53a85dbef99dd2ccf09da8f44177adedfc4f67d575102f0ab44a9189bb84ba
|
data/README.md
CHANGED
@@ -4,13 +4,15 @@
|
|
4
4
|
|
5
5
|
This gem packages [FlipClock.js](https://github.com/objectivehtml/FlipClock) for the Rails 3.1+ asset pipeline.
|
6
6
|
|
7
|
+
FlipClock JS version: **0.7.7**
|
8
|
+
|
7
9
|
FlipClock.js requires `jQuery 1.7.x+`.
|
8
10
|
|
9
11
|
## Installation
|
10
12
|
|
11
13
|
Add this line to your application's Gemfile:
|
12
14
|
```
|
13
|
-
gem 'flipclockjs-rails', '~> 0.
|
15
|
+
gem 'flipclockjs-rails', '~> 0.7.7'
|
14
16
|
```
|
15
17
|
|
16
18
|
And then execute:
|
@@ -16,11 +16,15 @@ Base.extend = function(_instance, _static) { // subclass
|
|
16
16
|
|
17
17
|
// build the prototype
|
18
18
|
Base._prototyping = true;
|
19
|
+
|
19
20
|
var proto = new this();
|
21
|
+
|
20
22
|
extend.call(proto, _instance);
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
|
24
|
+
proto.base = function() {
|
25
|
+
// call this method from any other method to invoke that method's ancestor
|
26
|
+
};
|
27
|
+
|
24
28
|
delete Base._prototyping;
|
25
29
|
|
26
30
|
// create the wrapper for the constructor function
|
@@ -165,7 +169,7 @@ var FlipClock;
|
|
165
169
|
*/
|
166
170
|
|
167
171
|
FlipClock = function(obj, digit, options) {
|
168
|
-
if(
|
172
|
+
if(digit instanceof Object && digit instanceof Date === false) {
|
169
173
|
options = digit;
|
170
174
|
digit = 0;
|
171
175
|
}
|
@@ -193,13 +197,13 @@ var FlipClock;
|
|
193
197
|
* Build Date
|
194
198
|
*/
|
195
199
|
|
196
|
-
buildDate: '2014-06
|
200
|
+
buildDate: '2014-10-06',
|
197
201
|
|
198
202
|
/**
|
199
203
|
* Version
|
200
204
|
*/
|
201
205
|
|
202
|
-
version: '0.
|
206
|
+
version: '0.7.5',
|
203
207
|
|
204
208
|
/**
|
205
209
|
* Sets the default options
|
@@ -330,6 +334,12 @@ var FlipClock;
|
|
330
334
|
|
331
335
|
FlipClock.Face = FlipClock.Base.extend({
|
332
336
|
|
337
|
+
/**
|
338
|
+
* Sets whether or not the clock should start upon instantiation
|
339
|
+
*/
|
340
|
+
|
341
|
+
autoStart: true,
|
342
|
+
|
333
343
|
/**
|
334
344
|
* An array of jQuery objects used for the dividers (the colons)
|
335
345
|
*/
|
@@ -356,16 +366,21 @@ var FlipClock;
|
|
356
366
|
*/
|
357
367
|
|
358
368
|
constructor: function(factory, options) {
|
359
|
-
this.base(options);
|
360
|
-
this.factory = factory;
|
361
369
|
this.dividers = [];
|
370
|
+
this.lists = [];
|
371
|
+
this.base(options);
|
372
|
+
this.factory = factory;
|
362
373
|
},
|
363
374
|
|
364
375
|
/**
|
365
376
|
* Build the clock face
|
366
377
|
*/
|
367
378
|
|
368
|
-
build: function() {
|
379
|
+
build: function() {
|
380
|
+
if(this.autoStart) {
|
381
|
+
this.start();
|
382
|
+
}
|
383
|
+
},
|
369
384
|
|
370
385
|
/**
|
371
386
|
* Creates a jQuery object used for the digit divider
|
@@ -376,7 +391,6 @@ var FlipClock;
|
|
376
391
|
*/
|
377
392
|
|
378
393
|
createDivider: function(label, css, excludeDots) {
|
379
|
-
|
380
394
|
if(typeof css == "boolean" || !css) {
|
381
395
|
excludeDots = css;
|
382
396
|
css = label;
|
@@ -400,7 +414,11 @@ var FlipClock;
|
|
400
414
|
'</span>'
|
401
415
|
];
|
402
416
|
|
403
|
-
|
417
|
+
var $html = $(html.join(''));
|
418
|
+
|
419
|
+
this.dividers.push($html);
|
420
|
+
|
421
|
+
return $html;
|
404
422
|
},
|
405
423
|
|
406
424
|
/**
|
@@ -417,9 +435,9 @@ var FlipClock;
|
|
417
435
|
}
|
418
436
|
|
419
437
|
var obj = new FlipClock.List(this.factory, digit, options);
|
438
|
+
|
439
|
+
this.lists.push(obj);
|
420
440
|
|
421
|
-
//this.factory.$wrapper.append(obj.$obj);
|
422
|
-
|
423
441
|
return obj;
|
424
442
|
},
|
425
443
|
|
@@ -430,22 +448,25 @@ var FlipClock;
|
|
430
448
|
reset: function() {
|
431
449
|
this.factory.time = new FlipClock.Time(
|
432
450
|
this.factor,
|
433
|
-
this.factory.original ? Math.round(this.factory.original) : 0
|
451
|
+
this.factory.original ? Math.round(this.factory.original) : 0,
|
452
|
+
{
|
453
|
+
minimumDigits: this.factory.minimumDigits
|
454
|
+
}
|
434
455
|
);
|
456
|
+
|
435
457
|
this.flip(this.factory.original, false);
|
436
458
|
},
|
437
459
|
|
438
460
|
/**
|
439
|
-
*
|
440
|
-
|
461
|
+
* Append a newly created list to the clock
|
462
|
+
*/
|
441
463
|
|
442
|
-
|
443
|
-
|
464
|
+
appendDigitToClock: function(obj) {
|
465
|
+
obj.$el.append(false);
|
444
466
|
},
|
445
|
-
|
446
|
-
|
467
|
+
|
447
468
|
/**
|
448
|
-
*
|
469
|
+
* Add a digit to the clock face
|
449
470
|
*/
|
450
471
|
|
451
472
|
addDigit: function(digit) {
|
@@ -456,10 +477,8 @@ var FlipClock;
|
|
456
477
|
flip: this.factory.classes.flip
|
457
478
|
}
|
458
479
|
});
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
this.factory.lists.unshift(obj);
|
480
|
+
|
481
|
+
this.appendDigitToClock(obj);
|
463
482
|
},
|
464
483
|
|
465
484
|
/**
|
@@ -473,24 +492,38 @@ var FlipClock;
|
|
473
492
|
*/
|
474
493
|
|
475
494
|
stop: function() {},
|
476
|
-
|
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
|
+
|
477
509
|
/**
|
478
|
-
* Increments the
|
510
|
+
* Increments the value of the clock face
|
479
511
|
*/
|
480
512
|
|
481
513
|
increment: function() {
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
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();
|
494
527
|
}
|
495
528
|
},
|
496
529
|
|
@@ -501,36 +534,20 @@ var FlipClock;
|
|
501
534
|
flip: function(time, doNotAddPlayClass) {
|
502
535
|
var t = this;
|
503
536
|
|
504
|
-
this.increment();
|
505
|
-
|
506
|
-
var offset = t.factory.lists.length - time.length;
|
507
|
-
|
508
|
-
if(offset < 0) {
|
509
|
-
offset = 0;
|
510
|
-
}
|
511
|
-
|
512
537
|
$.each(time, function(i, digit) {
|
513
|
-
|
514
|
-
|
515
|
-
var list = t.factory.lists[i];
|
516
|
-
|
538
|
+
var list = t.lists[i];
|
539
|
+
|
517
540
|
if(list) {
|
518
|
-
list.
|
519
|
-
|
520
|
-
if(!doNotAddPlayClass) {
|
541
|
+
if(!doNotAddPlayClass && digit != list.digit) {
|
521
542
|
list.play();
|
522
543
|
}
|
544
|
+
|
545
|
+
list.select(digit);
|
523
546
|
}
|
524
547
|
else {
|
525
548
|
t.addDigit(digit);
|
526
549
|
}
|
527
550
|
});
|
528
|
-
|
529
|
-
for(var x = 0; x < time.length; x++) {
|
530
|
-
if(x >= offset && t.factory.lists[x].digit != time[x]) {
|
531
|
-
t.factory.lists[x].select(time[x]);
|
532
|
-
}
|
533
|
-
}
|
534
551
|
}
|
535
552
|
|
536
553
|
});
|
@@ -564,6 +581,16 @@ var FlipClock;
|
|
564
581
|
|
565
582
|
FlipClock.Factory = FlipClock.Base.extend({
|
566
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
|
+
|
567
594
|
/**
|
568
595
|
* Auto start the clock on page load (True|False)
|
569
596
|
*/
|
@@ -605,6 +632,12 @@ var FlipClock;
|
|
605
632
|
|
606
633
|
clockFace: 'HourlyCounter',
|
607
634
|
|
635
|
+
/**
|
636
|
+
* The name of the clock face class in use
|
637
|
+
*/
|
638
|
+
|
639
|
+
countdown: false,
|
640
|
+
|
608
641
|
/**
|
609
642
|
* The name of the default clock face class to use if the defined
|
610
643
|
* clockFace variable is not a valid FlipClock.Face object
|
@@ -619,10 +652,16 @@ var FlipClock;
|
|
619
652
|
defaultLanguage: 'english',
|
620
653
|
|
621
654
|
/**
|
622
|
-
* The
|
655
|
+
* The jQuery object
|
656
|
+
*/
|
657
|
+
|
658
|
+
$el: false,
|
659
|
+
|
660
|
+
/**
|
661
|
+
* The FlipClock.Face object
|
623
662
|
*/
|
624
663
|
|
625
|
-
|
664
|
+
face: true,
|
626
665
|
|
627
666
|
/**
|
628
667
|
* The language object after it has been loaded
|
@@ -630,18 +669,24 @@ var FlipClock;
|
|
630
669
|
|
631
670
|
lang: false,
|
632
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
|
+
|
633
684
|
/**
|
634
685
|
* The original starting value of the clock. Used for the reset method.
|
635
686
|
*/
|
636
687
|
|
637
688
|
original: false,
|
638
689
|
|
639
|
-
/**
|
640
|
-
* The FlipClock.Face object
|
641
|
-
*/
|
642
|
-
|
643
|
-
face: true,
|
644
|
-
|
645
690
|
/**
|
646
691
|
* Is the clock running? (True|False)
|
647
692
|
*/
|
@@ -661,13 +706,7 @@ var FlipClock;
|
|
661
706
|
timer: false,
|
662
707
|
|
663
708
|
/**
|
664
|
-
*
|
665
|
-
*/
|
666
|
-
|
667
|
-
lists: [],
|
668
|
-
|
669
|
-
/**
|
670
|
-
* The wrapping jQuery object
|
709
|
+
* The jQuery object (depcrecated)
|
671
710
|
*/
|
672
711
|
|
673
712
|
$wrapper: false,
|
@@ -686,24 +725,32 @@ var FlipClock;
|
|
686
725
|
options = {};
|
687
726
|
}
|
688
727
|
|
689
|
-
this.lists
|
690
|
-
this.running
|
691
|
-
this.base(options);
|
692
|
-
|
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
|
+
|
693
737
|
this.original = (digit instanceof Date) ? digit : (digit ? Math.round(digit) : 0);
|
694
|
-
|
695
|
-
|
696
|
-
|
738
|
+
|
739
|
+
this.time = new FlipClock.Time(this, this.original, {
|
740
|
+
minimumDigits: this.minimumDigits,
|
741
|
+
animationRate: this.animationRate
|
697
742
|
});
|
698
743
|
|
699
|
-
this.timer
|
744
|
+
this.timer = new FlipClock.Timer(this, options);
|
700
745
|
|
701
|
-
this.
|
702
|
-
|
746
|
+
this.loadLanguage(this.language);
|
747
|
+
|
748
|
+
this.loadClockFace(this.clockFace, options);
|
703
749
|
|
704
750
|
if(this.autoStart) {
|
705
751
|
this.start();
|
706
752
|
}
|
753
|
+
|
707
754
|
},
|
708
755
|
|
709
756
|
/**
|
@@ -714,9 +761,18 @@ var FlipClock;
|
|
714
761
|
*/
|
715
762
|
|
716
763
|
loadClockFace: function(name, options) {
|
717
|
-
var face, suffix = 'Face';
|
764
|
+
var face, suffix = 'Face', hasStopped = false;
|
718
765
|
|
719
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;
|
720
776
|
|
721
777
|
if(FlipClock[name]) {
|
722
778
|
face = new FlipClock[name](this, options);
|
@@ -726,11 +782,16 @@ var FlipClock;
|
|
726
782
|
}
|
727
783
|
|
728
784
|
face.build();
|
729
|
-
|
730
|
-
|
731
|
-
|
785
|
+
|
786
|
+
this.face = face
|
787
|
+
|
788
|
+
if(hasStopped) {
|
789
|
+
this.start();
|
790
|
+
}
|
732
791
|
|
733
|
-
|
792
|
+
return this.face;
|
793
|
+
},
|
794
|
+
|
734
795
|
/**
|
735
796
|
* Load the FlipClock.Lang object
|
736
797
|
*
|
@@ -750,7 +811,7 @@ var FlipClock;
|
|
750
811
|
lang = FlipClock.Lang[this.defaultLanguage];
|
751
812
|
}
|
752
813
|
|
753
|
-
return lang;
|
814
|
+
return this.lang = lang;
|
754
815
|
},
|
755
816
|
|
756
817
|
/**
|
@@ -812,7 +873,9 @@ var FlipClock;
|
|
812
873
|
this.timer.stop(callback);
|
813
874
|
|
814
875
|
for(var x in this.lists) {
|
815
|
-
this.lists
|
876
|
+
if (this.lists.hasOwnProperty(x)) {
|
877
|
+
this.lists[x].stop();
|
878
|
+
}
|
816
879
|
}
|
817
880
|
},
|
818
881
|
|
@@ -864,7 +927,7 @@ var FlipClock;
|
|
864
927
|
*
|
865
928
|
* @param array An array of digits
|
866
929
|
*/
|
867
|
-
flip: function(doNotAddPlayClass) {
|
930
|
+
flip: function(doNotAddPlayClass) {
|
868
931
|
this.face.flip(false, doNotAddPlayClass);
|
869
932
|
}
|
870
933
|
|
@@ -922,7 +985,13 @@ var FlipClock;
|
|
922
985
|
factory: false,
|
923
986
|
|
924
987
|
/**
|
925
|
-
* The
|
988
|
+
* The jQuery object
|
989
|
+
*/
|
990
|
+
|
991
|
+
$el: false,
|
992
|
+
|
993
|
+
/**
|
994
|
+
* The jQuery object (deprecated)
|
926
995
|
*/
|
927
996
|
|
928
997
|
$obj: false,
|
@@ -932,7 +1001,13 @@ var FlipClock;
|
|
932
1001
|
*/
|
933
1002
|
|
934
1003
|
items: [],
|
935
|
-
|
1004
|
+
|
1005
|
+
/**
|
1006
|
+
* The last digit
|
1007
|
+
*/
|
1008
|
+
|
1009
|
+
lastDigit: 0,
|
1010
|
+
|
936
1011
|
/**
|
937
1012
|
* Constructor
|
938
1013
|
*
|
@@ -941,18 +1016,20 @@ var FlipClock;
|
|
941
1016
|
* @param object An object to override the default properties
|
942
1017
|
*/
|
943
1018
|
|
944
|
-
minimumDigits: 0,
|
945
|
-
|
946
1019
|
constructor: function(factory, digit, options) {
|
947
1020
|
this.factory = factory;
|
948
|
-
this.digit
|
949
|
-
this
|
1021
|
+
this.digit = digit;
|
1022
|
+
this.lastDigit = digit;
|
1023
|
+
this.$el = this.createList();
|
950
1024
|
|
1025
|
+
// Depcrated support of the $obj property.
|
1026
|
+
this.$obj = this.$el;
|
1027
|
+
|
951
1028
|
if(digit > 0) {
|
952
1029
|
this.select(digit);
|
953
1030
|
}
|
954
|
-
|
955
|
-
this.factory.$
|
1031
|
+
|
1032
|
+
this.factory.$el.append(this.$el);
|
956
1033
|
},
|
957
1034
|
|
958
1035
|
/**
|
@@ -969,28 +1046,18 @@ var FlipClock;
|
|
969
1046
|
this.digit = digit;
|
970
1047
|
}
|
971
1048
|
|
972
|
-
|
973
|
-
|
974
|
-
var before = this.$obj.find('.'+this.classes.before).removeClass(this.classes.before);
|
1049
|
+
if(this.digit != this.lastDigit) {
|
1050
|
+
var $delete = this.$el.find('.'+this.classes.before).removeClass(this.classes.before);
|
975
1051
|
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
if(target.is(':last-child')) {
|
986
|
-
this.$obj.find(':first-child').addClass(this.classes.before);
|
987
|
-
}
|
988
|
-
else {
|
989
|
-
target.next().addClass(this.classes.before);
|
990
|
-
}
|
991
|
-
}
|
992
|
-
|
993
|
-
target.addClass(this.classes.active);
|
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
|
+
}
|
994
1061
|
},
|
995
1062
|
|
996
1063
|
/**
|
@@ -998,7 +1065,7 @@ var FlipClock;
|
|
998
1065
|
*/
|
999
1066
|
|
1000
1067
|
play: function() {
|
1001
|
-
this.$
|
1068
|
+
this.$el.addClass(this.factory.classes.play);
|
1002
1069
|
},
|
1003
1070
|
|
1004
1071
|
/**
|
@@ -1009,40 +1076,67 @@ var FlipClock;
|
|
1009
1076
|
var t = this;
|
1010
1077
|
|
1011
1078
|
setTimeout(function() {
|
1012
|
-
t.$
|
1079
|
+
t.$el.removeClass(t.factory.classes.play);
|
1013
1080
|
}, this.factory.timer.interval);
|
1014
1081
|
},
|
1015
1082
|
|
1016
1083
|
/**
|
1017
|
-
*
|
1084
|
+
* Creates the list item HTML and returns as a string
|
1018
1085
|
*/
|
1019
1086
|
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
for(var x = 0; x < 10; x++) {
|
1025
|
-
var item = $([
|
1026
|
-
'<li data-digit="'+x+'">',
|
1087
|
+
createListItem: function(css, value) {
|
1088
|
+
return [
|
1089
|
+
'<li class="'+(css ? css : '')+'">',
|
1027
1090
|
'<a href="#">',
|
1028
1091
|
'<div class="up">',
|
1029
1092
|
'<div class="shadow"></div>',
|
1030
|
-
'<div class="inn">'+
|
1093
|
+
'<div class="inn">'+(value ? value : '')+'</div>',
|
1031
1094
|
'</div>',
|
1032
1095
|
'<div class="down">',
|
1033
1096
|
'<div class="shadow"></div>',
|
1034
|
-
'<div class="inn">'+
|
1097
|
+
'<div class="inn">'+(value ? value : '')+'</div>',
|
1035
1098
|
'</div>',
|
1036
1099
|
'</a>',
|
1037
|
-
'</li>'
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
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
|
+
|
1044
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;
|
1045
1138
|
}
|
1139
|
+
|
1046
1140
|
});
|
1047
1141
|
|
1048
1142
|
|
@@ -1079,11 +1173,7 @@ var FlipClock;
|
|
1079
1173
|
* @param object An object of properties to override the default
|
1080
1174
|
*/
|
1081
1175
|
|
1082
|
-
$.fn.FlipClock = function(digit, options) {
|
1083
|
-
if(typeof digit == "object") {
|
1084
|
-
options = digit;
|
1085
|
-
digit = 0;
|
1086
|
-
}
|
1176
|
+
$.fn.FlipClock = function(digit, options) {
|
1087
1177
|
return new FlipClock($(this), digit, options);
|
1088
1178
|
};
|
1089
1179
|
|
@@ -1127,7 +1217,7 @@ var FlipClock;
|
|
1127
1217
|
FlipClock.Time = FlipClock.Base.extend({
|
1128
1218
|
|
1129
1219
|
/**
|
1130
|
-
* The time (in seconds)
|
1220
|
+
* The time (in seconds) or a date object
|
1131
1221
|
*/
|
1132
1222
|
|
1133
1223
|
time: 0,
|
@@ -1139,7 +1229,7 @@ var FlipClock;
|
|
1139
1229
|
factory: false,
|
1140
1230
|
|
1141
1231
|
/**
|
1142
|
-
* The minimum number of digits the clock face
|
1232
|
+
* The minimum number of digits the clock face must have
|
1143
1233
|
*/
|
1144
1234
|
|
1145
1235
|
minimumDigits: 0,
|
@@ -1153,6 +1243,14 @@ var FlipClock;
|
|
1153
1243
|
*/
|
1154
1244
|
|
1155
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
|
+
|
1156
1254
|
this.base(options);
|
1157
1255
|
this.factory = factory;
|
1158
1256
|
|
@@ -1160,7 +1258,7 @@ var FlipClock;
|
|
1160
1258
|
this.time = time;
|
1161
1259
|
}
|
1162
1260
|
},
|
1163
|
-
|
1261
|
+
|
1164
1262
|
/**
|
1165
1263
|
* Convert a string or integer to an array of digits
|
1166
1264
|
*
|
@@ -1210,7 +1308,7 @@ var FlipClock;
|
|
1210
1308
|
|
1211
1309
|
digitize: function(obj) {
|
1212
1310
|
var data = [];
|
1213
|
-
|
1311
|
+
|
1214
1312
|
$.each(obj, function(i, value) {
|
1215
1313
|
value = value.toString();
|
1216
1314
|
|
@@ -1232,12 +1330,26 @@ var FlipClock;
|
|
1232
1330
|
data.unshift('0');
|
1233
1331
|
}
|
1234
1332
|
}
|
1235
|
-
|
1333
|
+
|
1236
1334
|
return data;
|
1237
1335
|
},
|
1238
1336
|
|
1239
1337
|
/**
|
1240
|
-
* Gets a
|
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
|
1241
1353
|
*
|
1242
1354
|
* @return object Returns a digitized object
|
1243
1355
|
*/
|
@@ -1322,15 +1434,25 @@ var FlipClock;
|
|
1322
1434
|
* @return object returns a digitized object
|
1323
1435
|
*/
|
1324
1436
|
|
1325
|
-
getMilitaryTime: function() {
|
1326
|
-
|
1327
|
-
|
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 = [
|
1328
1447
|
date.getHours(),
|
1329
|
-
date.getMinutes()
|
1330
|
-
|
1331
|
-
]);
|
1448
|
+
date.getMinutes()
|
1449
|
+
];
|
1332
1450
|
|
1333
|
-
|
1451
|
+
if(showSeconds === true) {
|
1452
|
+
data.push(date.getSeconds());
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
return this.digitize(data);
|
1334
1456
|
},
|
1335
1457
|
|
1336
1458
|
/**
|
@@ -1369,21 +1491,54 @@ var FlipClock;
|
|
1369
1491
|
* @return int Returns a floored integer
|
1370
1492
|
*/
|
1371
1493
|
|
1372
|
-
getTimeSeconds: function(
|
1494
|
+
getTimeSeconds: function(date) {
|
1495
|
+
if(!date) {
|
1496
|
+
date = new Date();
|
1497
|
+
}
|
1498
|
+
|
1373
1499
|
if (this.time instanceof Date) {
|
1374
1500
|
if (this.factory.countdown) {
|
1375
|
-
|
1376
|
-
this.factory.stop();
|
1377
|
-
}
|
1378
|
-
return Math.max(this.time.getTime()/1000 - (new Date()).getTime()/1000,0);
|
1501
|
+
return Math.max(this.time.getTime()/1000 - date.getTime()/1000,0);
|
1379
1502
|
} else {
|
1380
|
-
return
|
1503
|
+
return date.getTime()/1000 - this.time.getTime()/1000 ;
|
1381
1504
|
}
|
1382
1505
|
} else {
|
1383
1506
|
return this.time;
|
1384
1507
|
}
|
1385
1508
|
},
|
1386
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
|
+
|
1387
1542
|
/**
|
1388
1543
|
* Gets number of seconds
|
1389
1544
|
*
|
@@ -1405,26 +1560,7 @@ var FlipClock;
|
|
1405
1560
|
|
1406
1561
|
return Math.ceil(seconds);
|
1407
1562
|
},
|
1408
|
-
|
1409
|
-
/**
|
1410
|
-
* Gets the current twelve hour time
|
1411
|
-
*
|
1412
|
-
* @return object Returns a digitized object
|
1413
|
-
*/
|
1414
|
-
|
1415
|
-
getTime: function() {
|
1416
|
-
var date = new Date();
|
1417
|
-
var hours = date.getHours();
|
1418
|
-
var merid = hours > 12 ? 'PM' : 'AM';
|
1419
|
-
var obj = this.digitize([
|
1420
|
-
hours > 12 ? hours - 12 : (hours === 0 ? 12 : hours),
|
1421
|
-
date.getMinutes(),
|
1422
|
-
date.getSeconds()
|
1423
|
-
]);
|
1424
1563
|
|
1425
|
-
return obj;
|
1426
|
-
},
|
1427
|
-
|
1428
1564
|
/**
|
1429
1565
|
* Gets number of weeks
|
1430
1566
|
*
|
@@ -1432,7 +1568,7 @@ var FlipClock;
|
|
1432
1568
|
* @return int Retuns a floored integer
|
1433
1569
|
*/
|
1434
1570
|
|
1435
|
-
getWeeks: function() {
|
1571
|
+
getWeeks: function(mod) {
|
1436
1572
|
var weeks = this.getTimeSeconds() / 60 / 60 / 24 / 7;
|
1437
1573
|
|
1438
1574
|
if(mod) {
|
@@ -1476,7 +1612,12 @@ var FlipClock;
|
|
1476
1612
|
*/
|
1477
1613
|
|
1478
1614
|
addSeconds: function(x) {
|
1479
|
-
this.time
|
1615
|
+
if(this.time instanceof Date) {
|
1616
|
+
this.time.setSeconds(this.time.getSeconds() + x);
|
1617
|
+
}
|
1618
|
+
else {
|
1619
|
+
this.time += x;
|
1620
|
+
}
|
1480
1621
|
},
|
1481
1622
|
|
1482
1623
|
/**
|
@@ -1492,7 +1633,12 @@ var FlipClock;
|
|
1492
1633
|
*/
|
1493
1634
|
|
1494
1635
|
subSeconds: function(x) {
|
1495
|
-
this.time
|
1636
|
+
if(this.time instanceof Date) {
|
1637
|
+
this.time.setSeconds(this.time.getSeconds() - x);
|
1638
|
+
}
|
1639
|
+
else {
|
1640
|
+
this.time -= x;
|
1641
|
+
}
|
1496
1642
|
},
|
1497
1643
|
|
1498
1644
|
/**
|
@@ -1579,7 +1725,7 @@ var FlipClock;
|
|
1579
1725
|
interval: 1000,
|
1580
1726
|
|
1581
1727
|
/**
|
1582
|
-
* The rate of the animation in milliseconds
|
1728
|
+
* The rate of the animation in milliseconds (not currently in use)
|
1583
1729
|
*/
|
1584
1730
|
|
1585
1731
|
animationRate: 1000,
|
@@ -1748,7 +1894,6 @@ var FlipClock;
|
|
1748
1894
|
*/
|
1749
1895
|
|
1750
1896
|
constructor: function(factory, options) {
|
1751
|
-
factory.countdown = false;
|
1752
1897
|
this.base(factory, options);
|
1753
1898
|
},
|
1754
1899
|
|
@@ -1760,27 +1905,29 @@ var FlipClock;
|
|
1760
1905
|
|
1761
1906
|
build: function(time) {
|
1762
1907
|
var t = this;
|
1763
|
-
var children = this.factory.$
|
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);
|
1764
1917
|
|
1765
|
-
time = time ? time : (this.factory.time.time || this.factory.time.getMilitaryTime());
|
1766
|
-
|
1767
1918
|
if(time.length > children.length) {
|
1768
1919
|
$.each(time, function(i, digit) {
|
1769
|
-
t.
|
1920
|
+
t.createList(digit);
|
1770
1921
|
});
|
1771
1922
|
}
|
1772
1923
|
|
1773
|
-
this.
|
1774
|
-
this.
|
1775
|
-
|
1776
|
-
$(this.dividers[0]).insertBefore(this.
|
1777
|
-
$(this.dividers[1]).insertBefore(this.
|
1778
|
-
|
1779
|
-
this._clearExcessDigits();
|
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);
|
1780
1929
|
|
1781
|
-
|
1782
|
-
this.start();
|
1783
|
-
}
|
1930
|
+
this.base();
|
1784
1931
|
},
|
1785
1932
|
|
1786
1933
|
/**
|
@@ -1788,22 +1935,11 @@ var FlipClock;
|
|
1788
1935
|
*/
|
1789
1936
|
|
1790
1937
|
flip: function(time, doNotAddPlayClass) {
|
1791
|
-
|
1792
|
-
this.base(time, doNotAddPlayClass);
|
1793
|
-
},
|
1794
|
-
|
1795
|
-
/**
|
1796
|
-
* Clear the excess digits from the tens columns for sec/min
|
1797
|
-
*/
|
1798
|
-
|
1799
|
-
_clearExcessDigits: function() {
|
1800
|
-
var tenSeconds = this.factory.lists[this.factory.lists.length - 2];
|
1801
|
-
var tenMinutes = this.factory.lists[this.factory.lists.length - 4];
|
1938
|
+
this.autoIncrement();
|
1802
1939
|
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
}
|
1940
|
+
time = time ? time : this.factory.time.getMilitaryTime(false, this.showSeconds);
|
1941
|
+
|
1942
|
+
this.base(time, doNotAddPlayClass);
|
1807
1943
|
}
|
1808
1944
|
|
1809
1945
|
});
|
@@ -1823,9 +1959,11 @@ var FlipClock;
|
|
1823
1959
|
|
1824
1960
|
FlipClock.CounterFace = FlipClock.Face.extend({
|
1825
1961
|
|
1826
|
-
|
1962
|
+
/**
|
1963
|
+
* Tells the counter clock face if it should auto-increment
|
1964
|
+
*/
|
1827
1965
|
|
1828
|
-
|
1966
|
+
shouldAutoIncrement: false,
|
1829
1967
|
|
1830
1968
|
/**
|
1831
1969
|
* Constructor
|
@@ -1835,9 +1973,16 @@ var FlipClock;
|
|
1835
1973
|
*/
|
1836
1974
|
|
1837
1975
|
constructor: function(factory, options) {
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
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
|
+
}
|
1841
1986
|
|
1842
1987
|
factory.increment = function() {
|
1843
1988
|
factory.countdown = false;
|
@@ -1863,50 +2008,44 @@ var FlipClock;
|
|
1863
2008
|
this.base(factory, options);
|
1864
2009
|
},
|
1865
2010
|
|
1866
|
-
/**
|
1867
|
-
* Increments the time with each face flip
|
1868
|
-
*/
|
1869
|
-
|
1870
|
-
increment: function() {},
|
1871
|
-
|
1872
2011
|
/**
|
1873
2012
|
* Build the clock face
|
1874
2013
|
*/
|
1875
2014
|
|
1876
2015
|
build: function() {
|
1877
2016
|
var t = this;
|
1878
|
-
var children = this.factory.$
|
1879
|
-
var lists = [];
|
2017
|
+
var children = this.factory.$el.find('ul');
|
1880
2018
|
var time = this.factory.getTime().digitize([this.factory.getTime().time]);
|
1881
2019
|
|
1882
2020
|
if(time.length > children.length) {
|
1883
2021
|
$.each(time, function(i, digit) {
|
1884
|
-
var list = t.createList(digit
|
1885
|
-
minimumDigits: t.minimumDigits,
|
1886
|
-
});
|
2022
|
+
var list = t.createList(digit);
|
1887
2023
|
|
1888
2024
|
list.select(digit);
|
1889
|
-
lists.push(list);
|
1890
2025
|
});
|
1891
2026
|
|
1892
2027
|
}
|
1893
2028
|
|
1894
|
-
$.each(lists, function(i, list) {
|
2029
|
+
$.each(this.lists, function(i, list) {
|
1895
2030
|
list.play();
|
1896
2031
|
});
|
1897
2032
|
|
1898
|
-
this.
|
2033
|
+
this.base();
|
1899
2034
|
},
|
1900
2035
|
|
1901
2036
|
/**
|
1902
2037
|
* Flip the clock face
|
1903
2038
|
*/
|
1904
2039
|
|
1905
|
-
flip: function(time, doNotAddPlayClass) {
|
2040
|
+
flip: function(time, doNotAddPlayClass) {
|
2041
|
+
if(this.shouldAutoIncrement) {
|
2042
|
+
this.autoIncrement();
|
2043
|
+
}
|
2044
|
+
|
1906
2045
|
if(!time) {
|
1907
2046
|
time = this.factory.getTime().digitize([this.factory.getTime().time]);
|
1908
2047
|
}
|
1909
|
-
|
2048
|
+
|
1910
2049
|
this.base(time, doNotAddPlayClass);
|
1911
2050
|
},
|
1912
2051
|
|
@@ -1916,7 +2055,7 @@ var FlipClock;
|
|
1916
2055
|
|
1917
2056
|
reset: function() {
|
1918
2057
|
this.factory.time = new FlipClock.Time(
|
1919
|
-
this.
|
2058
|
+
this.factory,
|
1920
2059
|
this.factory.original ? Math.round(this.factory.original) : 0
|
1921
2060
|
);
|
1922
2061
|
|
@@ -1958,39 +2097,32 @@ var FlipClock;
|
|
1958
2097
|
* Build the clock face
|
1959
2098
|
*/
|
1960
2099
|
|
1961
|
-
build: function(
|
1962
|
-
var t
|
1963
|
-
var children = this.factory.$
|
1964
|
-
var
|
1965
|
-
var offset = 0;
|
2100
|
+
build: function(time) {
|
2101
|
+
var t = this;
|
2102
|
+
var children = this.factory.$el.find('ul');
|
2103
|
+
var offset = 0;
|
1966
2104
|
|
1967
|
-
time
|
2105
|
+
time = time ? time : this.factory.time.getDayCounter(this.showSeconds);
|
1968
2106
|
|
1969
2107
|
if(time.length > children.length) {
|
1970
2108
|
$.each(time, function(i, digit) {
|
1971
|
-
|
2109
|
+
t.createList(digit);
|
1972
2110
|
});
|
1973
2111
|
}
|
1974
2112
|
|
1975
|
-
this.factory.lists = lists;
|
1976
|
-
|
1977
2113
|
if(this.showSeconds) {
|
1978
|
-
$(this.createDivider('Seconds')).insertBefore(this.
|
2114
|
+
$(this.createDivider('Seconds')).insertBefore(this.lists[this.lists.length - 2].$el);
|
1979
2115
|
}
|
1980
2116
|
else
|
1981
2117
|
{
|
1982
2118
|
offset = 2;
|
1983
2119
|
}
|
1984
2120
|
|
1985
|
-
$(this.createDivider('Minutes')).insertBefore(this.
|
1986
|
-
$(this.createDivider('Hours')).insertBefore(this.
|
1987
|
-
$(this.createDivider('Days', true)).insertBefore(this.
|
1988
|
-
|
1989
|
-
this._clearExcessDigits();
|
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);
|
1990
2124
|
|
1991
|
-
|
1992
|
-
this.start();
|
1993
|
-
}
|
2125
|
+
this.base();
|
1994
2126
|
},
|
1995
2127
|
|
1996
2128
|
/**
|
@@ -2002,21 +2134,9 @@ var FlipClock;
|
|
2002
2134
|
time = this.factory.time.getDayCounter(this.showSeconds);
|
2003
2135
|
}
|
2004
2136
|
|
2005
|
-
this.
|
2006
|
-
},
|
2007
|
-
|
2008
|
-
/**
|
2009
|
-
* Clear the excess digits from the tens columns for sec/min
|
2010
|
-
*/
|
2137
|
+
this.autoIncrement();
|
2011
2138
|
|
2012
|
-
|
2013
|
-
var tenSeconds = this.factory.lists[this.factory.lists.length - 2];
|
2014
|
-
var tenMinutes = this.factory.lists[this.factory.lists.length - 4];
|
2015
|
-
|
2016
|
-
for(var x = 6; x < 10; x++) {
|
2017
|
-
tenSeconds.$obj.find('li:last-child').remove();
|
2018
|
-
tenMinutes.$obj.find('li:last-child').remove();
|
2019
|
-
}
|
2139
|
+
this.base(time, doNotAddPlayClass);
|
2020
2140
|
}
|
2021
2141
|
|
2022
2142
|
});
|
@@ -2038,7 +2158,7 @@ var FlipClock;
|
|
2038
2158
|
|
2039
2159
|
FlipClock.HourlyCounterFace = FlipClock.Face.extend({
|
2040
2160
|
|
2041
|
-
clearExcessDigits: true,
|
2161
|
+
// clearExcessDigits: true,
|
2042
2162
|
|
2043
2163
|
/**
|
2044
2164
|
* Constructor
|
@@ -2056,34 +2176,25 @@ var FlipClock;
|
|
2056
2176
|
*/
|
2057
2177
|
|
2058
2178
|
build: function(excludeHours, time) {
|
2059
|
-
var t
|
2060
|
-
var children = this.factory.$
|
2061
|
-
var lists = [];
|
2179
|
+
var t = this;
|
2180
|
+
var children = this.factory.$el.find('ul');
|
2062
2181
|
|
2063
|
-
time
|
2182
|
+
time = time ? time : this.factory.time.getHourCounter();
|
2064
2183
|
|
2065
2184
|
if(time.length > children.length) {
|
2066
2185
|
$.each(time, function(i, digit) {
|
2067
|
-
|
2186
|
+
t.createList(digit);
|
2068
2187
|
});
|
2069
2188
|
}
|
2070
2189
|
|
2071
|
-
this.
|
2072
|
-
|
2073
|
-
$(this.createDivider('Seconds')).insertBefore(this.factory.lists[this.factory.lists.length - 2].$obj);
|
2074
|
-
$(this.createDivider('Minutes')).insertBefore(this.factory.lists[this.factory.lists.length - 4].$obj);
|
2190
|
+
$(this.createDivider('Seconds')).insertBefore(this.lists[this.lists.length - 2].$el);
|
2191
|
+
$(this.createDivider('Minutes')).insertBefore(this.lists[this.lists.length - 4].$el);
|
2075
2192
|
|
2076
2193
|
if(!excludeHours) {
|
2077
|
-
$(this.createDivider('Hours', true)).insertBefore(this.
|
2194
|
+
$(this.createDivider('Hours', true)).insertBefore(this.lists[0].$el);
|
2078
2195
|
}
|
2079
2196
|
|
2080
|
-
|
2081
|
-
this._clearExcessDigits();
|
2082
|
-
}
|
2083
|
-
|
2084
|
-
if(this.autoStart) {
|
2085
|
-
this.start();
|
2086
|
-
}
|
2197
|
+
this.base();
|
2087
2198
|
},
|
2088
2199
|
|
2089
2200
|
/**
|
@@ -2093,22 +2204,21 @@ var FlipClock;
|
|
2093
2204
|
flip: function(time, doNotAddPlayClass) {
|
2094
2205
|
if(!time) {
|
2095
2206
|
time = this.factory.time.getHourCounter();
|
2096
|
-
}
|
2207
|
+
}
|
2208
|
+
|
2209
|
+
this.autoIncrement();
|
2210
|
+
|
2097
2211
|
this.base(time, doNotAddPlayClass);
|
2098
2212
|
},
|
2099
|
-
|
2213
|
+
|
2100
2214
|
/**
|
2101
|
-
*
|
2215
|
+
* Append a newly created list to the clock
|
2102
2216
|
*/
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
for(var x = 6; x < 10; x++) {
|
2109
|
-
tenSeconds.$obj.find('li:last-child').remove();
|
2110
|
-
tenMinutes.$obj.find('li:last-child').remove();
|
2111
|
-
}
|
2217
|
+
|
2218
|
+
appendDigitToClock: function(obj) {
|
2219
|
+
this.base(obj);
|
2220
|
+
|
2221
|
+
this.dividers[0].insertAfter(this.dividers[0].next());
|
2112
2222
|
}
|
2113
2223
|
|
2114
2224
|
});
|
@@ -2128,7 +2238,7 @@ var FlipClock;
|
|
2128
2238
|
*/
|
2129
2239
|
|
2130
2240
|
FlipClock.MinuteCounterFace = FlipClock.HourlyCounterFace.extend({
|
2131
|
-
|
2241
|
+
|
2132
2242
|
clearExcessDigits: false,
|
2133
2243
|
|
2134
2244
|
/**
|
@@ -2158,8 +2268,9 @@ var FlipClock;
|
|
2158
2268
|
if(!time) {
|
2159
2269
|
time = this.factory.time.getMinuteCounter();
|
2160
2270
|
}
|
2271
|
+
|
2161
2272
|
this.base(time, doNotAddPlayClass);
|
2162
|
-
}
|
2273
|
+
}
|
2163
2274
|
|
2164
2275
|
});
|
2165
2276
|
|
@@ -2195,13 +2306,13 @@ var FlipClock;
|
|
2195
2306
|
* @param object Pass the time that should be used to display on the clock.
|
2196
2307
|
*/
|
2197
2308
|
|
2198
|
-
build: function(
|
2199
|
-
var t
|
2200
|
-
|
2201
|
-
time =
|
2202
|
-
|
2309
|
+
build: function() {
|
2310
|
+
var t = this;
|
2311
|
+
|
2312
|
+
var time = this.factory.time.getTime(false, this.showSeconds);
|
2313
|
+
|
2203
2314
|
this.base(time);
|
2204
|
-
this.meridiumText = this.
|
2315
|
+
this.meridiumText = this.getMeridium();
|
2205
2316
|
this.meridium = $([
|
2206
2317
|
'<ul class="flip-clock-meridium">',
|
2207
2318
|
'<li>',
|
@@ -2209,8 +2320,8 @@ var FlipClock;
|
|
2209
2320
|
'</li>',
|
2210
2321
|
'</ul>'
|
2211
2322
|
].join(''));
|
2212
|
-
|
2213
|
-
this.meridium.insertAfter(this.
|
2323
|
+
|
2324
|
+
this.meridium.insertAfter(this.lists[this.lists.length-1].$el);
|
2214
2325
|
},
|
2215
2326
|
|
2216
2327
|
/**
|
@@ -2218,11 +2329,11 @@ var FlipClock;
|
|
2218
2329
|
*/
|
2219
2330
|
|
2220
2331
|
flip: function(time, doNotAddPlayClass) {
|
2221
|
-
if(this.meridiumText != this.
|
2222
|
-
this.meridiumText = this.
|
2332
|
+
if(this.meridiumText != this.getMeridium()) {
|
2333
|
+
this.meridiumText = this.getMeridium();
|
2223
2334
|
this.meridium.find('a').html(this.meridiumText);
|
2224
2335
|
}
|
2225
|
-
this.base(this.factory.time.getTime(), doNotAddPlayClass);
|
2336
|
+
this.base(this.factory.time.getTime(false, this.showSeconds), doNotAddPlayClass);
|
2226
2337
|
},
|
2227
2338
|
|
2228
2339
|
/**
|
@@ -2231,7 +2342,7 @@ var FlipClock;
|
|
2231
2342
|
* @return string Returns the meridium (AM|PM)
|
2232
2343
|
*/
|
2233
2344
|
|
2234
|
-
|
2345
|
+
getMeridium: function() {
|
2235
2346
|
return new Date().getHours() >= 12 ? 'PM' : 'AM';
|
2236
2347
|
},
|
2237
2348
|
|
@@ -2241,22 +2352,18 @@ var FlipClock;
|
|
2241
2352
|
* @return bool Returns true or false
|
2242
2353
|
*/
|
2243
2354
|
|
2244
|
-
|
2245
|
-
return this.
|
2355
|
+
isPM: function() {
|
2356
|
+
return this.getMeridium() == 'PM' ? true : false;
|
2246
2357
|
},
|
2247
|
-
|
2358
|
+
|
2248
2359
|
/**
|
2249
|
-
*
|
2360
|
+
* Is it currently before the post-medirium?
|
2361
|
+
*
|
2362
|
+
* @return bool Returns true or false
|
2250
2363
|
*/
|
2251
2364
|
|
2252
|
-
|
2253
|
-
|
2254
|
-
var tenMinutes = this.factory.lists[this.factory.lists.length - 4];
|
2255
|
-
|
2256
|
-
for(var x = 6; x < 10; x++) {
|
2257
|
-
tenSeconds.$obj.find('li:last-child').remove();
|
2258
|
-
tenMinutes.$obj.find('li:last-child').remove();
|
2259
|
-
}
|
2365
|
+
isAM: function() {
|
2366
|
+
return this.getMeridium() == 'AM' ? true : false;
|
2260
2367
|
}
|
2261
2368
|
|
2262
2369
|
});
|
@@ -2311,8 +2418,8 @@ var FlipClock;
|
|
2311
2418
|
|
2312
2419
|
/* Create various aliases for convenience */
|
2313
2420
|
|
2314
|
-
FlipClock.Lang['da']
|
2315
|
-
FlipClock.Lang['da-dk']
|
2421
|
+
FlipClock.Lang['da'] = FlipClock.Lang.Danish;
|
2422
|
+
FlipClock.Lang['da-dk'] = FlipClock.Lang.Danish;
|
2316
2423
|
FlipClock.Lang['danish'] = FlipClock.Lang.Danish;
|
2317
2424
|
|
2318
2425
|
}(jQuery));
|
@@ -2383,7 +2490,7 @@ var FlipClock;
|
|
2383
2490
|
|
2384
2491
|
'years' : 'Años',
|
2385
2492
|
'months' : 'Meses',
|
2386
|
-
'days' : 'D&#
|
2493
|
+
'days' : 'Días',
|
2387
2494
|
'hours' : 'Horas',
|
2388
2495
|
'minutes' : 'Minutos',
|
2389
2496
|
'seconds' : 'Segundo'
|
@@ -2397,6 +2504,34 @@ var FlipClock;
|
|
2397
2504
|
FlipClock.Lang['spanish'] = FlipClock.Lang.Spanish;
|
2398
2505
|
|
2399
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
|
+
|
2400
2535
|
(function($) {
|
2401
2536
|
|
2402
2537
|
/**
|
@@ -2507,6 +2642,62 @@ var FlipClock;
|
|
2507
2642
|
|
2508
2643
|
}(jQuery));
|
2509
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));
|
2510
2701
|
(function($) {
|
2511
2702
|
|
2512
2703
|
/**
|
@@ -2556,8 +2747,8 @@ var FlipClock;
|
|
2556
2747
|
|
2557
2748
|
/* Create various aliases for convenience */
|
2558
2749
|
|
2559
|
-
FlipClock.Lang['sv'] = FlipClock.Lang.
|
2560
|
-
FlipClock.Lang['sv-se'] = FlipClock.Lang.
|
2561
|
-
FlipClock.Lang['swedish'] = FlipClock.Lang.
|
2750
|
+
FlipClock.Lang['sv'] = FlipClock.Lang.Swedish;
|
2751
|
+
FlipClock.Lang['sv-se'] = FlipClock.Lang.Swedish;
|
2752
|
+
FlipClock.Lang['swedish'] = FlipClock.Lang.Swedish;
|
2562
2753
|
|
2563
2754
|
}(jQuery));
|