2011-07-26 14:04:57 +00:00
|
|
|
$(document).ready(function(){
|
2011-07-30 22:50:04 +00: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-07-31 22:25:53 +00:00
|
|
|
data[itemParts[0]]=itemParts[1].replace(/\+/g,' ');
|
2011-07-30 22:50:04 +00:00
|
|
|
}
|
|
|
|
var media=Collection.find(data.artist,data.album,data.song);
|
2011-07-30 23:39:25 +00: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();
|
|
|
|
});
|
2011-09-28 09:45:22 +00:00
|
|
|
var button=$('<input type="button" title="'+t('media','Add album to playlist')+'" class="add"></input>');
|
2011-07-30 23:39:25 +00:00
|
|
|
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-09-29 21:54:33 +00:00
|
|
|
button.tipsy({gravity:'n', fade:true, delayIn: 400, live:true});
|
2011-07-30 22:50:04 +00:00
|
|
|
}
|
2011-08-08 15:53:03 +00:00
|
|
|
Collection.display();
|
2011-07-26 14:04:57 +00:00
|
|
|
});
|
2011-07-22 04:30:52 +00:00
|
|
|
|
2011-07-29 21:53:22 +00:00
|
|
|
|
2011-07-22 04:30:52 +00: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-07-31 22:25:53 +00:00
|
|
|
vars[hash[0]] = hash[1].replace(/\+/g,' ');
|
2011-07-22 04:30:52 +00:00
|
|
|
}
|
|
|
|
return vars;
|
2011-07-26 14:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function musicTypeFromFile(file){
|
2011-07-29 21:53:22 +00:00
|
|
|
var extention=file.split('.').pop();
|
2011-07-26 14:04:57 +00:00
|
|
|
if(extention=='ogg'){
|
|
|
|
return 'oga'
|
|
|
|
}
|
|
|
|
//TODO check for more specific cases
|
|
|
|
return extention;
|
2011-07-22 04:30:52 +00:00
|
|
|
}
|