]> source.dussan.org Git - nextcloud-server.git/commitdiff
some fixes for persistent playlists
authorRobin Appelman <icewind1991@gmail.com>
Sun, 31 Jul 2011 23:56:45 +0000 (01:56 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Sun, 31 Jul 2011 23:59:57 +0000 (01:59 +0200)
apps/media/js/loader.js
apps/media/js/music.js
apps/media/js/player.js
core/templates/layout.admin.php
core/templates/layout.user.php

index 9eb51113f3585bec37beb56d33969da7c41c978c..429ef742d1a872706d746b3cb2a242fbd24a295c 100644 (file)
@@ -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();
                        }
                }
index 90b5a098002e6b86b4fce72bb53af6a90330bcfe..d55112797173f29e649dd94bac22582ad109c082 100644 (file)
@@ -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();
 });
 
 
index 6dee7b0ac20df8a5ac69d7570597eac6d5a3e347..8ef85f4848e3a17eacbba0e8213d523ba22eadd4 100644 (file)
@@ -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();
index 3aac4c98ac58c9c92020981d4ea5f97380564502..be4419af84911fe05ccc52afd40737c9e66d9eeb 100644 (file)
@@ -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>
index 1de0ccf80c1284baeffa05931fa89547ceb08369..33de9d5f72f2ba63c069fa3a66e6fd81a788530d 100644 (file)
@@ -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>