2011-07-29 21:53:22 +00:00
|
|
|
PlayList.render=function(){
|
|
|
|
$('#playlist').show();
|
|
|
|
PlayList.parent.empty();
|
|
|
|
for(var i=0;i<PlayList.items.length;i++){
|
|
|
|
var item=PlayList.items[i];
|
2011-08-11 09:27:14 +00:00
|
|
|
var li=$('<li/>');
|
|
|
|
li.append(item.name);
|
2011-09-28 09:45:22 +00:00
|
|
|
li.attr('class', 'jp-playlist-' + i);
|
2011-08-13 03:27:50 +00:00
|
|
|
var img=$('<img class="remove svg action" src="'+OC.imagePath('core','actions/delete')+'"/>');
|
2011-08-11 09:27:14 +00:00
|
|
|
img.click(function(event){
|
2011-07-29 21:53:22 +00:00
|
|
|
event.stopPropagation();
|
2011-08-11 09:27:14 +00:00
|
|
|
PlayList.remove($(this).parent().data('index'));
|
|
|
|
});
|
|
|
|
li.click(function(event){
|
|
|
|
PlayList.play($(this).data('index'));
|
2011-07-29 21:53:22 +00:00
|
|
|
});
|
2011-08-11 09:27:14 +00:00
|
|
|
li.append(img)
|
|
|
|
li.data('index',i);
|
|
|
|
li.addClass('song');
|
|
|
|
PlayList.parent.append(li);
|
2011-07-29 21:53:22 +00:00
|
|
|
}
|
2011-09-28 09:45:22 +00:00
|
|
|
$(".jp-playlist-" + PlayList.current).addClass("collection_playing");
|
2011-07-29 21:53:22 +00:00
|
|
|
}
|
|
|
|
PlayList.getSelected=function(){
|
2011-07-29 22:05:44 +00:00
|
|
|
return $('tbody td.name input:checkbox:checked').parent().parent();
|
2011-07-29 21:53:22 +00:00
|
|
|
}
|
|
|
|
PlayList.hide=function(){
|
|
|
|
$('#playlist').hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
2011-08-11 09:27:14 +00:00
|
|
|
PlayList.parent=$('#leftcontent');
|
2011-07-29 21:53:22 +00:00
|
|
|
$('#selectAll').click(function(){
|
|
|
|
if($(this).attr('checked')){
|
|
|
|
// Check all
|
2011-08-11 09:27:14 +00:00
|
|
|
$('#leftcontent li.song input:checkbox').attr('checked', true);
|
|
|
|
$('#leftcontent li.song input:checkbox').parent().addClass('selected');
|
2011-07-29 21:53:22 +00:00
|
|
|
}else{
|
|
|
|
// Uncheck all
|
2011-08-11 09:27:14 +00:00
|
|
|
$('#leftcontent li.song input:checkbox').attr('checked', false);
|
|
|
|
$('#leftcontent li.song input:checkbox').parent().removeClass('selected');
|
2011-07-29 21:53:22 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|