some fixes for persistent playlists
This commit is contained in:
parent
9b764cb7f4
commit
ef22498c6f
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<?php endforeach; ?>
|
||||
<script type="text/javascript">
|
||||
var oc_webroot = '<?php global $WEBROOT; echo $WEBROOT; ?>';
|
||||
var oc_current_user = '<?php echo OC_User::getUser() ?>';
|
||||
// </script>
|
||||
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
||||
<script type="text/javascript" src="<?php echo $jsfile; ?>"></script>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<?php endforeach; ?>
|
||||
<script type="text/javascript">
|
||||
var oc_webroot = '<?php global $WEBROOT; echo $WEBROOT; ?>';
|
||||
var oc_current_user = '<?php echo OC_User::getUser() ?>';
|
||||
// </script>
|
||||
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
||||
<script type="text/javascript" src="<?php echo $jsfile; ?>"></script>
|
||||
|
|
Loading…
Reference in New Issue