diff options
-rw-r--r-- | www/js/nextshows.js | 36 | ||||
-rw-r--r-- | www/styles/nextshows.css | 7 |
2 files changed, 39 insertions, 4 deletions
diff --git a/www/js/nextshows.js b/www/js/nextshows.js index f0f732b..b831e86 100644 --- a/www/js/nextshows.js +++ b/www/js/nextshows.js @@ -87,15 +87,16 @@ rh.ShowListView.prototype.render = function() { $('div.show', list).remove(); this.showViews = []; - var now = clock.now(); + var nowutc = clock.now(); for (var i = 0; i < this.model.shows.length; i++) { - if((now.valueOf() + (this.model.shows[i].end.getTimezoneOffset() * 60000)) > this.model.shows[i].end) { + var now = (nowutc.valueOf() + (this.model.shows[i].end.getTimezoneOffset() * 60000)); + if(now > this.model.shows[i].end) { continue; } var showView = new rh.ShowView(this.model.shows[i], this); this.showViews.push(showView); - showView.render(); + showView.render(now); list.append(showView.$el); if(this.showViews.length >= this.maxlen) { break; @@ -111,7 +112,7 @@ rh.ShowView = function(model, listView) { this.$el = $('<div>'); }; -rh.ShowView.prototype.render = function() { +rh.ShowView.prototype.render = function(now) { var startstr = "Beginn: " + format_time(this.model.start); var start = $('<span>').addClass('show-start').text(startstr); @@ -124,6 +125,33 @@ rh.ShowView.prototype.render = function() { var title = $('<span>').addClass('show-title').text(this.model.title); this.$el.empty().addClass('show').append(start).append(end).append(title); + var until = this.model.start - now; + if(until > 138000) { + return + } + if(until > 123000) { + if(until%2000 >= 1000) { + this.$el.addClass('soon'); + } + return + } + if(until > 30000) { + this.$el.addClass('soon'); + return + } + if(until > 10000) { + if(until%2000 >= 1000) { + this.$el.addClass('imminent'); + } + return + } + if(until > 0) { + if(until%1000 >= 500) { + this.$el.addClass('imminent'); + } + return + } + this.$el.addClass('imminent'); } diff --git a/www/styles/nextshows.css b/www/styles/nextshows.css index 73efce8..67ae14c 100644 --- a/www/styles/nextshows.css +++ b/www/styles/nextshows.css @@ -103,3 +103,10 @@ span.show-title { #shows div:first-child span.show-title { font-size: 1.2em; } + +.soon { + background-color: #f0ad4e !important; +} +.imminent { + background-color: #d9534f !important; +} |