diff options
| author | Teddy Wing | 2013-04-28 11:36:48 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2013-04-28 11:36:48 -0400 | 
| commit | cf5c3a783a25a5a094be82b41cd66988c073df80 (patch) | |
| tree | ab19e322b5bd701a504ebc30dedfd7a391944f23 /public/javascripts/app.js | |
| parent | 1f763cbf0959c5722736a75e30fcc2c76637cd64 (diff) | |
| download | Who-am-I-cf5c3a783a25a5a094be82b41cd66988c073df80.tar.bz2 | |
Reorganise JS and get characters from lasest video
* Reorganise frontend JavaScript to make it more compartmentalised
* Grab characters from the latest video
Diffstat (limited to 'public/javascripts/app.js')
| -rw-r--r-- | public/javascripts/app.js | 57 | 
1 files changed, 57 insertions, 0 deletions
| diff --git a/public/javascripts/app.js b/public/javascripts/app.js new file mode 100644 index 0000000..c54651a --- /dev/null +++ b/public/javascripts/app.js @@ -0,0 +1,57 @@ +var App = App || null; + +(function() { +	var cApp = function() { +		this.characters = null; +		this.answer = null; +		 +		 +		// CoverFlow +		var initialise_js_cover_flow = function(playlist) { +			coverflow('character-select-container').setup({ +				width: '100%', +				playlist: playlist, +				coverheight: 130, +				textoffset: 68 +			}).on('ready', function() { +				this.on('click', function() { +					alert('chosen'); +				}); +			}); +		}; +		 +		this.initialize_video = function(url) { +		 +		}; +		 +		this.get_characters = function(series_id) { +			// Populate characters +			var that = this; +			var $character_container = $('#character-select .flow'); +			$.get( +				'/character-images/' + series_id, +				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); +					 +					that.characters = _.pluck(r.characters, 'tms_personId'); +				} +			); +		}; +		 +		 +		return this; +	}; +	 +	App = new cApp(); +})();
\ No newline at end of file | 
