diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-08-01 01:56:45 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-08-01 01:59:57 +0200 |
commit | ef22498c6f9a7c378d7a7be3fb4df9ac09a14021 (patch) | |
tree | 1429b85c4994215de5850cca94bccbfef494d350 /apps | |
parent | 9b764cb7f4f1438b80f03ae5e080231b8aaa9719 (diff) | |
download | nextcloud-server-ef22498c6f9a7c378d7a7be3fb4df9ac09a14021.tar.gz nextcloud-server-ef22498c6f9a7c378d7a7be3fb4df9ac09a14021.zip |
some fixes for persistent playlists
Diffstat (limited to 'apps')
-rw-r--r-- | apps/media/js/loader.js | 2 | ||||
-rw-r--r-- | apps/media/js/music.js | 9 | ||||
-rw-r--r-- | apps/media/js/player.js | 16 |
3 files changed, 14 insertions, 13 deletions
diff --git a/apps/media/js/loader.js b/apps/media/js/loader.js index 9eb51113f35..429ef742d1a 100644 --- a/apps/media/js/loader.js +++ b/apps/media/js/loader.js @@ -51,7 +51,7 @@ $(document).ready(function() { } if(typeof PlayList==='undefined'){ if(typeof localStorage !== 'undefined'){ - if(localStorage.hasOwnProperty('oc_playlist_items')){ + if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){ loadPlayer(); } } diff --git a/apps/media/js/music.js b/apps/media/js/music.js index 90b5a098002..d5511279717 100644 --- a/apps/media/js/music.js +++ b/apps/media/js/music.js @@ -13,9 +13,11 @@ $(document).ready(function(){ Collection.hide(); }); var tab=window.location.href.slice(window.location.href.indexOf('#') + 1); - if(tab=='collection'){ - $('#plugins a[href="#collection"]').trigger('click'); - } + PlayList.init('mp3',function(){ + if(tab=='collection'){ + $('#plugins a[href="#collection"]').trigger('click'); + } + }); OC.search.customResults.Music=function(row,item){ var parts=item.link.substr(item.link.indexOf('#')+1).split('&'); var data={}; @@ -41,7 +43,6 @@ $(document).ready(function(){ }); row.find('div.name').append(button); } - PlayList.init(); }); diff --git a/apps/media/js/player.js b/apps/media/js/player.js index 6dee7b0ac20..8ef85f4848e 100644 --- a/apps/media/js/player.js +++ b/apps/media/js/player.js @@ -33,9 +33,9 @@ var PlayList={ PlayList.player.jPlayer("setMedia", PlayList.items[PlayList.current]); PlayList.items[index].playcount++; PlayList.player.jPlayer("play"); - localStorage.setItem('oc_playlist_current',index); - localStorage.setItem('oc_playlist_playing','true'); - if(index>=0){ + localStorage.setItem(oc_current_user+'oc_playlist_current',index); + localStorage.setItem(oc_current_user+'oc_playlist_playing','true'); + if(index>0){ var previous=index-1; }else{ var previous=PlayList.items.length-1; @@ -135,15 +135,15 @@ var PlayList={ }, save:function(){ if(typeof localStorage !== 'undefined'){ - localStorage.setItem('oc_playlist_items',JSON.stringify(PlayList.items)); + localStorage.setItem(oc_current_user+'oc_playlist_items',JSON.stringify(PlayList.items)); } }, load:function(){ if(typeof localStorage !== 'undefined'){ - if(localStorage.hasOwnProperty('oc_playlist_items')){ - PlayList.items=JSON.parse(localStorage.getItem('oc_playlist_items')); - PlayList.current=parseInt((localStorage.getItem('oc_playlist_current'))); - if(JSON.parse(localStorage.getItem('oc_playlist_playing'))){ + if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){ + PlayList.items=JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_items')); + PlayList.current=parseInt((localStorage.getItem(oc_current_user+'oc_playlist_current'))); + if(JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_playing'))){ PlayList.play(); } PlayList.render(); |