diff options
Diffstat (limited to 'www/js/shows.js')
-rw-r--r-- | www/js/shows.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/www/js/shows.js b/www/js/shows.js index 81d9e5a..1ec986d 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -99,10 +99,25 @@ Rdxport.ShowListView.prototype.updateSelector = function() { $('li', $showSelector).remove(); $(this.model.groups).sort(function(a, b) { - if(a.title.toLowerCase() == b.title.toLowerCase()) { - return b.rhythm - a.rhythm; + var atitle = a.title.toLowerCase(); + var btitle = b.title.toLowerCase(); + if(atitle == btitle) { + if(b.rhythm == a.rhythm) { + if(a.dayofweek == b.dayofweek) { + if(a.starttime == b.starttime) { + return a.showid - b.showid; + } + if(a.starttime > b.starttime) return 1; + return -1; + } + var adow = a.dayofweek == 0 ? 7 : a.dayofweek; + var bdow = b.dayofweek == 0 ? 7 : b.dayofweek; + return adow - bdow; + } + return parseInt(b.rhythm) - parseInt(a.rhythm); } - return a.title.toLowerCase() >= b.title.toLowerCase() + if(atitle > btitle) return 1; + return -1; }).each(function(index, show) { var name = show.id + ' | <strong>' + show.title + '</strong> (' + show.rhythm + ', ' + weekday[show.dayofweek] + ', ' + show.starttime + ', ' + show.length + ' Min.)'; var link = $('<a>').attr('href', '#').html(name).click(function() { |