diff options
Diffstat (limited to 'www/js/nextshows.js')
-rw-r--r-- | www/js/nextshows.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/www/js/nextshows.js b/www/js/nextshows.js index 6d85f55..f0f732b 100644 --- a/www/js/nextshows.js +++ b/www/js/nextshows.js @@ -69,9 +69,9 @@ rh.Show = function(show) { var showListView = null; -rh.ShowListView = function(model, len) { +rh.ShowListView = function(model, maxlen) { this.model = model; - this.len = len; + this.maxlen = maxlen; this.showViews = []; @@ -97,6 +97,9 @@ rh.ShowListView.prototype.render = function() { this.showViews.push(showView); showView.render(); list.append(showView.$el); + if(this.showViews.length >= this.maxlen) { + break; + } } }; @@ -128,8 +131,16 @@ rh.ShowView.prototype.render = function() { /***************** controller *****************/ function nextshows_init() { + var url = parseLocationHref(); + var maxlen = 5; + if(url.path.length > 1) { + var tmp = parseInt(url.path[1], 10); + if(!isNaN(tmp) && tmp > 0) { + maxlen = tmp; + } + } shows = new rh.ShowList(); - showListView = new rh.ShowListView(shows, 10); + showListView = new rh.ShowListView(shows, maxlen); setInterval("shows.fetch()", 5000); clock.addCallback(function() { |