HTML and CSS Reference
In-Depth Information
}
// Create a new one
_listScroll = new iScroll(_favoriteslist);
// Hide all of the cards
app.utility.deck.hideAllCards();
// Show only the favorites card
app.utility.deck.showCard('card-favorite_list');
...
}
...
}
Your final list method should look like the following code.
var app = app || {};
app.controller = app.controller || {};
app.controller.favorites = function(){
...
this.list = function(){
// Get the favorites from local storage
var _favorites = JSON.parse(localStorage.favorites),
// Create an empty movies variable
_movies = [],
// Get the favoritesList card from the DOM
_favoriteslist = document.getElementById('card-favorite_list');
/**
* Loop through each of the favorites backward
* to ensure that the most recent favorite
* is displayed at the top of the list
*/
for(var i = _favorites.length; i > 0; i--){
var _favorite = _favorites[i - 1];
// Push the movie model to the movies array
_movies.push(new app.model.movie(unescape(_favorite.title),
_favorite.id, _favorite.posterframe, unescape(_favorite.synopsis)))
}
/**
* Create a new movielist view with the _movies model
 
Search WWH ::




Custom Search