move time into its own file and folder

This commit is contained in:
Jon Heller
2015-10-18 22:16:45 -04:00
parent 0dee9c0bd9
commit c2f9d0a06c
6 changed files with 118 additions and 24 deletions

31
js/time/time.js Normal file
View File

@@ -0,0 +1,31 @@
var time = {
timeFormat: config.time.timeFormat || 24,
dateLocation: '.date',
timeLocation: '.time',
updateInterval: 1000,
intervalId: null
};
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>]'));
}
time.init = function () {
if (parseInt(time.timeFormat) === 12) {
time._timeFormat = 'hh'
} else {
time._timeFormat = 'HH';
}
this.intervalId = setInterval(function () {
this.updateTime();
}.bind(this), 1000);
}