summaryrefslogtreecommitdiffstats
path: root/apps/media/js/music.js
blob: b2464c3842f1caee644b202c27a1194def8e40e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$(document).ready(function(){
	//load the collection
	$('#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();
	});
	var tab=window.location.href.slice(window.location.href.indexOf('#') + 1);
	if(tab=='collection'){
		$('#plugins a[href="#collection"]').trigger('click');
	}
});



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;
}

function musicTypeFromFile(file){
	var extention=file.split('.').pop();
	if(extention=='ogg'){
		return 'oga'
	}
	//TODO check for more specific cases
	return extention;
}