var PlayList={ urlBase:OC.linkTo('media','ajax/api.php')+'?action=play&path=', current:-1, items:[], player:null, volume:0.8, active:false, tempPlaylist:[], isTemp:true, next:function(){ var items=(PlayList.isTemp)?PlayList.tempPlaylist:PlayList.items; var next=PlayList.current+1; if(next>=items.length){ next=0; } PlayList.play(next); PlayList.render(); }, previous:function(){ var items=(PlayList.isTemp)?PlayList.tempPlaylist:PlayList.items; var next=PlayList.current-1; if(next<0){ next=items.length-1; } PlayList.play(next); PlayList.render(); }, play:function(index,time,ready){ var items=(PlayList.isTemp)?PlayList.tempPlaylist:PlayList.items; if(index==null){ index=PlayList.current; } if(index>-1 && index0){ var previous=index-1; }else{ var previous=items.length-1; } if(index+10){ PlayList.current=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_current')); var time=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_time')); if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_volume')){ var volume=localStorage.getItem(oc_current_user+'oc_playlist_volume'); PlayList.volume=volume/100; $('.jp-volume-bar-value').css('width',volume+'%'); if(PlayList.player.data('jPlayer')){ PlayList.player.jPlayer("option",'volume',volume/100); } } if(JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_playing'))){ PlayList.play(null,time); }else{ PlayList.play(null,time,function(){ PlayList.player.jPlayer("pause"); }); } PlayList.render(); } } } } } $(document).ready(function(){ $(window).bind('beforeunload', function (){ PlayList.save(); }); $('jp-previous').tipsy({gravity:'n', fade:true, live:true}); $('jp-next').tipsy({gravity:'n', fade:true, live:true}); })