Hello,
Here is the full javascript content of flipclock.js, but I am not coding background, and maybe someone else will help you.
/*! flipclock 2014-12-12 */
var Base = function() {};
Base.extend = function(a, b) {
"use strict";
var c = Base.prototype.extend;
Base._prototyping = !0;
var d = new this;
c.call(d, a), d.base = function() {}, delete Base._prototyping;
var e = d.constructor,
f = d.constructor = function() {
if (!Base._prototyping)
if (this._constructing || this.constructor == f) this._constructing = !0, e.apply(this, arguments), delete this._constructing;
else if (null !== arguments[0]) return (arguments[0].extend || c).call(arguments[0], d)
};
return f.ancestor = this, f.extend = this.extend, f.forEach = this.forEach, f.implement = this.implement, f.prototype = d, f.toString = this.toString, f.valueOf = function(a) {
return "object" == a ? f : e.valueOf()
}, c.call(f, b), "function" == typeof f.init && f.init(), f
}, Base.prototype = {
extend: function(a, b) {
if (arguments.length > 1) {
var c = this[a];
if (c && "function" == typeof b && (!c.valueOf || c.valueOf() != b.valueOf()) && /\bbase\b/.test(b)) {
var d = b.valueOf();
b = function() {
var a = this.base || Base.prototype.base;
this.base = c;
var b = d.apply(this, arguments);
return this.base = a, b
}, b.valueOf = function(a) {
return "object" == a ? b : d
}, b.toString = Base.toString
}
this[a] = b
} else if (a) {
var e = Base.prototype.extend;
Base._prototyping || "function" == typeof this || (e = this.extend || e);
for (var f = {
toSource: null
}, g = ["constructor", "toString", "valueOf"], h = Base._prototyping ? 0 : 1; i = g[h++];) a[i] != f[i] && e.call(this, i, a[i]);
for (var i in a) f[i] || e.call(this, i, a[i])
}
return this
}
}, Base = Base.extend({
constructor: function() {
this.extend(arguments[0])
}
}, {
ancestor: Object,
version: "1.1",
forEach: function(a, b, c) {
for (var d in a) void 0 === this.prototype[d] && b.call(c, a[d], d, a)
},
implement: function() {
for (var a = 0; a < arguments.length; a++) "function" == typeof arguments[a] ? arguments[a](this.prototype) : this.prototype.extend(arguments[a]);
return this
},
toString: function() {
return String(this.valueOf())
}
});
var FlipClock;
! function(a) {
"use strict";
FlipClock = function(a, b, c) {
return b instanceof Object && b instanceof Date == !1 && (c = b, b = 0), new FlipClock.Factory(a, b, c)
}, FlipClock.Lang = {}, FlipClock.Base = Base.extend({
buildDate: "2014-12-12",
version: "0.7.7",
constructor: function(b, c) {
"object" != typeof b && (b = {}), "object" != typeof c && (c = {}), this.setOptions(a.extend(!0, {}, b, c))
},
callback: function(a) {
if ("function" == typeof a) {
for (var b = [], c = 1; c <= arguments.length; c++) arguments[c] && b.push(arguments[c]);
a.apply(this, b)
}
},
log: function(a) {
window.console && console.log && console.log(a)
},
getOption: function(a) {
return this[a] ? this[a] : !1
},
getOptions: function() {
return this
},
setOption: function(a, b) {
this[a] = b
},
setOptions: function(a) {
for (var b in a) "undefined" != typeof a[b] && this.setOption(b, a[b])
}
})
}(jQuery),
function(a) {
"use strict";
FlipClock.Face = FlipClock.Base.extend({
autoStart: !0,
dividers: [],
factory: !1,
lists: [],
constructor: function(a, b) {
this.dividers = [], this.lists = [], this.base(b), this.factory = a
},
build: function() {
this.autoStart && this.start()
},
createDivider: function(b, c, d) {
"boolean" != typeof c && c || (d = c, c = b);
var e = ['<span class="' + this.factory.classes.dot + ' top"></span>', '<span class="' + this.factory.classes.dot + ' bottom"></span>'].join("");
d && (e = ""), b = this.factory.localize(b);
var f = ['<span class="' + this.factory.classes.divider + " " + (c ? c : "").toLowerCase() + '">', '<span class="' + this.factory.classes.label + '">' + (b ? b : "") + "</span>", e, "</span>"],
g = a(f.join(""));
return this.dividers.push(g), g
},
createList: function(a, b) {
"object" == typeof a && (b = a, a = 0);
var c = new FlipClock.List(this.factory, a, b);
return this.lists.push(c), c
},
reset: function() {
this.factory.time = new FlipClock.Time(this.factory, this.factory.original ? Math.round(this.factory.original) : 0, {
minimumDigits: this.factory.minimumDigits
}), this.flip(this.factory.original, !1)
},
appendDigitToClock: function(a) {
a.$el.append(!1)
},
addDigit: function(a) {
var b = this.createList(a, {
classes: {
active: this.factory.classes.active,
before: this.factory.classes.before,
flip: this.factory.classes.flip
}
});
this.appendDigitToClock(b)
},
start: function() {},
stop: function() {},
autoIncrement: function() {
this.factory.countdown ? this.decrement() : this.increment()
},
increment: function() {
this.factory.time.addSecond()
},
decrement: function() {
0 == this.factory.time.getTimeSeconds() ? this.factory.stop() : this.factory.time.subSecond()
},
flip: function(b, c) {
var d = this;
a.each(b, function(a, b) {
var e = d.lists[a];
e ? (c || b == e.digit || e.play(), e.select(b)) : d.addDigit(b)
})
}
})
}(jQuery),
function(a) {
"use strict";
FlipClock.Factory = FlipClock.Base.extend({
animationRate: 1e3,
autoStart: !0,
callbacks: {
destroy: !1,
create: !1,
init: !1,
interval: !1,
start: !1,
stop: !1,
reset: !1
},
classes: {
active: "flip-clock-active",
before: "flip-clock-before",
divider: "flip-clock-divider",
dot: "flip-clock-dot",
label: "flip-clock-label",
flip: "flip",
play: "play",
wrapper: "flip-clock-wrapper"
},
clockFace: "HourlyCounter",
countdown: !1,
defaultClockFace: "HourlyCounter",
defaultLanguage: "english",
$el: !1,
face: !0,
lang: !1,
language: "english",
minimumDigits: 0,
original: !1,
running: !1,
time: !1,
timer: !1,
$wrapper: !1,
constructor: function(b, c, d) {
d || (d = {}), this.lists = [], this.running = !1, this.base(d), this.$el = a(b).addClass(this.classes.wrapper), this.$wrapper = this.$el, this.original = c instanceof Date ? c : c ? Math.round(c) : 0, this.time = new FlipClock.Time(this, this.original, {
minimumDigits: this.minimumDigits,
animationRate: this.animationRate
}), this.timer = new FlipClock.Timer(this, d), this.loadLanguage(this.language), this.loadClockFace(this.clockFace, d), this.autoStart && this.start()
},
loadClockFace: function(a, b) {
var c, d = "Face",
e = !1;
return a = a.ucfirst() + d, this.face.stop && (this.stop(), e = !0), this.$el.html(""), this.time.minimumDigits = this.minimumDigits, c = FlipClock[a] ? new FlipClock[a](this, b) : new FlipClock[this.defaultClockFace + d](this, b), c.build(), this.face = c, e && this.start(), this.face
},
loadLanguage: function(a) {
var b;
return b = FlipClock.Lang[a.ucfirst()] ? FlipClock.Lang[a.ucfirst()] : FlipClock.Lang[a] ? FlipClock.Lang[a] : FlipClock.Lang[this.defaultLanguage], this.lang = b
},
localize: function(a, b) {
var c = this.lang;
if (!a) return null;
var d = a.toLowerCase();
return "object" == typeof b && (c = b), c && c[d] ? c[d] : a
},
start: function(a) {
var b = this;
b.running || b.countdown && !(b.countdown && b.time.time > 0) ? b.log("Trying to start timer when countdown already at 0") : (b.face.start(b.time), b.timer.start(function() {
b.flip(), "function" == typeof a && a()
}))
},
stop: function(a) {
this.face.stop(), this.timer.stop(a);
for (var b in this.lists) this.lists.hasOwnProperty(b) && this.lists[b].stop()
},
reset: function(a) {
this.timer.reset(a), this.face.reset()
},
setTime: function(a) {
this.time.time = a, this.flip(!0)
},
getTime: function() {
return this.time
},
setCountdown: function(a) {
var b = this.running;
this.countdown = a ? !0 : !1, b && (this.stop(), this.start())
},
flip: function(a) {
this.face.flip(!1, a)
}
})
}(jQuery),
function(a) {
"use strict";
FlipClock.List = FlipClock.Base.extend({
digit: 0,
classes: {
active: "flip-clock-active",
before: "flip-clock-before",
flip: "flip"
},
factory: !1,
$el: !1,
$obj: !1,
items: [],
lastDigit: 0,
constructor: function(a, b) {
this.factory = a, this.digit = b, this.lastDigit = b, this.$el = this.createList(), this.$obj = this.$el, b > 0 && this.select(b), this.factory.$el.append(this.$el)
},
select: function(a) {
if ("undefined" == typeof a ? a = this.digit : this.digit = a, this.digit != this.lastDigit) {
var b = this.$el.find("." + this.classes.before).removeClass(this.classes.before);
this.$el.find("." + this.classes.active).removeClass(this.classes.active).addClass(this.classes.before), this.appendListItem(this.classes.active, this.digit), b.remove(), this.lastDigit = this.digit
}
},
play: function() {
this.$el.addClass(this.factory.classes.play)
},
stop: function() {
var a = this;
setTimeout(function() {
a.$el.removeClass(a.factory.classes.play)
}, this.factory.timer.interval)
},
createListItem: function(a, b) {
return ['<li class="' + (a ? a : "") + '">', '<a href="#">', '<div class="up">', '<div class="shadow"></div>', '<div class="inn">' + (b ? b : "") + "</div>", "</div>", '<div class="down">', '<div class="shadow"></div>', '<div class="inn">' + (b ? b : "") + "</div>", "</div>", "</a>", "</li>"].join("")
},
appendListItem: function(a, b) {
var c = this.createListItem(a, b);
this.$el.append(c)
},
createList: function() {
var b = this.getPrevDigit() ? this.getPrevDigit() : this.digit,
c = a(['<ul class="' + this.classes.flip + " " + (this.factory.running ? this.factory.classes.play : "") + '">', this.createListItem(this.classes.before, b), this.createListItem(this.classes.active, this.digit), "</ul>"].join(""));
return c
},
getNextDigit: function() {
return 9 == this.digit ? 0 : this.digit + 1
},
getPrevDigit: function() {
return 0 == this.digit ? 9 : this.digit - 1
}
})
}(jQuery),
function(a) {
"use strict";
String.prototype.ucfirst = function() {
return this.substr(0, 1).toUpperCase() + this.substr(1)
}, a.fn.FlipClock = function(b, c) {
return new FlipClock(a(this), b, c)
}, a.fn.flipClock = function(b, c) {
return a.fn.FlipClock(b, c)
}
}(jQuery),
function(a) {
"use strict";
FlipClock.Time = FlipClock.Base.extend({
time: 0,
factory: !1,
minimumDigits: 0,
constructor: function(a, b, c) {
"object" != typeof c && (c = {}), c.minimumDigits || (c.minimumDigits = a.minimumDigits), this.base(c), this.factory = a, b && (this.time = b)
},
convertDigitsToArray: function(a) {
var b = [];
a = a.toString();
for (var c = 0; c < a.length; c++) a[c].match(/^\d*$/g) && b.push(a[c]);
return b
},
digit: function(a) {
var b = this.toString(),
c = b.length;
return b[c - a] ? b[c - a] : !1
},
digitize: function(b) {
var c = [];
if (a.each(b, function(a, b) {
b = b.toString(), 1 == b.length && (b = "0" + b);
for (var d = 0; d < b.length; d++) c.push(b.charAt(d))
}), c.length > this.minimumDigits && (this.minimumDigits = c.length), this.minimumDigits > c.length)
for (var d = c.length; d < this.minimumDigits; d++) c.unshift("0");
return c
},
getDateObject: function() {
return this.time instanceof Date ? this.time : new Date((new Date).getTime() + 1e3 * this.getTimeSeconds())
},
getDayCounter: function(a) {
var b = [this.getDays(), this.getHours(!0), this.getMinutes(!0)];
return a && b.push(this.getSeconds(!0)), this.digitize(b)
},
getDays: function(a) {
var b = this.getTimeSeconds() / 60 / 60 / 24;
return a && (b %= 7), Math.floor(b)
},
getHourCounter: function() {
var a = this.digitize([this.getHours(), this.getMinutes(!0), this.getSeconds(!0)]);
return a
},
getHourly: function() {
return this.getHourCounter()
},
getHours: function(a) {
var b = this.getTimeSeconds() / 60 / 60;
return a && (b %= 24), Math.floor(b)
},
getMilitaryTime: function(a, b) {
"undefined" == typeof b && (b = !0), a || (a = this.getDateObject());
var c = [a.getHours(), a.getMinutes()];
return b === !0 && c.push(a.getSeconds()), this.digitize(c)
},
getMinutes: function(a) {
var b = this.getTimeSeconds() / 60;
return a && (b %= 60), Math.floor(b)
},
getMinuteCounter: function() {
var a = this.digitize([this.getMinutes(), this.getSeconds(!0)]);
return a
},
getTimeSeconds: function(a) {
return a || (a = new Date), this.time instanceof Date ? this.factory.countdown ? Math.max(this.time.getTime() / 1e3 - a.getTime() / 1e3, 0) : a.getTime() / 1e3 - this.time.getTime() / 1e3 : this.time
},
getTime: function(a, b) {
"undefined" == typeof b && (b = !0), a || (a = this.getDateObject()), console.log(a);
var c = a.getHours(),
d = [c > 12 ? c - 12 : 0 === c ? 12 : c, a.getMinutes()];
return b === !0 && d.push(a.getSeconds()), this.digitize(d)
},
getSeconds: function(a) {
var b = this.getTimeSeconds();
return a && (60 == b ? b = 0 : b %= 60), Math.ceil(b)
},
getWeeks: function(a) {
var b = this.getTimeSeconds() / 60 / 60 / 24 / 7;
return a && (b %= 52), Math.floor(b)
},
removeLeadingZeros: function(b, c) {
var d = 0,
e = [];
return a.each(c, function(a) {
b > a ? d += parseInt(c[a], 10) : e.push(c[a])
}), 0 === d ? e : c
},
addSeconds: function(a) {
this.time instanceof Date ? this.time.setSeconds(this.time.getSeconds() + a) : this.time += a
},
addSecond: function() {
this.addSeconds(1)
},
subSeconds: function(a) {
this.time instanceof Date ? this.time.setSeconds(this.time.getSeconds() - a) : this.time -= a
},
subSecond: function() {
this.subSeconds(1)
},
toString: function() {
return this.getTimeSeconds().toString()
}
})
}(jQuery),
function() {
"use strict";
FlipClock.Timer = FlipClock.Base.extend({
callbacks: {
destroy: !1,
create: !1,
init: !1,
interval: !1,
start: !1,
stop: !1,
reset: !1
},
count: 0,
factory: !1,
interval: 1e3,
animationRate: 1e3,
constructor: function(a, b) {
this.base(b), this.factory = a, this.callback(this.callbacks.init), this.callback(this.callbacks.create)
},
getElapsed: function() {
return this.count * this.interval
},
getElapsedTime: function() {
return new Date(this.time + this.getElapsed())
},
reset: function(a) {
clearInterval(this.timer), this.count = 0, this._setInterval(a), this.callback(this.callbacks.reset)
},
start: function(a) {
this.factory.running = !0, this._createTimer(a), this.callback(this.callbacks.start)
},
stop: function(a) {
this.factory.running = !1, this._clearInterval(a), this.callback(this.callbacks.stop), this.callback(a)
},
_clearInterval: function() {
clearInterval(this.timer)
},
_createTimer: function(a) {
this._setInterval(a)
},
_destroyTimer: function(a) {
this._clearInterval(), this.timer = !1, this.callback(a), this.callback(this.callbacks.destroy)
},
_interval: function(a) {
this.callback(this.callbacks.interval), this.callback(a), this.count++
},
_setInterval: function(a) {
var b = this;
b._interval(a), b.timer = setInterval(function() {
b._interval(a)
}, this.interval)
}
})
}(jQuery),
function(a) {
FlipClock.TwentyFourHourClockFace = FlipClock.Face.extend({
constructor: function(a, b) {
this.base(a, b)
},
build: function(b) {
var c = this,
d = this.factory.$el.find("ul");
this.factory.time.time || (this.factory.original = new Date, this.factory.time = new
It is too long, so divide into two parts, see below