Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</head>
<body>

<div class="top left"><div class="date small dimmed"></div><div class="time"></div><div class="calendar xxsmall"></div></div>
<div class="top right"><div class="windsun small dimmed"></div><div class="temp"></div><div class="forecast small dimmed"></div></div>
<div class="top left"><div class="date small dimmed"></div><div class="time" id="time"></div><div class="calendar xxsmall"></div></div>
<div class="center-ver center-hor"><!-- <div class="dishwasher light">Vaatwasser is klaar!</div> --></div>
<div class="lower-third center-hor"><div class="compliment light"></div></div>
<div class="bottom center-hor"><div class="news medium"></div></div>
Expand Down
34 changes: 25 additions & 9 deletions js/time/time.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
var time = {
timeFormat: config.time.timeFormat || 24,
dateLocation: '.date',
timeLocation: '.time',
updateInterval: 1000,
timeLocation: '#time',
updateInterval: 10000,
intervalId: null
};

/**
* Updates the time that is shown on the screen
*/
time.updateTime = function () {

var _now = moment(),
_date = _now.format('dddd, LL');

$(this.dateLocation).html(_date);
$(this.timeLocation).html(_now.format(this._timeFormat+':mm[<span class="sec">]ss[</span>]'));
var timeLocation = this.timeLocation;
var _now = moment();
var _date = _now.format('[<span class="dayname">]dddd,[</span> <span class="longdate">]LL[</span>]');

$(this.dateLocation).updateWithText(_date, 1000);
$('.fade').removeClass('fade')
var diff = $('<div>').html(_now.format(this._timeFormat+':mm').replace(/./g, "<span>$&</span>"));
diff.children().each(function( index ) {
var _text = $( this ).text();
var _i = index+1;
var _text2 = $(timeLocation + ' span:nth-child('+_i+')').text();
if (_text != _text2) {
$(timeLocation +' span:nth-child('+_i+')').addClass('fade');
$(this).addClass('fade');
}
});
$('.fade').fadeTo(400, 0.25, function() {
$(timeLocation).html(diff.html());
$(timeLocation).children().fadeTo(400, 1).removeClass('fade');
}).bind(this);

}

Expand All @@ -26,9 +40,11 @@ time.init = function () {
} else {
time._timeFormat = 'HH';
}
$(this.timeLocation).html('<span class="fade"></span>');

this.intervalId = setInterval(function () {
this.updateTime();
}.bind(this), 1000);
}.bind(this), this.updateInterval);
this.updateTime();

}