HTML and CSS Reference
In-Depth Information
}
// Create a new JSONP request
var jsonp = new app.utility.jsonp(
' http://api.rottentomatoes.com/api/public/v1.0/movies/' +
data.id + '.json?apikey=YOURAPIKEY,
'app.bootstrap.getController("movies").view');
// Send the request
jsonp.send();
}
this.view = function(rtresult){
// Check to see whether an object has been returned
if(!app.utility.validator.isTypeOf(reresult, 'object')){
// If it's not an object, don't show the movie
return;
}
// Create a new movie object
var movie = new app.model.movie(rtresult.title,
rtresult.id, rtresult.posters.original, rtresult.synopsis),
// Get the movie info card
viewcard = document.getElementById('card-movie_info');
/**
* Set the DVD and cinema release dates
*/
var releaseDate = new app.type.releaseDate(
new Date(rtresult.release_dates.theater),
new Date(rtresult.release_dates.dvd));
movie.setReleaseDate(releaseDate);
/**
* Set the movie's rating
*/
movie.setRating(rtresult.mpaa_rating);
/**
* Check to see whether the movie is in the user's favorites
* by looping over the favorites localStorage object
*/
var _favorites = JSON.parse(localStorage.favorites);
for(var i = 0; i < _favorites.length; i++){
if(_favorites[i].id == movie.getRtid()){
/**
Search WWH ::




Custom Search