summaryrefslogtreecommitdiffstats
path: root/apps/media/js/collection.js
diff options
context:
space:
mode:
authorCôme BERNIGAUD <come.bernigaud@laposte.net>2011-09-01 18:31:09 +0200
committerCôme BERNIGAUD <come.bernigaud@laposte.net>2011-09-01 18:31:44 +0200
commit31a094becb904cf90a0315baa884ee4347cd48e2 (patch)
treeb01ce06b9d244c41c41a622575ca0eaf7fb87ecd /apps/media/js/collection.js
parent0c07312ad88be9074fe2154c9180a028fbad16e0 (diff)
downloadnextcloud-server-31a094becb904cf90a0315baa884ee4347cd48e2.tar.gz
nextcloud-server-31a094becb904cf90a0315baa884ee4347cd48e2.zip
Buttons for play/add albums works. Folding albums too.
Diffstat (limited to 'apps/media/js/collection.js')
-rw-r--r--apps/media/js/collection.js42
1 files changed, 36 insertions, 6 deletions
diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js
index 405fbbcf4a5..a35a8c6104a 100644
--- a/apps/media/js/collection.js
+++ b/apps/media/js/collection.js
@@ -122,6 +122,7 @@ Collection={
}else{
var newRow=tr.clone();
}
+ newRow.find('.expander').remove();
if(i==0){
newRow.find('td.album a').text(album.name);
newRow.find('td.album a').click(function(event){
@@ -131,12 +132,23 @@ Collection={
Collection.parent.find('tr').removeClass('active');
$('tr[data-album="'+album.name+'"]').addClass('active');
});
- }else{
- newRow.find('.expander').remove();
+ var expander=$('<a class="expander">v </a>');
+ expander.data('expanded',true);
+ expander.click(function(event){
+ var tr=$(this).parent().parent();
+ if(expander.data('expanded')) {
+ Collection.hideAlbum(tr.data('artist'),tr.data('album'));
+ } else {
+ Collection.showAlbum(tr.data('artist'),tr.data('album'));
+ }
+ });
+ newRow.children('td.artist').append(expander);
+ Collection.addButtons(newRow,album);
+ } else {
newRow.find('td.album a').text('');
+ Collection.addButtons(newRow,song);
}
newRow.find('td.title a').text(song.name);
- Collection.addButtons(newRow,song);
newRow.find('td.title a').click(function(event){
event.preventDefault();
PlayList.add(song);
@@ -174,15 +186,33 @@ Collection={
tr.find('a.expander').data('expanded',false);
tr.find('a.expander').removeClass('expanded');
tr.find('a.expander').text('>');
+ Collection.addButtons(tr,artist);
}
},
+ //~ showAlbum:function(artist,album){
+ //~ alert(album.name);
+ //~ Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').show();
+ //~ },
showAlbum:function(artist,album){
- Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').show();
+ var tr = Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]');
+ tr.find('a.expander').data('expanded',true);
+ tr.find('a.expander').addClass('expanded');
+ tr.find('a.expander').text('v ');
+ tr.show();
},
hideAlbum:function(artist,album){
- Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').hide();
- Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').last().show();
+ var tr = Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]');
+ tr.find('a.expander').data('expanded',false);
+ tr.find('a.expander').removeClass('expanded');
+ tr.find('a.expander').text('> ');
+ tr.hide();
+ tr.first().show();
},
+ //~ hideAlbum:function(artist,album){
+ //~ Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').hide();
+ //~ Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').last().show();
+ //~ alert(album.name);
+ //~ },
parent:null,
hide:function(){
if(Collection.parent){