summaryrefslogtreecommitdiffstats
path: root/apps/media/js/playlist.js
blob: c6dc3db2dd40c3b75b9d7eb5e1ff0b0d3dd84aa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
PlayList.render=function(){
	$('#playlist').show();
	PlayList.parent.empty();
	for(var i=0;i<PlayList.items.length;i++){
		var item=PlayList.items[i];
		var li=$('<li/>');
		li.append(item.name);
                li.attr('class', 'jp-playlist-' + i);
		var img=$('<img class="remove svg action" src="'+OC.imagePath('core','actions/delete')+'"/>');
		img.click(function(event){
			event.stopPropagation();
			PlayList.remove($(this).parent().data('index'));
		});
		li.click(function(event){
			PlayList.play($(this).data('index'));
		});
		li.append(img)
		li.data('index',i);
		li.addClass('song');
		PlayList.parent.append(li);
	}
        $(".jp-playlist-" + PlayList.current).addClass("collection_playing");
}
PlayList.getSelected=function(){
	return $('tbody td.name input:checkbox:checked').parent().parent();
}
PlayList.hide=function(){
	$('#playlist').hide();
}

$(document).ready(function(){
	PlayList.parent=$('#leftcontent');
	$('#selectAll').click(function(){
		if($(this).attr('checked')){
			// Check all
			$('#leftcontent li.song input:checkbox').attr('checked', true);
			$('#leftcontent li.song input:checkbox').parent().addClass('selected');
		}else{
			// Uncheck all
			$('#leftcontent li.song input:checkbox').attr('checked', false);
			$('#leftcontent li.song input:checkbox').parent().removeClass('selected');
		}
	});
});