summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-06-26 12:26:18 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-06-26 12:27:47 (GMT)
commit00990cfc88abc194d9eb56c3d7fd2c34beceb962 (patch)
treec110323a3391b4585f40e9f5bc9ea1a5c7d7ff41 /www/js
parentb9786455d28bf9dff37a5c88276513549a8be14d (diff)
marking soon and imminent shows works now
Diffstat (limited to 'www/js')
-rw-r--r--www/js/nextshows.js36
1 files changed, 32 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');
}