Sha256: 5a264f23ab1d574f135c227cab90cf39f923cb8224106fa3ddb25061030623ee
Contents?: true
Size: 993 Bytes
Versions: 2
Compression:
Stored size: 993 Bytes
Contents
controllers.show = function(key) { var _this = this; var book = _.find(store, function(book) { return book.key == key; }); function pageUrl(index) { return book.url + "/" + book.pageUrls[index - 1]; } function preloadImage(index) { var image = new Image(); image.src = pageUrl(index); } function preloadImages() { _(book.pageUrls.length).times(function(i) { preloadImage(i + 1); }); } this.init = function() { console.log("starting show"); $("#image").attr("src", "img/blank.png"); $("#view-show").show().addClass("current-view"); //setTimeout(preloadImages, 5000); } this.render = function() { window.scrollTo(0, 0); var index = utils.page(); $("#image").attr('src', pageUrl(index)); if((index + 1) <= book.pageUrls.length) { preloadImage(index + 1); } } this.destroy = function() { console.log("destroying show"); $("#view-show").hide().removeClass("current-view"); } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mangos-0.0.6 | app/js/controllers.show.js |
mangos-0.0.5 | app/js/controllers.show.js |