var PlayList={ urlBase:OC.linkTo('media','ajax/api.php')+'?action=play&path=', current:-1, items:[], player:null, parent:null, next:function(){ var next=PlayList.current+1; if(next>=PlayList.items.length){ next=0; } PlayList.play(next); }, previous:function(){ var next=PlayList.current-1; if(next<0){ next=PlayList.items.length-1; } PlayList.play(next); }, play:function(index){ if(index==null){ index=PlayList.current; } if(index>-1 && index'+song.artist+' - '+song.album+' - '+song.name+''); item.data('artist',song.artist); item.data('album',song.album); item.data('name',song.name); item.data('index',i); item.click(function(){ PlayList.play($(this).data('index')); PlayList.render(); }); if(i==PlayList.current){ item.addClass('current'); } parent.append(item); } } } }