summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-05-06 15:22:04 +0200
committerJules Laplace <julescarbon@gmail.com>2020-05-06 15:22:04 +0200
commita0a1eb402d84be81000ed608d3da40a495cc6d34 (patch)
treeeddd5d6c13005cd9ab6b2c8354573fa617e6de14 /StoneIsland/www/js
parent9c18073017b5cc2334bf1867c004bfc74ba5a92a (diff)
cart accessibility
Diffstat (limited to 'StoneIsland/www/js')
-rwxr-xr-xStoneIsland/www/js/index.js4
-rwxr-xr-xStoneIsland/www/js/lib/auth/SignupView.js11
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartConfirm.js8
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartPayment.js17
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartShipping.js11
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartSummary.js12
-rwxr-xr-xStoneIsland/www/js/lib/products/GalleryView.js45
-rwxr-xr-xStoneIsland/www/js/lib/products/ProductView.js4
8 files changed, 80 insertions, 32 deletions
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 42cec6f1..8574372d 100755
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/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/www/js/lib/auth/SignupView.js b/StoneIsland/www/js/lib/auth/SignupView.js
index 18fecebb..8ae47728 100755
--- a/StoneIsland/www/js/lib/auth/SignupView.js
+++ b/StoneIsland/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.",
@@ -77,15 +77,18 @@ var SignupView = FormView.extend({
}
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) {
diff --git a/StoneIsland/www/js/lib/cart/CartConfirm.js b/StoneIsland/www/js/lib/cart/CartConfirm.js
index 6909dcc3..11d529ff 100755
--- a/StoneIsland/www/js/lib/cart/CartConfirm.js
+++ b/StoneIsland/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/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js
index 40d08d9e..0e4c3b84 100755
--- a/StoneIsland/www/js/lib/cart/CartPayment.js
+++ b/StoneIsland/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/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js
index b5d6647b..157e75f5 100755
--- a/StoneIsland/www/js/lib/cart/CartShipping.js
+++ b/StoneIsland/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/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js
index 51aa35ef..9637ae35 100755
--- a/StoneIsland/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/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/www/js/lib/products/GalleryView.js b/StoneIsland/www/js/lib/products/GalleryView.js
index 809ba0d9..417b14c3 100755
--- a/StoneIsland/www/js/lib/products/GalleryView.js
+++ b/StoneIsland/www/js/lib/products/GalleryView.js
@@ -59,20 +59,13 @@ var GalleryView = View.extend({
draggable: true,
})
if (app.accessible) {
- gallery.select(1, false, true)
+ 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))
@@ -94,10 +87,36 @@ var GalleryView = View.extend({
var largest_size = this.large_styles[style]
var title = YOOX_IMAGE_STYLE_LABELS[style] || "Alternate view"
var hiresImage = [head, largest_size, tail].join("_")
- console.log(partz, style)
+ // 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){
},
touchmove: function(e){
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js
index f834b1c5..570024b6 100755
--- a/StoneIsland/www/js/lib/products/ProductView.js
+++ b/StoneIsland/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){