summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/ios/www/js')
-rwxr-xr-xStoneIsland/platforms/ios/www/js/index.js4
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/auth/SignupView.js31
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/HubView.js8
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js4
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js8
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js17
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartShipping.js11
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js12
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js2
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/nav/NavView.js8
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/CollectionView.js3
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/GalleryView.js53
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/ProductView.js4
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/view/Serializable.js2
14 files changed, 122 insertions, 45 deletions
diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js
index 42cec6f1..8574372d 100755
--- a/StoneIsland/platforms/ios/www/js/index.js
+++ b/StoneIsland/platforms/ios/www/js/index.js
@@ -22,7 +22,9 @@ var app = (function(){
app.bind = function(){
document.addEventListener('touchmove', function(e){ e.preventDefault() })
- FastClick.attach(document.body)
+ if (!app.accessible) {
+ FastClick.attach(document.body)
+ }
}
app.build = function(){
diff --git a/StoneIsland/platforms/ios/www/js/lib/auth/SignupView.js b/StoneIsland/platforms/ios/www/js/lib/auth/SignupView.js
index b16ff887..8ae47728 100755
--- a/StoneIsland/platforms/ios/www/js/lib/auth/SignupView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/auth/SignupView.js
@@ -49,7 +49,7 @@ var SignupView = FormView.extend({
"Surname": "Please enter your last name.",
"Email": "Please enter a valid email address.",
"ConfirmEmail": "Please enter a valid email address.",
- "BirthDay": "Please enter your birthday. You must be 18 or older to use the Stone Island app.",
+ // "BirthDay": "Please enter your birthday. You must be 18 or older to use the Stone Island app.",
"Password": "Please enter your password.",
"Password2": "Please enter your password again.",
"DataProfiling": "You must consent to data profiling to use the Stone Island app.",
@@ -63,21 +63,40 @@ var SignupView = FormView.extend({
if (! data.Email.match("@")) { errors.push([ "Email", "Email address is not valid." ]) }
if (data.Email.toLowerCase() !== data.ConfirmEmail.toLowerCase()) { errors.push([ "ConfirmEmail", "Email addresses don't match." ]) }
// if (data.Gender === "NONE") { errors.push([ "Gender", "Please supply your gender." ]) }
- if (data.DataProfiling !== "true") { errors.push([ "DataProfiling", "You must consent to data profiling to use the Stone Island app." ]) }
- if (data.GdprTerms !== "true") { errors.push([ "GdprTerms", "You must agree to the Your My Account terms to use the Stone Island app." ]) }
+ if (data.DataProfiling !== "true") {
+ errors.push([ "DataProfiling", "You must consent to data profiling to use the Stone Island app." ])
+ setTimeout(function(){
+ this.$("#checkbox-shopping-data-profiling-label").closest(".checkbox-row").addClass("error_hilite")
+ }.bind(this), 10)
+ }
+ if (data.GdprTerms !== "true") {
+ errors.push([ "GdprTerms", "You must agree to the Your My Account terms to use the Stone Island app." ])
+ setTimeout(function(){
+ this.$("#checkbox-shopping-account-terms").closest(".checkbox-row").addClass("error_hilite")
+ }.bind(this), 10)
+ }
var now = new Date ()
- var year = now.getFullYear()
+ var year = now.getFullYear() - 18
if (! data.BirthDay) {
data.BirthDay = year + '-01-01'
}
// if (data.BirthDay.split('-')[0] || '2018')
var birthday = new Date (data.BirthDay)
- if (isNaN(birthday) || (new Date () - birthday) / (365*24*60*60*1000) < 18) {
- errors.push(['BirthDay', 'You must be 18 or older to use the Stone Island app.'])
+ if (isNaN(birthday)) {
+ data['BirthDay'] = '1970-01-01'
}
+ // if (isNaN(birthday) || (new Date () - birthday) / (365*24*60*60*1000) < 18) {
+ // errors.push(['BirthDay', 'You must be 18 or older to use the Stone Island app.'])
+ // }
data.YooxLetter = this.$("[name=YooxLetter]").prop("checked")
+ if (!data.YooxLetter) {
+ errors.push([ "YooxLetter", "You must consent to marketing to use the Stone Island app." ])
+ setTimeout(function(){
+ this.$("#checkbox-data-profiling").closest(".checkbox-row").addClass("error_hilite")
+ }.bind(this), 10)
+ }
},
finalize: function(data){
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
index d3b15f77..0d59bcc8 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
@@ -91,7 +91,7 @@ var HubView = ScrollableView.extend({
})
gallery.on('staticClick', function(e){
var url = gallery.selectedElement.style.backgroundImage.replace(/url\(\"?/,"").replace(/\"?\)/,"")
- app.fullscreenViewer.show(url, url)
+ app.fullscreenViewer.show(url, url, stonewash(row.title))
})
$(".gallery-" + row.id).attr('aria-label', stonewash(row.title) + ". Image gallery, use the arrows to scroll.")
if (accessibility.voiceOver) {
@@ -99,7 +99,7 @@ var HubView = ScrollableView.extend({
$(".gallery-target-" + row.id).click(function(e){
e && e.preventDefault()
var url = gallery.selectedElement.style.backgroundImage.replace(/url\(\"?/,"").replace(/\"?\)/,"")
- app.fullscreenViewer.show(url, url)
+ app.fullscreenViewer.show(url, url, stonewash(row.title))
})
}
}
@@ -134,13 +134,13 @@ var HubView = ScrollableView.extend({
} else {
$(el).click(function(e){
e && e.preventDefault()
- app.fullscreenViewer.show(row.image[0].uri)
+ app.fullscreenViewer.show(row.image[0].uri, row.image[0].uri, stonewash(row.title) + ". Main image")
})
$(".gallery-" + row.id).attr('aria-label', stonewash(row.title) + ". Main image")
$(".gallery-target-" + row.id).attr('aria-label', stonewash(row.title) + ". Main image.")
$(".gallery-target-" + row.id).click(function(e){
e && e.preventDefault()
- app.fullscreenViewer.show(row.image[0].uri)
+ app.fullscreenViewer.show(row.image[0].uri, row.image[0].uri, stonewash(row.title) + ". Main image")
})
}
$t.find(".gallery-left").remove()
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
index 71f1cc0c..19d5bac8 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
@@ -40,8 +40,8 @@ var StoryView = ScrollableView.extend({
.replace(/{{body}}/, row.body.replace(/\n/g, "<br>"))
var li = document.createElement("li")
li.dataset.id = row.id
- li.innerHTML = "<div>" + row.title + "</div>"
- li.setAttribute('role', "link")
+ li.innerHTML = "<div style='pointer-events: none'>" + row.title + "</div>"
+ li.setAttribute('role', "menuitem")
this.sections[row.id] = row
this.$links.append(li)
this.$content.append(t)
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js
index 6909dcc3..11d529ff 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js
@@ -90,9 +90,9 @@ var CartConfirm = FormView.extend({
.replace(/{{sku}}/, num)
.replace(/{{title}}/, title)
.replace(/{{type}}/, type)
- .replace(/{{size}}/, size_name || "DEFAULT")
- .replace(/{{color}}/, color_name || "DEFAULT")
- .replace(/{{quantity}}/, 1)
+ .replace(/{{size}}/g, size_name || "DEFAULT")
+ .replace(/{{color}}/g, color_name || "DEFAULT")
+ .replace(/{{quantity}}/g, 1)
.replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice))
$el.data("price", details.Item.Price.DiscountedPrice)
$el.html(t)
@@ -109,6 +109,8 @@ var CartConfirm = FormView.extend({
this.$shipping.html( as_cash(shipping_cost) )
this.$tax.html( as_cash(tax) )
this.$total.html( as_cash(total) )
+ this.$(".subtotal_row").attr('aria-label', "Subtotal " + as_cash(subtotal))
+ this.$(".total_row").attr('aria-label', "Total " + as_cash(total))
if (data.Receiver) {
var street = data.Receiver.StreetWithNumber.replace(/\n$/,"").replace("\n", ", ")
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js
index 40d08d9e..0e4c3b84 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js
@@ -73,6 +73,10 @@ var CartPayment = FormView.extend({
this.address.disabled = this.address_list_mode
this.$address_form.toggle(! this.address_list_mode)
this.$address_list.toggle(this.address_list_mode)
+ this.scroller.refresh()
+ this.$("input,select").map(function(i) {
+ this.setAttribute('tabindex', i+1)
+ })
},
toggle_cc: function(state){
@@ -86,6 +90,10 @@ var CartPayment = FormView.extend({
this.$cc_form.toggle(! this.cc_list_mode)
this.$cc_list.toggle(this.cc_list_mode)
this.$cc_confirm.toggle(this.cc_list_mode)
+ this.scroller.refresh()
+ this.$("input,select").map(function(i) {
+ this.setAttribute('tabindex', i+1)
+ })
},
focus_on_cc: function(e){
@@ -104,8 +112,8 @@ var CartPayment = FormView.extend({
this.toggle_address( !! app.account.ccs.length )
this.toggle_cc( !! app.account.ccs.length )
- app.account.ccs.forEach(function(cc){
- var address_t = this.address_template.replace(/{{id}}/g, cc.Id)
+ app.account.ccs.forEach(function(cc, i){
+ var address_t = this.address_template.replace(/{{id}}/g, (cc.Id || i))
.replace(/{{checked}}/g, cc.IsDefault ? "checked" : "")
.replace(/{{name}}/g, (cc.Name + " " + cc.Surname).toUpperCase())
.replace(/{{address}}/g, cc.Address.replace(/\n$/,"").replace("\n", ", "))
@@ -113,7 +121,7 @@ var CartPayment = FormView.extend({
.replace(/{{state}}/g, cc.Province)
.replace(/{{zip}}/g, cc.ZipCode)
- var cc_t = this.cc_template.replace(/{{id}}/g, cc.Id)
+ var cc_t = this.cc_template.replace(/{{id}}/g, (cc.Id || i))
.replace(/{{checked}}/g, cc.IsDefault ? "checked" : "")
.replace(/{{number}}/g, cc['Number'])
.replace(/{{type}}/g, cc.Type.toUpperCase())
@@ -122,6 +130,9 @@ var CartPayment = FormView.extend({
this.$address_list.append(address_t)
this.$cc_list.append(cc_t)
}.bind(this))
+ this.$("input,select").map(function(i) {
+ this.setAttribute('tabindex', i+1)
+ })
},
finalize: function(data){
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartShipping.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartShipping.js
index b5d6647b..157e75f5 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartShipping.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartShipping.js
@@ -43,8 +43,8 @@ var CartShipping = FormView.extend({
this.toggle_dropdown(false)
return
}
- app.account.addresses.forEach(function(address){
- var t = this.template.replace(/{{id}}/g, address.Id)
+ app.account.addresses.forEach(function(address, i){
+ var t = this.template.replace(/{{id}}/g, (address.Id || i))
.replace(/{{checked}}/g, address.IsDefault ? "checked" : "")
.replace(/{{name}}/g, (address.Name + " " + address.Surname).toUpperCase())
.replace(/{{address}}/g, address.Address.replace(/\n$/,"").replace("\n", ", "))
@@ -69,6 +69,9 @@ var CartShipping = FormView.extend({
$("#standard-shipping").prop("checked", cart_data.Cart.DeliveryMethod.Type == 1)
$("#express-shipping").prop("checked", cart_data.Cart.DeliveryMethod.Type == 2)
}
+ this.$("input,select").map(function(i) {
+ this.setAttribute('tabindex', i+1)
+ })
},
toggle_dropdown: function(state){
@@ -80,6 +83,10 @@ var CartShipping = FormView.extend({
this.address.disabled = this.list_mode
this.$address_form.toggle(! this.list_mode)
this.$address_list.toggle(this.list_mode)
+ this.scroller.refresh()
+ this.$("input,select").map(function(i) {
+ this.setAttribute('tabindex', i+1)
+ })
},
// sdk.cart.set_shipping_address
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
index 51aa35ef..9637ae35 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
@@ -112,11 +112,11 @@ var CartSummary = ScrollableView.extend({
.replace(/{{sku}}/g, num)
.replace(/{{code8}}/g, data['Code8'])
.replace(/{{title}}/g, title)
- .replace(/{{cleantitle}}/g, stonewash(title))
+ .replace(/{{cleantitle}}/g, num + ' ' + stonewash(title) + ' ' + descriptions['MicroCategory'])
.replace(/{{type}}/, type)
- .replace(/{{size}}/, size_name)
- .replace(/{{color}}/, color_name)
- .replace(/{{quantity}}/, 1)
+ .replace(/{{size}}/g, size_name)
+ .replace(/{{color}}/g, color_name)
+ .replace(/{{quantity}}/g, 1)
.replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice))
$el.html(t)
this.refreshScroller()
@@ -129,6 +129,7 @@ var CartSummary = ScrollableView.extend({
this.updateTotals()
+ this.$cart_empty.hide()
this.el.className = "full"
this.refreshScroller()
app.curtain.hide("loading")
@@ -149,6 +150,8 @@ var CartSummary = ScrollableView.extend({
this.$shipping.html( as_cash(shipping_cost) )
this.$tax.html( as_cash(tax) )
this.$total.html( as_cash(total) )
+ this.$(".subtotal_row").attr('aria-label', "Subtotal " + as_cash(subtotal))
+ this.$(".total_row").attr('aria-label', "Total " + as_cash(total))
},
empty: function(){
@@ -158,6 +161,7 @@ var CartSummary = ScrollableView.extend({
this.parent.$itemcount.html("0 ITEMS")
this.el.className = "empty"
this.parent.$steps.hide()
+ this.$cart_empty.show()
app.curtain.hide("loading")
},
diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js b/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js
index c66143cc..a18ad5b3 100644
--- a/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js
+++ b/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js
@@ -73,5 +73,5 @@ var accessibility = (function() {
})()
function stonewash (s) {
- return s.replace(/'9/g, '19').replace(/'0/g, '20').replace(/_/g, ' ').replace(/-/g, ' - ').replace(/^[013456789][0-9]+/, '')
+ return s.replace(/'9/g, '19').replace(/'0/g, '20').replace(/_/g, ' ').replace(/-/g, ' - ')
}
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
index a9a1938e..a6a39633 100755
--- a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
@@ -1,3 +1,5 @@
+var klassTimeout;
+
var NavView = View.extend({
el: "#nav",
@@ -52,14 +54,16 @@ var NavView = View.extend({
doneShowingNav = true
}, 800)
if (klass) {
- setTimeout(function(){
+ klassTimeout = setTimeout(function(){
this.addClass(klass)
}.bind(this), 500)
}
},
hide: function(){
- if (!doneShowingNav) return
+ if (!doneShowingNav) {
+ clearTimeout(klassTimeout)
+ }
$("body").removeClass("nav")
app.curtain.hide("dark")
},
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
index d3343652..70bb22b4 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
@@ -194,9 +194,10 @@ var CollectionView = ScrollableView.extend({
append: function(item, is_single_product){
this.items[ item['Code8'] ] = item
+ console.log("TITLE: " + item['ModelNames'])
var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10'], is_single_product ? '13_f' : '11_f'))
.replace(/{{code8}}/, item['Code8'])
- .replace(/{{title}}/, stonewash(item['ModelNames']))
+ .replace(/{{title}}/g, stonewash(item['ModelNames'] + ' ' + item['MicroCategory']))
var $t = $(t)
if (app.store.ShowProductNameOnCollectionPage) {
var $title = $("<span>")
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
index e84caa68..417b14c3 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
@@ -36,6 +36,7 @@ var GalleryView = View.extend({
valid_styles[style] = size
}
})
+ this.large_styles = large_styles
Object.keys(valid_styles).sort(sort_image_styles).forEach(function(style){
var id = valid_styles[style] + "_" + style
@@ -57,18 +58,14 @@ var GalleryView = View.extend({
contain: true,
draggable: true,
})
+ if (app.accessible) {
+ gallery.select(1, true, true)
+ }
- this.gallery.on('change', function(){
- var currentImage = this.gallery.selectedElement.style.backgroundImage.replace(/url\(\"?/,"").replace(/\"?\)/,"")
- var partz = currentImage.split("_")
- var head = partz[0]
- var size = partz[1]
- var tail = partz[2]
- var end_partz = tail.split(/\./)
- var style = end_partz[0]
- var label = YOOX_IMAGE_STYLE_LABELS[style] || "Image: Alternate view"
- $("#product .gallery-target").attr('aria-label', label)
- })
+ var last_style = 'f'
+ this.gallery.on('select', function(){
+ this.updateLabel()
+ }.bind(this))
this.gallery.on('staticClick', this.static_click.bind(this))
@@ -85,11 +82,39 @@ var GalleryView = View.extend({
var head = partz[0]
var size = partz[1]
var tail = partz[2]
- var end_partz = tail.split(/\./)
+ var end_partz = (tail || 'f').split(/\./)
var style = end_partz[0]
- var largest_size = large_styles[style]
+ var largest_size = this.large_styles[style]
+ var title = YOOX_IMAGE_STYLE_LABELS[style] || "Alternate view"
var hiresImage = [head, largest_size, tail].join("_")
- app.fullscreenViewer.show(currentImage, hiresImage)
+ // console.log(partz, style)
+ app.fullscreenViewer.show(currentImage, hiresImage, title)
+ },
+
+ animating: false,
+ previous: function(e){
+ this.gallery.previous()
+ this.updateLabel()
+ },
+ next: function(e){
+ this.gallery.next()
+ this.updateLabel()
+ },
+ updateLabel: function(){
+ var currentImage = this.gallery.selectedElement.style.backgroundImage.replace(/url\(\"?/,"").replace(/\"?\)/,"")
+ var partz = currentImage.split("_")
+ var head = partz[0]
+ var size = partz[1]
+ var tail = partz[2]
+ var end_partz = tail.split(/\./)
+ var style = end_partz[0]
+ if (style === this.last_style) {
+ style = 'z'
+ }
+ this.last_style = style
+ var label = YOOX_IMAGE_STYLE_LABELS[style] || "Image: Alternate view"
+ console.log("> new style: " + style)
+ $("#product .gallery-target").attr('aria-label', label)
},
touchstart: function(e){
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
index f834b1c5..570024b6 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
@@ -74,10 +74,10 @@ var ProductView = ScrollableView.extend({
cache: {},
gallery_left: function(){
- app.product.gallery.gallery.previous()
+ app.product.gallery.previous()
},
gallery_right: function(){
- app.product.gallery.gallery.next()
+ app.product.gallery.next()
},
find: function(code, cb){
diff --git a/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js b/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js
index 08802fa9..0d638412 100755
--- a/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js
+++ b/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js
@@ -61,6 +61,7 @@ var SerializableView = View.extend({
focus_input: function(e){
$(e.currentTarget).removeClass("error_hilite")
+ $(e.currentTarget).closest(".checkbox-row").removeClass("error_hilite")
},
focus_date: function(e){
@@ -128,6 +129,7 @@ var SerializableView = View.extend({
// this.$msg.html(msgs.join("<br>"))
this.$msg.addClass('alert-notice')
if (app.view.scroller) {
+ app.view.scroller.refresh()
app.view.scroller.scrollTo(0, 0)
}
},