Collection={ artists:[], loaded:false, loading:false, loadedListeners:[], load:function(ready){ if(ready){ Collection.loadedListeners.push(ready); } if(!Collection.loading){ Collection.loading=true; $.ajax({ url: OC.linkTo('media','ajax/api.php')+'?action=get_collection', dataType: 'json', success: function(collection){ Collection.artists=collection; //set the album and artist fieds for the songs for(var i=0;i'); for(var i=0;i'); for(var i=0;ispan').live('click',function(){ $(this).parent().toggleClass('active'); Collection.showAlbums($(this).parent()); }); $('#collection li.album>span').live('click',function(){ $(this).parent().toggleClass('active'); Collection.showSongs($(this).parent()); }); Collection.parent.hide(); $('#scan input.start').click(function(){ $('#scan input.start').hide(); $('#scan input.stop').show(); $('#scan input.stop').click(function(){ Scanner.toggle(); }); Scanner.scanCollection(); }); });