2011-07-26 18:04:57 +04:00
|
|
|
$(document).ready(function(){
|
|
|
|
//load the collection
|
2011-08-02 06:13:19 +04:00
|
|
|
$('#navigation a[href="#collection"]').click(function(){
|
|
|
|
$('#navigation li.subentry a.active').removeClass('active');
|
2011-07-30 01:53:22 +04:00
|
|
|
$(this).addClass('active');
|
|
|
|
PlayList.hide();
|
|
|
|
Collection.display();
|
|
|
|
});
|
2011-08-02 06:13:19 +04:00
|
|
|
$('#navigation a[href="#playlist"]').click(function(){
|
|
|
|
$('#navigation li.subentry a.active').removeClass('active');
|
2011-07-30 01:53:22 +04:00
|
|
|
$(this).addClass('active');
|
|
|
|
PlayList.render();
|
|
|
|
Collection.hide();
|
2011-07-22 08:30:52 +04:00
|
|
|
});
|
2011-07-30 02:32:09 +04:00
|
|
|
var tab=window.location.href.slice(window.location.href.indexOf('#') + 1);
|
2011-08-01 03:56:45 +04:00
|
|
|
PlayList.init('mp3',function(){
|
|
|
|
if(tab=='collection'){
|
2011-08-02 06:13:19 +04:00
|
|
|
$('#navigation a[href="#collection"]').trigger('click');
|
2011-08-01 03:56:45 +04:00
|
|
|
}
|
|
|
|
});
|
2011-07-31 02:50:04 +04:00
|
|
|
OC.search.customResults.Music=function(row,item){
|
|
|
|
var parts=item.link.substr(item.link.indexOf('#')+1).split('&');
|
|
|
|
var data={};
|
|
|
|
for(var i=0;i<parts.length;i++){
|
|
|
|
var itemParts=parts[i].split('=');
|
2011-08-01 02:25:53 +04:00
|
|
|
data[itemParts[0]]=itemParts[1].replace(/\+/g,' ');
|
2011-07-31 02:50:04 +04:00
|
|
|
}
|
|
|
|
var media=Collection.find(data.artist,data.album,data.song);
|
2011-07-31 03:39:25 +04:00
|
|
|
var a=row.find('a');
|
|
|
|
a.attr('href','#');
|
|
|
|
a.click(function(){
|
|
|
|
var oldSize=PlayList.items.length;
|
|
|
|
PlayList.add(media);
|
|
|
|
PlayList.play(oldSize);
|
|
|
|
PlayList.render();
|
|
|
|
});
|
|
|
|
var button=$('<input type="button" title="Add to playlist" class="add"></input>');
|
|
|
|
button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')')
|
|
|
|
button.click(function(event){
|
|
|
|
event.stopPropagation();
|
|
|
|
PlayList.add(media);
|
|
|
|
PlayList.render();
|
|
|
|
});
|
|
|
|
row.find('div.name').append(button);
|
2011-07-31 02:50:04 +04:00
|
|
|
}
|
2011-07-26 18:04:57 +04:00
|
|
|
});
|
2011-07-22 08:30:52 +04:00
|
|
|
|
2011-07-30 01:53:22 +04:00
|
|
|
|
2011-07-22 08:30:52 +04:00
|
|
|
|
|
|
|
function getUrlVars(){
|
|
|
|
var vars = [], hash;
|
|
|
|
var hashes = window.location.href.slice(window.location.href.indexOf('#') + 1).split('&');
|
|
|
|
for(var i = 0; i < hashes.length; i++)
|
|
|
|
{
|
|
|
|
hash = hashes[i].split('=');
|
|
|
|
vars.push(hash[0]);
|
2011-08-01 02:25:53 +04:00
|
|
|
vars[hash[0]] = hash[1].replace(/\+/g,' ');
|
2011-07-22 08:30:52 +04:00
|
|
|
}
|
|
|
|
return vars;
|
2011-07-26 18:04:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function musicTypeFromFile(file){
|
2011-07-30 01:53:22 +04:00
|
|
|
var extention=file.split('.').pop();
|
2011-07-26 18:04:57 +04:00
|
|
|
if(extention=='ogg'){
|
|
|
|
return 'oga'
|
|
|
|
}
|
|
|
|
//TODO check for more specific cases
|
|
|
|
return extention;
|
2011-07-22 08:30:52 +04:00
|
|
|
}
|