correctly save the playlist if songs are removed and dont load the player outisde the media app if the playlist is empty
This commit is contained in:
parent
a84b00cefc
commit
8e5184a8b9
|
@ -51,7 +51,7 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
if(typeof PlayList==='undefined'){
|
if(typeof PlayList==='undefined'){
|
||||||
if(typeof localStorage !== 'undefined'){
|
if(typeof localStorage !== 'undefined'){
|
||||||
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){
|
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items' && localStorage.getItem(oc_current_user+'oc_playlist_items')!='[]'){
|
||||||
loadPlayer();
|
loadPlayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,7 @@ var PlayList={
|
||||||
remove:function(index){
|
remove:function(index){
|
||||||
PlayList.items.splice(index,1);
|
PlayList.items.splice(index,1);
|
||||||
PlayList.render();
|
PlayList.render();
|
||||||
|
PlayList.save();
|
||||||
},
|
},
|
||||||
render:function(){},
|
render:function(){},
|
||||||
playing:function(){
|
playing:function(){
|
||||||
|
@ -160,6 +161,7 @@ var PlayList={
|
||||||
if(typeof localStorage !== 'undefined'){
|
if(typeof localStorage !== 'undefined'){
|
||||||
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){
|
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){
|
||||||
PlayList.items=JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_items'));
|
PlayList.items=JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_items'));
|
||||||
|
if(PlayList.items.length>0){
|
||||||
PlayList.current=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_current'));
|
PlayList.current=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_current'));
|
||||||
var time=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_time'));
|
var time=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_time'));
|
||||||
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_volume')){
|
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_volume')){
|
||||||
|
@ -182,3 +184,4 @@ var PlayList={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -135,6 +135,7 @@ function procesSelection(){
|
||||||
});
|
});
|
||||||
PlayList.items=PlayList.items.filter(function(item){return item!==null});
|
PlayList.items=PlayList.items.filter(function(item){return item!==null});
|
||||||
PlayList.render();
|
PlayList.render();
|
||||||
|
PlayList.save();
|
||||||
procesSelection();
|
procesSelection();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue