var App = function () { this.init = function (rootElement) { this.rootElement = $(rootElement); this.storage = window.localStorage; this.difference = Config.countdownEndUTC - new Date().getTime(); this.render(); } this.render = function () { if (this.difference > 0) { this.renderCountdown() } else { Utils.redirect('live.html'); } } this.renderCountdown = function () { $(document.body).attr('class', 'countdown'); this.rootElement.empty(); var title = $('
', {'class': 'content-main-title title-countdown'}).html('Event starts in'); var self = this; $('#main-content').append([title, $('', {id: 'countdown-widget'})]) var clock = $('#countdown-widget').FlipClock(this.difference/1000, { clockFace: 'DailyCounter', countdown: true, showSeconds: false, stop: function () { console.info('COUNTDOWN ENDED') Utils.redirect('live.html'); } }); } }