var ClosedStoreView = View.extend({ el: "#closed", storeIsClosed: false, events: { "click .website_link": "website_link", }, delay: 8000, timeout: -1, images: null, initialize: function(){ this.loader = new Loader () }, show: function(){ document.body.className = "closed" this.animate() app.footer.hide() console.log(this) if (this.storeOpenDate) { var date = moment(this.storeOpenDate).format("MM/DD") console.log(date) $(".closed_store_msg h3").html("THIS STORE WILL OPEN ON " + date) } else { $(".closed_store_msg h3").html("THIS STORE IS CURRENTLY CLOSED") } }, hide: function(){ clearTimeout(this.timeout) }, animate: function(){ this.timeout = setTimeout(this.animate.bind(this), this.delay) if (! this.images) return var url = choice(this.images) this.loader.preloadImage(url, function(img){ this.el.style.backgroundImage = 'url(' + img.src + ')' }.bind(this)) }, populate: function(data){ this.images = data.map(function(img){ return img.uri }) }, website_link: function(){ window.open("http://www.stoneisland.com/", '_system') }, })