2011-07-26 18:04:57 +04:00
|
|
|
$(document).ready(function(){
|
|
|
|
//load the collection
|
2011-07-30 01:53:22 +04:00
|
|
|
$('#plugins a[href="#collection"]').click(function(){
|
|
|
|
$('#plugins li.subentry a.active').removeClass('active');
|
|
|
|
$(this).addClass('active');
|
|
|
|
PlayList.hide();
|
|
|
|
Collection.display();
|
|
|
|
});
|
|
|
|
$('#plugins a[href="#playlist"]').click(function(){
|
|
|
|
$('#plugins li.subentry a.active').removeClass('active');
|
|
|
|
$(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);
|
|
|
|
if(tab=='collection'){
|
|
|
|
$('#plugins a[href="#collection"]').trigger('click');
|
|
|
|
}
|
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('=');
|
|
|
|
data[itemParts[0]]=decodeURIComponent(itemParts[1]).replace(/\+/g,' ');
|
|
|
|
}
|
|
|
|
var media=Collection.find(data.artist,data.album,data.song);
|
2011-07-31 03:25:33 +04:00
|
|
|
if(!PlayList.playing()){
|
|
|
|
var button=$('<input type="button" class="play"></input>');
|
|
|
|
button.css('background-image','url('+OC.imagePath('core','actions/play')+')')
|
|
|
|
button.click(function(){
|
|
|
|
var oldSize=PlayList.items.length;
|
|
|
|
PlayList.add(media);
|
|
|
|
PlayList.play(oldSize);
|
|
|
|
PlayList.render();
|
|
|
|
});
|
|
|
|
row.find('div.name').append(button);
|
|
|
|
}else{
|
|
|
|
var button=$('<input type="button" class="add"></input>');
|
|
|
|
button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')')
|
|
|
|
button.click(function(){
|
|
|
|
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]);
|
|
|
|
vars[hash[0]] = decodeURIComponent(hash[1]).replace(/\+/g,' ');
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|