diff options
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/musicpools.js | 10 | ||||
-rw-r--r-- | www/js/shows.js | 21 |
2 files changed, 27 insertions, 4 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js index 0ce1c9c..db295c7 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -99,7 +99,15 @@ Rdxport.MusicpoolsView.prototype.updateSelector = function() { $('li', $musicpoolSelector).remove(); $(this.model.groups).sort(function(a, b) { - return a.title.toLowerCase() >= b.title.toLowerCase() + var atitle = a.title.toLowerCase(); + var btitle = b.title.toLowerCase(); + if(atitle == btitle) { + if(a.clock > b.clock) return 1; + if(a.clock < b.clock) return -1; + return 0; + } + if(atitle > btitle) return 1; + return -1; }).each(function(index, musicpool) { var name = '<strong>' + musicpool.title + '</strong> (' + musicpool.clock + ')'; var link = $('<a>').attr('href', '#').html(name).click(function() { 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() { |