function i(b){b.width=440;b.height=70;this.b=b.getContext("2d");this.a()}var k=["...!. .!. .!. .!...",".. ! . ! . ! . !...","...! .!...!. !...","...! .!...! .!...",". .!. .!...! .! .","...!. !...! .!...","...!. !...!. .!...","...! .! . ! . ! . ","...!. .!...!. .!...","...!. .!...! .!..."];
i.prototype={a:function(){var b=this,c=b.b,a=new Date;a=m(a.getHours(),2)+":"+m(a.getMinutes(),2)+":"+m(a.getSeconds(),2)+":"+(""+a.getMilliseconds()).charAt(0);var d,e,f,g,l,h=0,j=0;c.clearRect(0,0,500,70);a=a.split("");for(d=-1;++d<10;){h+=d==0?0:10;g=a[d]==":"?[" ",".","",".",""]:k[a[d]].split("!");l=g[0].length;for(f=-1;++f<l;){h+=10;j=0;for(e=-1;++e<5;){c.fillStyle="."==g[e].charAt(f)?"rgb(0,0,0)":"rgba(0,0,0,0)";c.fillRect(h,j+10,12,12);c.fillStyle="."==g[e].charAt(f)?d>7?"#DDD":"yellow":"rgba(0,0,0,0)";
c.fillRect(h,j+=10,10,10)}}}a=+new Date;setTimeout(function(){b.a()},Math.ceil(a/100)*100-a)}};function m(b,c){return Array(c+1-(b+"").length).join("0")+b}new i(document.getElementById("c"));
function Clock(c) {
var h = this;
c.width = 440;
c.height = 70;
h._ = c.getContext('2d');
h.sec();
}
var dig = [
'...!. .!. .!. .!...',
'.. ! . ! . ! . !...',
'...! .!...!. !...',
'...! .!...! .!...',
'. .!. .!...! .! .',
'...!. !...! .!...',
'...!. !...!. .!...',
'...! .! . ! . ! . ',
'...!. .!...!. .!...',
'...!. .!...! .!...'
];
Clock.prototype = {
sec: function() {
var h = this,
_ = h._,
date = new Date,
time = pad(date.getHours(), 2) + ':' +
pad(date.getMinutes(), 2) + ':' +
pad(date.getSeconds(), 2) + ':' +
(''+date.getMilliseconds()).charAt(0),
i, y, x, digit,
digitWidth,
aX = 0, aY = 0;
_.clearRect(0, 0, 500, 70);
time = time.split('');
for (i = -1; ++i < 10;) {
aX += i == 0 ? 0 : 10;
digit = time[i] == ':' ? [' ','.','','.',''] : dig[time[i]].split('!');
digitWidth = digit[0].length;
for (x = -1; ++x < digitWidth;) {
aX += 10;
for (aY = 0, y = -1; ++y < 5;) {
_.fillStyle = '.'==digit[y].charAt(x) ? 'rgb(0,0,0)' : 'rgba(0,0,0,0)';
_.fillRect(aX, aY + 10, 12, 12);
_.fillStyle = '.'==digit[y].charAt(x) ? i > 7 ? '#DDD': 'yellow' : 'rgba(0,0,0,0)';
_.fillRect(aX, aY += 10, 10, 10);
}
}
}
time = +new Date;
setTimeout(function(){
h.sec();
}, Math.ceil(time/100)*100 - time);
}
};
function pad(n, l) {
return Array(l+1-(n+'').length).join('0') + n;
}
new Clock(document.getElementById("c"));