diff options
Diffstat (limited to 'StoneIsland/www')
| -rw-r--r-- | StoneIsland/www/css/index.css | 26 | ||||
| -rw-r--r-- | StoneIsland/www/css/nav.css | 4 | ||||
| -rw-r--r-- | StoneIsland/www/index.html | 8 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/_router.js | 3 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/CollectionView.js | 31 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/Selector.js | 10 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/sdk.js | 26 | ||||
| -rw-r--r-- | StoneIsland/www/js/vendor/view/router.js | 2 |
8 files changed, 103 insertions, 7 deletions
diff --git a/StoneIsland/www/css/index.css b/StoneIsland/www/css/index.css index 161c41a6..3c2a4d10 100644 --- a/StoneIsland/www/css/index.css +++ b/StoneIsland/www/css/index.css @@ -16,3 +16,29 @@ body { font-family: pfd, sans-serif; font-size: 12px; } + +.loader { + z-index: 2; + width: 80px; + height: 80px; + position: absolute; + top: 50%; + left: 50%; + margin-top: -40px; + margin-left: -40px; + display: none; +} +.loader:before { + content: ''; + border-radius: 50%; + border-top: 3px solid #fff; + border-right: 3px solid transparent; + animation: loading .5s linear infinite; + -webkit-animation: loading .5s linear infinite; +} +@keyframes loading { + to {transform: rotate(360deg)} +} +@-webkit-keyframes loading { + to {-webkit-transform: rotate(360deg)} +}
\ No newline at end of file diff --git a/StoneIsland/www/css/nav.css b/StoneIsland/www/css/nav.css index e5c03010..3c4e5e3e 100644 --- a/StoneIsland/www/css/nav.css +++ b/StoneIsland/www/css/nav.css @@ -18,8 +18,8 @@ } .ios #nav, .ios #content { - top: 40px; - height: -webkit-calc(100% - 40px); + top: 20px; + height: -webkit-calc(100% - 20px); } .nav #nav { -webkit-transform: translateZ(0) translateX(0); diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 8750d62c..652cce9a 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -123,9 +123,12 @@ <div id="collection"> <h1>COLLECTION NAME</h1> + <div class="loader"></div> <div class="content"> <script type="text/html" class="template"> - <img src="{{image}}"> + <div data-code="{{code8}}"> + <img src="{{image}}"> + </div> </script> </div> </div> @@ -353,5 +356,8 @@ <script src="js/lib/blogs/StoryView.js"></script> <script src="js/lib/_router.js"></script> + +<script src="js/sdk/sdk.js"></script> + <script src="js/index.js"></script> </html> diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js index d45ffdc2..08b8b819 100644 --- a/StoneIsland/www/js/lib/_router.js +++ b/StoneIsland/www/js/lib/_router.js @@ -53,8 +53,9 @@ var SiteRouter = Router.extend({ app.archive.show() }, - cart: function(){ + app.view = app.cart + app.cart.show() }, }) diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js index 7e178a8a..0ce740a8 100644 --- a/StoneIsland/www/js/lib/products/CollectionView.js +++ b/StoneIsland/www/js/lib/products/CollectionView.js @@ -2,19 +2,46 @@ var CollectionView = View.extend({ el: "#collection", template: $("#collection .template").html(), + loaded: false, + data: null, + items: {}, events: { }, initialize: function(){ this.$content = this.$(".content") + this.$loader = this.$(".loader") }, show: function(){ document.body.className = "collection" + if (this.loaded) { + return this.populate(this.data) + } + this.fetch() + }, + + fetch: function(){ + this.$loader.show() + sdk.fetch_collection({ + gallery_id: 31617, // STONE ISLAND / SUPREME + success: this.populate.bind(this) + }) }, - populate: function(){ + populate: function(data){ + this.$loader.hide() + this.$content.empty() + // DefaultCode10 + console.log(data) + data.SearchResponseFull.Results.Items.forEach(function(item){ + this.items[ item['Code8'] ] = item + var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10'])) + .replace(/{{code8}}/, item['Code8']) + this.$content.append(t) + + }.bind(this)) }, -})
\ No newline at end of file +}) diff --git a/StoneIsland/www/js/lib/products/Selector.js b/StoneIsland/www/js/lib/products/Selector.js index 3d3d5ccc..c81aa121 100644 --- a/StoneIsland/www/js/lib/products/Selector.js +++ b/StoneIsland/www/js/lib/products/Selector.js @@ -3,6 +3,8 @@ var Selector = View.extend({ el: "#selector", events: { + "click .close": "hide", + "click span": "pick", }, initialize: function(){ @@ -10,5 +12,13 @@ var Selector = View.extend({ select: function(options, callback){ }, + + hide: function(){ + }, + + pick: function(e){ + var el = $(e.currentTarget) + + }, })
\ No newline at end of file diff --git a/StoneIsland/www/js/sdk/sdk.js b/StoneIsland/www/js/sdk/sdk.js new file mode 100644 index 00000000..1a1a03e0 --- /dev/null +++ b/StoneIsland/www/js/sdk/sdk.js @@ -0,0 +1,26 @@ +var sdk = (function(){ + var sdk = {} + + var endpoint = "https://secure.api.yoox.biz/" + + sdk.path = function(api, path){ + return endpoint + api + "/STONEISLAND_US/" + path + } + + sdk.fetch_collection = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Search.API/1.2", "search.json"), + data: { format: "full", gallery: opt.gallery_id }, + success: opt.success, +// dataType: "jsonp", + cache: true, + }) + } + + sdk.image = function(code){ + return "http://cdn.yoox.biz/" + code.substr(0,2) + "/" + code + "_11_f.jpg" + } + + return sdk +})() diff --git a/StoneIsland/www/js/vendor/view/router.js b/StoneIsland/www/js/vendor/view/router.js index bff039b7..d766880f 100644 --- a/StoneIsland/www/js/vendor/view/router.js +++ b/StoneIsland/www/js/vendor/view/router.js @@ -17,7 +17,7 @@ var Router = View.extend({ if (pathname[0] !== "/" && pathname[0] !== "#") { pathname = "/" + pathname } - var routes = is_mobile ? this.mobileRoutes : this.routes, + var routes = this.routes, path = pathname.split("/"); for (var i = 0; i < path.length; i++) { |
