Skip to content
Snippets Groups Projects
Commit b71ea287 authored by Robin Appelman's avatar Robin Appelman
Browse files

reimplement auto playing music from location hash (like from search results)

parent 8de4163b
No related branches found
No related tags found
No related merge requests found
......@@ -26,18 +26,25 @@ $(document).ready(function(){
button.tipsy({gravity:'n', fade:true, delayIn: 400, live:true});
}
Collection.display();
Collection.load(function(){
var urlVars=getUrlVars();
if(urlVars.artist){
var song=Collection.find(urlVars.artist,urlVars.album,urlVars.song);
PlayList.add(song);
PlayList.play(0);
}
})
});
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++)
{
var vars = {}, hash;
var hashes = window.location.hash.substr(1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1].replace(/\+/g,' ');
vars[hash[0]] = decodeURIComponent(hash[1]).replace(/\+/g,' ');
}
return vars;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment