summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-12-11 04:24:13 -0600
committerJules Laplace <jules@okfoc.us>2015-12-11 04:24:13 -0600
commit190e24251c17733eff8fc1b11a077ca2da4b6c4f (patch)
treeeef5d4175d41f7296a4a64918d4e50192a496143 /StoneIsland/www/js
parent0e070756a7e66975fe381577e93dd5f709017bf7 (diff)
rebuild
Diffstat (limited to 'StoneIsland/www/js')
-rwxr-xr-xStoneIsland/www/js/index.js2
-rwxr-xr-xStoneIsland/www/js/lib/blogs/ArchiveView.js1
-rwxr-xr-xStoneIsland/www/js/lib/blogs/BlogView.js42
-rwxr-xr-xStoneIsland/www/js/lib/blogs/StoryView.js2
-rwxr-xr-xStoneIsland/www/js/lib/etc/push.js3
-rwxr-xr-xStoneIsland/www/js/lib/products/ClosedStoreView.js20
6 files changed, 46 insertions, 24 deletions
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 468c0d7e..0b3531dd 100755
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/www/js/index.js
@@ -3,7 +3,7 @@ var app = (function(){
app.init = function(){
- sdk.init({ env: "test" })
+ sdk.init({ env: "production" })
app.bind()
app.build()
diff --git a/StoneIsland/www/js/lib/blogs/ArchiveView.js b/StoneIsland/www/js/lib/blogs/ArchiveView.js
index 254df6d1..a1863b67 100755
--- a/StoneIsland/www/js/lib/blogs/ArchiveView.js
+++ b/StoneIsland/www/js/lib/blogs/ArchiveView.js
@@ -78,6 +78,7 @@ var ArchiveView = ScrollableView.extend({
count = count || row.images.length
row.images.forEach(function(cell, i){
+ if (count && i > count) { return }
var $t = $("<div>")
$t.addClass("row").addClass("loading")
var t = this.row_template.replace(/{{image}}/, cell.uri)
diff --git a/StoneIsland/www/js/lib/blogs/BlogView.js b/StoneIsland/www/js/lib/blogs/BlogView.js
index 51881aa5..ffd09fe1 100755
--- a/StoneIsland/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/www/js/lib/blogs/BlogView.js
@@ -24,6 +24,29 @@ var BlogView = View.extend({
this.loaded = true
this.data = data = typeof data == "string" ? JSON.parse(data) : data
+ switch (data.store[0].StoreStatus) {
+ case "open":
+ app.closed.storeIsClosed = false
+ break
+ case "closed":
+ app.closed.storeIsClosed = true
+ app.closed.storeOpenDate = null
+ break
+ case "openson":
+ app.closed.storeIsClosed = true
+ app.closed.storeOpenDate = moment(data.store[0].OpensOn)
+ break
+ }
+
+ if (app.closed.storeIsClosed) {
+ app.closed.populate(data.store[0].ClosedStoreImages)
+ }
+ else {
+ app.gallery_id = data.store[0].CollectionId
+ app.collection.setCollectionName( data.store[0].collection )
+ app.collection.fetch()
+ }
+
app.archive.populate(data.archive)
this.loader.preloadImage(data.hub[0].image[0].uri, function(img){
app.hub.populate(data.hub)
@@ -39,22 +62,7 @@ var BlogView = View.extend({
data.page.forEach(function(page){
app[page.tag].populate(page)
})
- app.collection.setCollectionName( data.store[0].collection )
- app.closed.populate(data.store[0].ClosedStoreImages)
- switch (data.store[0].StoreStatus) {
- case "open":
- app.closed.storeIsClosed = false
- break
- case "closed":
- app.closed.storeIsClosed = true
- app.closed.storeOpenDate = null
- break
- case "openson":
- app.closed.storeIsClosed = true
- app.closed.storeOpenDate = moment(data.store[0].OpensOn)
- break
- }
console.log(data.store[0].StoreStatus)
var fits_large = (data.store[0].FitsLarge === "true")
@@ -65,10 +73,6 @@ var BlogView = View.extend({
app.collection.$el.addClass("gray")
app.product.gallery.$el.addClass("gray")
}
-
- app.gallery_id = data.store[0].CollectionId
-
- app.collection.fetch()
},
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/blogs/StoryView.js b/StoneIsland/www/js/lib/blogs/StoryView.js
index a10c8351..98cd330b 100755
--- a/StoneIsland/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/www/js/lib/blogs/StoryView.js
@@ -15,6 +15,7 @@ var StoryView = ScrollableView.extend({
this.$content = this.$(".content")
this.$links = this.$(".links")
this.$loader = this.$(".loader")
+ this.loader = new Loader ()
this.scroller = new IScroll('#story', app.iscroll_options)
},
@@ -60,6 +61,7 @@ var StoryView = ScrollableView.extend({
var section = this.sections[id]
var replace = this.$img
// optional image transition.. ?
+
this.$img.fadeTo(110,0.65, function() {
replace.attr("src", section.image.uri)
}).fadeTo(130,1)
diff --git a/StoneIsland/www/js/lib/etc/push.js b/StoneIsland/www/js/lib/etc/push.js
index 9a921059..15371247 100755
--- a/StoneIsland/www/js/lib/etc/push.js
+++ b/StoneIsland/www/js/lib/etc/push.js
@@ -25,6 +25,7 @@ var push = (function(){
parsePlugin.subscribe(channel, function(){
push.settings[channel] = true
localStorage.setItem("yoox.push_" + channel, "true")
+ console.log("subscribed to", channel)
cb && cb()
}, push.error)
}
@@ -32,6 +33,7 @@ var push = (function(){
parsePlugin.unsubscribe(channel, function(){
push.settings[channel] = false
localStorage.setItem("yoox.push_" + channel, "false")
+ console.log("unsubscribed from", channel)
cb && cb()
}, push.error)
}
@@ -58,6 +60,7 @@ var push = (function(){
else {
app.intro.$alert.show().html("[ STORE UPDATED ]")
}
+ }
catch (e) {
app.intro.$alert.show().html("[ HUB UPDATED ]")
}
diff --git a/StoneIsland/www/js/lib/products/ClosedStoreView.js b/StoneIsland/www/js/lib/products/ClosedStoreView.js
index 5f8c1e84..6f7b8486 100755
--- a/StoneIsland/www/js/lib/products/ClosedStoreView.js
+++ b/StoneIsland/www/js/lib/products/ClosedStoreView.js
@@ -12,6 +12,7 @@ var ClosedStoreView = View.extend({
timeout: -1,
images: null,
+ images_loaded: {},
initialize: function(){
this.loader = new Loader ()
@@ -21,7 +22,6 @@ var ClosedStoreView = View.extend({
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)
@@ -38,15 +38,27 @@ var ClosedStoreView = View.extend({
animate: function(){
this.timeout = setTimeout(this.animate.bind(this), this.delay)
+ this.next()
+ },
+
+ next: function(){
if (! this.images) return
var url = choice(this.images)
- this.loader.preloadImage(url, function(img){
- this.el.style.backgroundImage = 'url(' + img.src + ')'
- }.bind(this))
+
+ if (this.images_loaded[url]) {
+ this.el.style.backgroundImage = 'url(' + url + ')'
+ }
+ else {
+ this.loader.preloadImage(url, function(img){
+ this.el.style.backgroundImage = 'url(' + url + ')'
+ this.images_loaded[url] = true
+ }.bind(this))
+ }
},
populate: function(data){
this.images = data.map(function(img){ return img.uri })
+ this.next()
},
website_link: function(){