aboutsummaryrefslogtreecommitdiffstats
path: root/public/javascripts/main.js
blob: df3b899dcb0f7a49994497b8f2a873f901684379 (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
// CoverFlow
(function() {
	var initialise_js_cover_flow = function(playlist) {
		coverflow('character-select-container').setup({
			width: '100%',
			playlist: playlist,
			coverheight: 200,
			textoffset: 30
		}).on('ready', function() {
			this.on('click', function() {
				alert('chosen');
			});
		});
	};

	// Populate characters
	
	// Change template settings to use {{}} delimiters
	_.templateSettings = {
		interpolate: /\{\{(.+?)\}\}/g
	};
	
	var $character_container = $('#character-select .flow');
	$.get(
		'/character-images/8680539',
		function(response) {
			var r = JSON.parse(response);
			
			$character_container.empty()
			
			var playlist = []
			for (var i = 0; i < r.characters.length; i++) {
				playlist.push({
					image: r.characters[i].image,
					title: r.characters[i].name
				});
			}
			initialise_js_cover_flow(playlist);
		}
	);
})();