summaryrefslogtreecommitdiffstats
path: root/apps/media
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2012-01-12 02:02:45 +0100
committerRobin Appelman <icewind1991@gmail.com>2012-01-12 02:02:45 +0100
commitb71ea287aac37237c948ae9f8c825ddda0601857 (patch)
treeab6ff0273483b40124273e160f9e36f290f6648a /apps/media
parent8de4163ba234a2eca124e2f389e9d4c999f06c00 (diff)
downloadnextcloud-server-b71ea287aac37237c948ae9f8c825ddda0601857.tar.gz
nextcloud-server-b71ea287aac37237c948ae9f8c825ddda0601857.zip
reimplement auto playing music from location hash (like from search results)
Diffstat (limited to 'apps/media')
-rw-r--r--apps/media/js/music.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/media/js/music.js b/apps/media/js/music.js
index bf082207829..3373cbac257 100644
--- a/apps/media/js/music.js
+++ b/apps/media/js/music.js
@@ -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;
}