summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-06-02 11:06:54 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-06-02 11:06:54 (GMT)
commita0e8d4339c6b08c4a2908ebcd342bb542b51f5ad (patch)
tree4d952fcbc452071f62a0cc44a29c8fc9df4188a0 /www
parent54cd6bb3340f8669f362b8d4ee5e3be680ad22f1 (diff)
added support for specials show name from PV
Diffstat (limited to 'www')
-rw-r--r--www/js/nextshows.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/www/js/nextshows.js b/www/js/nextshows.js
index ee6eeaf..b6d0a05 100644
--- a/www/js/nextshows.js
+++ b/www/js/nextshows.js
@@ -32,13 +32,14 @@ var shows = null;
rh.ShowList = function() {
this.$this = $(this);
this.shows = [];
+ this.pv_names = {};
};
rh.ShowList.prototype.fetch = function() {
var self = this;
var yd = new Date((new Date()) - 24 * 3600 * 1000);
var ydstr = yd.getFullYear() + '-' + Number(yd.getMonth() + 1).pad(2) + '-' + Number(yd.getDate()).pad(2);
- $.getJSON( "/rh-bin/schedules.json?DAYS=3&START=" + ydstr, function(data) {
+ $.getJSON("/rh-bin/schedules.json?DAYS=3&START=" + ydstr, function(data) {
if(data.status == "OK") {
self.shows = [];
$(data.shows).each(function(index, showdata) {
@@ -53,6 +54,16 @@ rh.ShowList.prototype.fetch = function() {
self.$this.trigger('update');
}
});
+
+ $.getJSON("/pv-export/timeslots_specials.json", function(data) {
+ self.pv_names = {};
+ $.each(data, function(specialid, specialdata) {
+ if(specialdata.pv_id >= 0) {
+ self.pv_names[specialdata.id] = specialdata.pv_name;
+ }
+ });
+ self.$this.trigger('update');
+ });
};
rh.Show = function(show) {
@@ -61,6 +72,7 @@ rh.Show = function(show) {
this.start = new Date(show.start);
this.len = show.len;
this.end = new Date(this.start.valueOf() + show.len);
+ this.pv_name = "";
};
@@ -94,6 +106,7 @@ rh.ShowListView.prototype.render = function() {
continue;
}
+ this.model.shows[i].pv_name = this.model.pv_names[this.model.shows[i].id];
var showView = new rh.ShowView(this.model.shows[i], this);
this.showViews.push(showView);
showView.render(now);
@@ -122,7 +135,11 @@ rh.ShowView.prototype.render = function(now) {
}
var end = $('<span>').addClass('show-end').text(endstr);
- var title = $('<span>').addClass('show-title').text(this.model.title);
+ var t = this.model.title;
+ if(typeof this.model.pv_name !== 'undefined' && this.model.pv_name != "") {
+ t = this.model.pv_name;
+ }
+ var title = $('<span>').addClass('show-title').text(t);
this.$el.empty().addClass('show').append(start).append(end).append(title);
var until = this.model.start - now;