summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-09-03 15:18:23 +0200
committerJules Laplace <julescarbon@gmail.com>2019-09-03 15:18:23 +0200
commit6f2af841c17ff4ed28d40121114825a40e8cf6fa (patch)
tree5cc68e65c61e85ada066e45cf62805b60b24cf67 /StoneIsland/platforms/ios/www/js/lib
parentbea0583348a3e7de85d4fed5e7fe206fb90fcc73 (diff)
updating rems
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib')
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/account/AccountView.js2
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js1
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/HubView.js12
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js2
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js7
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js9
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/nav/AddressView.js18
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js4
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/nav/NavView.js12
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/CollectionView.js2
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/GalleryView.js9
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/ProductView.js4
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/Selector.js2
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/view/Serializable.js7
14 files changed, 68 insertions, 23 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js b/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js
index 8ac7c193..af035f6a 100755
--- a/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js
@@ -74,7 +74,7 @@ var AccountView = View.extend({
},
populateCreditCards: function(data, cb){
- console.log("populate ccs:", data.CreditCards)
+ // console.log("populate ccs:", data.CreditCards)
this.ccs = data.CreditCards
this.ccLookup = {}
if (! data.CreditCards || ! data.CreditCards.length) {
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js
index 12aaf7de..0d769e95 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js
@@ -21,7 +21,6 @@ var ArchiveView = ScrollableView.extend({
this.scroller = new IScroll('#archive .scroll', app.iscroll_options)
this.$subtitle = this.$('.subtitle')
this.subtitle_html = this.$subtitle.html()
-
},
back: function(){
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
index b072a887..c4ebd716 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
@@ -57,6 +57,8 @@ var HubView = ScrollableView.extend({
.replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY"))
.replace(/{{title}}/, row.title)
.replace(/{{subtitle}}/, row.subtitle)
+ .replace(/{{cleantitle}}/, stonewash(row.title))
+ .replace(/{{cleansubtitle}}/, stonewash(row.subtitle))
.replace(/{{link}}/, row.link)
.replace(/{{body}}/, row.body.replace(/\n/g, "<br>"))
var $t = $(t)
@@ -71,6 +73,7 @@ var HubView = ScrollableView.extend({
row.image.forEach(function(img){
var el = document.createElement("div")
el.style.backgroundImage = "url(" + img.uri + ")"
+ el.setAttribute('aria-label', img.caption)
el.className = "item"
$gallery.append(el)
})
@@ -107,6 +110,8 @@ var HubView = ScrollableView.extend({
play.className = "play"
$(".gallery-" + row.id).append(play)
$(".gallery-" + row.id).addClass("gallery-video-post")
+ $(".gallery-" + row.id).attr('role', 'link')
+ $(".gallery-" + row.id).attr('aria-label', stonewash(row.title) + ". Watch the video on Youtube")
if (! row.image) {
var url = row.link
var ytid = (url.match(/v=([-_a-zA-Z0-9]{11})/i) || url.match(/youtu.be\/([-_a-zA-Z0-9]{11})/i) || url.match(/embed\/([-_a-zA-Z0-9]{11})/i))[1].split('&')[0];
@@ -125,6 +130,7 @@ var HubView = ScrollableView.extend({
store_link: function(){
app.router.go("store")
},
+
play_video: function(e){
var row = $(e.currentTarget).closest('.gallery-video-post').data("row")
window.open(row.link, '_system')
@@ -142,7 +148,9 @@ var HubView = ScrollableView.extend({
share: function(e){
var title = $(e.currentTarget).parent().find(".title").text()
console.log("share", title)
- window.plugins.socialsharing.share(title, null, null, "http://deeplink.me/www.stoneisland.com/hub" )
+ if (window.plugins && window.plugins.socialsharing) {
+ window.plugins.socialsharing.share(title, null, null, "http://deeplink.me/www.stoneisland.com/hub" )
+ }
},
})
@@ -169,7 +177,7 @@ var HubLoader = (function(){
if (item.image && item.image.length) {
loader = new Loader (HubLoader.build)
images = item.image.map(function(img){
- return img.uri.replace("http:","https:")
+ return img.uri.replace("http:", "https:")
}).filter(function(img){
return img.uri
})
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
index 5a7a56d1..924a7355 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
@@ -41,6 +41,7 @@ var StoryView = ScrollableView.extend({
var li = document.createElement("li")
li.dataset.id = row.id
li.innerHTML = row.title
+ li.role = "button"
this.sections[row.id] = row
this.$links.append(li)
this.$content.append(t)
@@ -67,6 +68,7 @@ var StoryView = ScrollableView.extend({
this.$img.stop().fadeTo(110,0.65, function() {
$replace.attr("src", section.image.uri)
+ $replace.attr("alt", section.image.caption)
}).fadeTo(130,1)
}
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
index 9b5da7b7..bf150791 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js
@@ -75,7 +75,6 @@ var CartSummary = ScrollableView.extend({
this.$rows.append($el)
app.product.find(code, function(data, details){
// console.log(data, details)
-
var descriptions = app.product.get_descriptions( details )
// console.log(descriptions)
@@ -110,8 +109,10 @@ var CartSummary = ScrollableView.extend({
var t = this.template
.replace(/{{image}}/, sdk.image(item['Code10'], '11_f'))
- .replace(/{{sku}}/, num)
- .replace(/{{title}}/, title)
+ .replace(/{{sku}}/g, num)
+ .replace(/{{code8}}/g, data['Code8'])
+ .replace(/{{title}}/g, title)
+ .replace(/{{cleantitle}}/g, stonewash(title))
.replace(/{{type}}/, type)
.replace(/{{size}}/, size_name)
.replace(/{{color}}/, color_name)
diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js b/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js
new file mode 100644
index 00000000..614c3796
--- /dev/null
+++ b/StoneIsland/platforms/ios/www/js/lib/etc/accessibility.js
@@ -0,0 +1,9 @@
+$(function(){
+ $("h1").each(function(){
+ this['aria-label'] = 'Section title is ' + this.innerText
+ })
+})
+
+function stonewash (s) {
+ return s.replace(/'0/g, '20').replace(/_/g, ' ')
+} \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
index 9e0c49b6..fd0fa59d 100755
--- a/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
@@ -1,4 +1,6 @@
+var AddressViewID = Math.round(Date.now() % 1000)
+
var AddressView = SerializableView.extend({
template: $("#address_template").html(),
@@ -14,7 +16,7 @@ var AddressView = SerializableView.extend({
this.parent = opt.parent
this.checkPhone = 'checkPhone' in opt ? opt.checkPhone : true
this.setElement( this.parent.$(".address") )
- this.$el.html(this.template)
+ this.$el.html(this.template.replace(/{{_id}}/g, AddressViewID++))
},
populate: function(data){
@@ -34,12 +36,15 @@ var AddressView = SerializableView.extend({
"Address1": "Please enter your street address.",
"City": "Please enter your city.",
"ZipCode": "Please enter your zip code.",
+ "Phone": "Please enter your phone number.",
},
validate_fields: function(data, errors){
if (this.disabled) { return }
if (this.checkPhone) {
- var phone_number = data.Phone ? data.Phone.replace(/[^0-9]/g, "") : ""
+ var phone_number = data.Phone ? String(data.Phone).replace(/[^0-9]/g, "").replace(/^[01]+/, '') : ""
+ data.Phone = phone_number
+ this.$('[name=Phone]').val(phone_number)
var phone_length = phone_number.length
if (phone_length === 0 || ! data.Phone) {
errors.push([ "Phone", "Please enter your phone number." ])
@@ -50,10 +55,10 @@ var AddressView = SerializableView.extend({
else if (phone_length > 10) {
errors.push([ "Phone", "International phone numbers are not accepted." ])
}
- else if (data.Phone[0] === '+') {
+ else if (phone_number.charAt(0) === '+') {
errors.push([ "Phone", "Please enter a valid 10 digit US/Canada phone number. International phone numbers are not accepted." ])
}
- else if (phone_number[0] === '1') {
+ else if (phone_number.charAt(0) === '1') {
errors.push([ "Phone", "Please enter a valid 10 digit US/Canada phone number. International phone numbers are not accepted." ])
}
}
@@ -81,7 +86,10 @@ var AddressView = SerializableView.extend({
},
scroll_up_to_phone: function(e){
- app.view.scroller && app.view.scroller.scrollTo(0, -$(e.currentTarget).position().top)
+ var position = $(e.currentTarget).prev('label').position()
+ if (app.view.scroller && position) {
+ app.view.scroller.scrollTo(0, -position.top)
+ }
},
})
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js b/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
index 63784618..af53d964 100755
--- a/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
@@ -1,4 +1,6 @@
+var CreditCardViewID = Math.round(Date.now() % 1000)
+
var CreditCardView = SerializableView.extend({
template: $("#creditcard_template").html(),
@@ -13,7 +15,7 @@ var CreditCardView = SerializableView.extend({
initialize: function(opt){
this.parent = opt.parent
this.setElement( this.parent.$(".cc") )
- this.$el.html(this.template)
+ this.$el.html(this.template.replace(/{{_id}}/g, CreditCardViewID++))
this.$number = this.$("[name=Number]")
this.$number.validateCreditCard(this.updateCard.bind(this), this.cardOptions)
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
index 86c8ecaf..958bc8ad 100755
--- a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
@@ -23,7 +23,8 @@ var NavView = View.extend({
"click .shipping": "shipping",
"click .settings": "settings",
"click .orders": "orders",
- "click .return_link": "return_link",
+ "click .return_link_us": "return_link_us",
+ "click .return_link_ca": "return_link_ca",
"click .faq_back": "back",
"click .privacy": "privacy",
@@ -115,8 +116,11 @@ var NavView = View.extend({
this.hide()
app.router.go("account/settings")
},
- return_link: function(){
- window.open("http://www.stoneisland.com/yTos/Plugins/AreaLocalizer/Redirectarea?area=ProductExchange&controllerName=SearchOrder&actionName=Index", '_system')
+ return_link_us: function(){
+ window.open("https://www.stoneisland.com/us/ProductExchange/SearchOrder/Index?utm_source=AppMobile&utm_medium=referral&utm_campaign=ReturnForm", '_system')
+ },
+ return_link_ca: function(){
+ window.open("https://www.stoneisland.com/ca/ProductExchange/SearchOrder/Index?utm_source=AppMobile&utm_medium=referral&utm_campaign=ReturnForm", '_system')
},
@@ -141,7 +145,7 @@ var NavView = View.extend({
},
care: function(e){
e.preventDefault()
- window.open("http://www.stoneisland.com/system/web/custom/hp/email.jsp", '_system')
+ window.open("https://www.stoneisland.com/customercare?utm_source=AppMobile&utm_medium=referral&utm_campaign=CustomerCare", '_system')
},
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
index 4674fc18..b7af235a 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
@@ -196,6 +196,7 @@ var CollectionView = ScrollableView.extend({
this.items[ item['Code8'] ] = item
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']))
var $t = $(t)
if (app.store.ShowProductNameOnCollectionPage) {
var $title = $("<span>")
@@ -217,6 +218,7 @@ var CollectionView = ScrollableView.extend({
setCollectionName: function(name){
this.collectionName = name
this.$title.html(this.collectionName)
+ this.$title.attr('aria-label', stonewash(this.collectionName))
},
// filter by department
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
index 0acd48c5..d6f5723c 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
@@ -39,7 +39,9 @@ var GalleryView = View.extend({
Object.keys(valid_styles).sort(sort_image_styles).forEach(function(style){
var id = valid_styles[style] + "_" + style
- var t = this.template.replace(/{{image}}/, sdk.image(code, id))
+ var t = this.template
+ .replace(/{{image}}/, sdk.image(code, id))
+ .replace(/{{alt}}/, YOOX_IMAGE_STYLE_LABELS[style] || "Alternate view")
this.$el.append(t)
}.bind(this))
@@ -79,5 +81,8 @@ var GalleryView = View.extend({
})
var YOOX_IMAGE_STYLE_ORDER = "ZZZ f r d e a b c g l".split(" ")
-
+var YOOX_IMAGE_STYLE_LABELS = {
+ f: 'Front view',
+ r: 'Rear view',
+}
function sort_image_styles (b,a){ return (YOOX_IMAGE_STYLE_ORDER.indexOf(b)) - (YOOX_IMAGE_STYLE_ORDER.indexOf(a)) } \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
index 3bcf5ee4..c47dfddd 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
@@ -434,7 +434,9 @@ var ProductView = ScrollableView.extend({
},
share: function(){
- window.plugins.socialsharing.share( this.item['ModelNames'], null, null, "http://deeplink.me/www.stoneisland.com/store/" + this.code)
+ if (window.plugins && 'socialsharing' in window.plugins) {
+ window.plugins.socialsharing.share( this.item['ModelNames'], null, null, "http://deeplink.me/www.stoneisland.com/store/" + this.code)
+ }
},
})
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/Selector.js b/StoneIsland/platforms/ios/www/js/lib/products/Selector.js
index 9c1109f6..e3376a4d 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/Selector.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/Selector.js
@@ -21,7 +21,7 @@ var Selector = View.extend({
options.forEach(function(opt){
this.lookup[String(opt.id)] = opt
var t = this.template.replace(/{{id}}/, opt.id)
- .replace(/{{label}}/, opt.label)
+ .replace(/{{label}}/g, opt.label)
this.$options.append(t)
}.bind(this))
this.$el.show()
diff --git a/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js b/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js
index 4155f102..3181fddd 100755
--- a/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js
+++ b/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js
@@ -105,6 +105,7 @@ var SerializableView = View.extend({
console.log(errors)
var msgs = []
this.$('.error_hilite').removeClass('error_hilite')
+ this.$('.err').html('')
errors.forEach(function(e, i){
// if (i > 0) { return }
if (e[0]) {
@@ -112,13 +113,15 @@ var SerializableView = View.extend({
var el = $el[0]
if (el && el.nodeName === 'SELECT') {
$el.parent().addClass('error_hilite')
+ $el.parent().next('.err').html(e[1])
} else {
$el.addClass('error_hilite')
+ $el.next('.err').html(e[1])
}
}
- msgs.push(e[1])
+ // msgs.push(e[1])
}.bind(this))
- this.$msg.html(msgs.join("<br>"))
+ // this.$msg.html(msgs.join("<br>"))
this.$msg.addClass('alert-notice')
},