blob: ddfff9e6a6fcd713af7c328ad96d93d6a0d3d76c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
var BlogView = View.extend({
data: null,
loaded: false,
initialize: function(){
this.loader = new Loader ()
this.fetch()
},
fetch: function(){
$.ajax({
method: "GET",
url: sdk.env == 'test' ? '/db.json' : "http://stone.sup.land/db.json",
success: this.success.bind(this),
cache: true,
})
},
success: function(data){
if (this.loaded) return
this.loaded = true
this.data = data = typeof data == "string" ? JSON.parse(data) : data
app.archive.populate(data.archive)
this.loader.preloadImage(data.hub[0].image[0].uri, function(img){
app.hub.populate(data.hub)
})
this.loader.preloadImage(data.story[0].image.uri, function(img){
app.story.populate(data.story)
})
data.page.forEach(function(page){
app[page.tag].populate(page)
})
app.collection.setCollectionName( data.store[0].collection )
app.closed.populate(data.store[0].ClosedStoreImages)
if (data.store[0].StoreIsOpen !== "true") {
app.closed.storeIsClosed = true
}
var fits_large = (data.store[0].FitsLarge === "true")
app.product.$fit.toggle( fits_large )
app.product.$sizing.toggle( fits_large )
if (data.store[0].BackgroundIsGray === "true") {
app.collection.$el.addClass("gray")
app.product.gallery.$el.addClass("gray")
}
app.gallery_id = data.store[0].CollectionId
// app.collection.fetch()
},
})
|