//resources
app.siteDefaultLocale = "fr-FR";
app.resources.MISSINGCHK = "Veuillez cocher cette partie";
app.resources.MISSINGVAL = "Merci d'entrer {0}";
app.resources.MISSINGCITY = "Merci de renseigner votre ville";
app.resources.SERVER_ERROR = "La connection au serveur a échoué!";
app.resources.MISSING_LIB = "jQuery is undefined.";
app.resources.BAD_RESPONSE = "Mauvaise réponse";
app.resources.INVALID_ADDRESS = "L'adresse est incorrecte";
app.resources.INVALID_PHONE = "Merci de mettre un numero de téléphone valide.";
app.resources.INVALID_EMAIL = "Veuillez fournir une adresse électronique valide.",
app.resources.EMAIL_WARNING = "L'adresse e-mail est introuvable/n'a pas pu être vérifiée.",
app.resources.INVALID_CPF = "forms.address.CPF.field.invalid";
app.resources.INVALID_CITY = "La ville saisie est inconnue",
app.resources.DOB_INCOMPLETE = "La date de naissance n'est pas complète.";
app.resources.EQUALTO = "Veuillez fournir encore la même valeur.",
app.resources.EQUALTOEMAIL = "Merci de confirmer votre adresse email",
app.resources.INVALID_EMAILLIST = "Les adresses mail suivantes ne sont pas correctes :";
app.resources.REMOVE = "Supprimer";
app.resources.CLOSE = "Fermer";
app.resources.NEXT = "global.next";
app.resources.PREV = "Précedent";
app.resources.QTY = "Qté";
app.resources.PLEASE_SELECT = "( Merci de sélectionner )";
app.resources.MISSING_CREDIT_CARD_DATA = "Please fill all required credit card data.";
app.resources.CLICK_TO_EDIT = "Cliquer pour modifier";
app.resources.SUBMIT = "Valider";
app.resources.WRONG_DATE_FORMAT = "Merci d'entrer une date dans le format demandé";
app.resources.PRINT_NOW = "Imprimer";
// Countrys
app.resources.countrysSelector = {};
app.resources.countrysSelector.regionAmericas = "Americas";
app.resources.countrysSelector.regionApac = "APAC / ASIA";
app.resources.countrysSelector.regionEurope = "Europe";
app.resources.countrysSelector.regionAfrica = "Africa";
app.resources.countrysSelector.europe = "Europe";
app.resources.countrysSelector.international = "International";
app.resources.sessioncountrycode = "fr";
app.resources.sessioncountry= "France";
// Other State select option
app.resources.otherStateOptionName = "Other";
app.resources.otherStateOptionValue = "OTHER";
// Date Picker localisation
app.resources.dates = {};
app.resources.dates['TODAY'] = "Aujourd'hui";
app.resources.dates['WEEKHEADER'] = "Sem.";
app.resources.dates['DATE_FORMAT'] = "dd/mm/yy";
app.resources.dates['MONTH'] = [
"Janvier"
, "Février"
, "Mars"
, "Avril"
, "May"
, "Juin"
, "Juillet"
, "Août"
, "Septembre"
, "Octobre"
, "Novembre"
, "Décembre"
];
app.resources.dates['MONTH_SHORT'] = [
"Janv."
, "Févr."
, "Mars"
, "Avril"
, "Mai"
, "Juin"
, "Juil."
, "Août"
, "Sept."
, "Oct."
, "Nov."
, "Déc."
];
app.resources.dates['DAY_NAMES'] = [
"Dimanche"
, "Lundi"
, "Mardi"
, "Mercredi"
, "Jeudi"
, "Vendredi"
, "Samedi"
];
app.resources.dates['DAY_NAMES_SHORT'] = [
"Dim"
, "Lun"
, "Mar"
, "Mer"
, "Jeu"
, "Ven"
, "Sam"
];
app.resources.dates['DAY_NAMES_MIN'] = [
"D"
, "L"
, "M"
, "M"
, "J"
, "V"
, "S"
];
// product availability messages
app.resources["IN_STOCK"] = "En Stock";
app.resources["QTY_IN_STOCK"] = "{0} articles (s) en Stock";
app.resources["PREORDER"] = "Pre-Commande";
app.resources["QTY_PREORDER"] = "{0} article(s) sont commandables pour livraison dés diponibilité.";
app.resources["REMAIN_PREORDER"] = "Ces articles sont disponibles en précommande.";
app.resources["BACKORDER"] = "Back Order";
app.resources["QTY_BACKORDER"] = "Commande sur disponiblité future {0} article(s)";
app.resources["REMAIN_BACKORDER"] = "Ces articles sont .";
app.resources["NOT_AVAILABLE"] = "Non dispo.";
app.resources["REMAIN_NOT_AVAILABLE"] = "Ces articles ne sont actuellement plus disponibles. Merci de changer la quantité.";
app.resources["IN_STOCK_DATE"] = "La date d'entrée en stock prévue est {0}.";
app.resources["NON_SELECTED"] = "Pas sélectionné";
app.resources["MISSING_VAL"] = "Selectionez {0}";
app.resources["SIZECHART_TITLE"] = "grille des tailles";
app.resources["SEND_TO_FRIEND"] = "Envoyer à un ami";
app.resources["MISSING_VAL"] = "Selectionez {0}";
//shipping resources
app.resources["SHIP_STATE_LABEL"] ="Département";
app.resources["SHIP_PROVINCE_LABEL"] ="Région";
app.resources["SHIP_QualifiesFor"] = "Mode de livraison valable pour"
app.resources["STOREPICKUP"] = "Choisissez le lieu de livraison"
app.resources["STOREPICKUP_POSTCODE"] = "Postcode value is required."
app.resources["STOREPICKUP_EMPTY_RESULT"] = "Aucun résultat"
app.resources["SHIP_TO_COUNTRY_POST_LABEL"] = "";
//shipping resources
app.resources["BILL_GC"] = "GIFT_CERTIFICATE";
//billing resources
app.resources["CREDIT_CARD_TYPE"] = "dwfrm_billing_paymentMethods_creditCard_type";
// bonus products messages
app.resources["BONUS_PRODUCTS"] = "Produit(s) bonus";
app.resources["SELECT_BONUS_PRODUCT"] = "sélectionner";
app.resources["BONUS_PRODUCT_MAX"] = "Le nombre maximum de produit bonus est atteint. Merci den annuler un si vous souhaitez le remplacer.";
app.resources["SIMPLE_SEARCH"] = "Entrez un mot clé ou un numéro darticle #";
// Gift Cert resources
app.resources["REG_ADDR_ERROR"] = "Nous n'avons pas pu charger l'adresse";
app.resources["GIFTCARD_CAN_NOT_BE_VALIDATED"] = "Désolé, le numéro de carte cadeau inséré est incorrect.";
app.resources.loyalty = {};
app.resources.loyalty.notifyTCChange = "false";
app.resources.loyalty.getCustomerAcceptationUrl = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Account-LoyaltyGetTcAcceptationValue";
app.resources.loyalty.setCustomerAcceptationUrl = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Account-LoyaltySetTcAcceptationValue";
app.resources.loyalty.getTcAcceptationPop = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Account-LoyaltyGetTcAcceptationPopup";
app.resources.loyalty.saveCustomerEmailUrl = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Account-LoyaltySaveCustomerEmail";
//Store pickup page
app.resources.storepickup = {};
app.resources.storepickup.storesicon = "https://www.quiksilver.fr/on/demandware.static/Sites-QS-FR-Site/-/default/dw009547d0/images/icons/pushpin.png";
app.resources.storepickup.selectlabel = "Selectionner";
app.resources.storepickup.storeicons_url = "/on/demandware.static/-/Sites-QS-FR-Library/fr_FR/v1554429730310/REPLACEME";
app.resources.storepickup.storeicons_config = null; // as JSON String
app.resources.storepickup.sessionlocale = "fr";
app.resources.storepickup.currency_symbol = "€";
app.resources.storepickup.deliveryTimeText1 = "checkout.pickstore.deliveryTimeText1";
app.resources.storepickup.deliveryTimeText2 = "checkout.pickstore.deliveryTimeText2";
app.resources.storepickup.noresultstitle = "Aucun résultat";
app.resources.storepickup.emptysearchfieldmsg = "checkout.pickstore.emptysearchfieldmsg";
//Store locator page
app.resources.storelocator = {};
app.resources.storelocator.dwClientID = "38bb2962-3bb4-46ab-8068-d9840d414ba4";
app.resources.storelocator.sendlabel = "Envoyer adresse via";
app.resources.storelocator.emaillink = "Email";
app.resources.storelocator.viewstorehours = "Voir les horaires d'ouverture";
app.resources.storelocator.phonelabel = "Tél:";
app.resources.storelocator.dayrange = "Du lundi au dimanche";
app.resources.storelocator.monday = "Lundi";
app.resources.storelocator.tuesday = "Mardi";
app.resources.storelocator.wednesday = "Mercredi";
app.resources.storelocator.thursday = "Jeudi";
app.resources.storelocator.friday = "Vendredi";
app.resources.storelocator.saturday = "Samedi";
app.resources.storelocator.sunday = "Dimanche";
app.resources.storelocator.hoursrange = "A partir de %CLOSE% à %CLOSE%";
app.resources.storelocator.storesicon = "/on/demandware.static/Sites-QS-FR-Site/-/default/dwf11e52b9/images/icons/stores-icon.png";
app.resources.storelocator.outletsicon = "/on/demandware.static/Sites-QS-FR-Site/-/default/dw8d19d2f1/images/icons/outlets-icon.png";
app.resources.storelocator.boardridersclubicon = "/on/demandware.static/Sites-QS-FR-Site/-/fr_FR/v1554429730310/images/icons/boardridersclub-icon.png";
app.resources.storelocator.dealersicon = "/on/demandware.static/Sites-QS-FR-Site/-/default/dw474cc18e/images/icons/authorized-dealers-icon.png";
app.resources.storelocator.providerURL = "https://dev.virtualearth.net/REST/v1/Locations?query=";
app.resources.storelocator.providerKey = "Ait6vo6o9O126kS5OYoHkOclWg3-DY4ifecpLP3b3r49sPbXI-RoLy2fAdvP7vg_";
app.resources.storelocator.defaultLocations = '{"US":{"latitude":33.740053530431425,"longitude":-118.03146985054013},"FR":{"latitude":46.227638,"longitude":2.213749000000007},"DE":{"latitude":51.165691,"longitude":10.451526},"CH":{"latitude":46.818188,"longitude":8.227511999999933},"DK":{"latitude":56.26392,"longitude":9.50178500000004},"GB":{"latitude":55.378051,"longitude":-3.43597299999999},"RU":{"latitude":61.52401,"longitude":105.31875600000001},"ES":{"latitude":40.46366700000001,"longitude":-3.7492200000000366},"IE":{"latitude":53.41291,"longitude":-8.243889999999965},"IT":{"latitude":41.87194,"longitude":12.56738},"NL":{"latitude":52.132633,"longitude":5.2912659999999505},"BE":{"latitude":50.503887,"longitude":4.4699359999999615},"LU":{"latitude":49.815273,"longitude":6.129583000000025},"PT":{"latitude":39.39987199999999,"longitude":-8.224454000000037},"FI":{"latitude":61.92410999999999,"longitude":25.748151000000007}}';
app.resources.storelocator.storeLocatorFilterOnline = "true";
app.resources.storelocator.noresultstitle = "Aucun résultat";
app.resources.storelocator.noresultsfound = "Aucun résultat trouvé avec vos critères de recherche";
app.resources.storelocator.noresultshelp = "Merci de bien vouloir renseigner une ville et un pays";
// Product tile
app.resources.COLOR = "Couleur";
app.resources.COLORS = "Couleurs";
app.resources["GIFT_CERT_ID"] = "input[name=dwfrm_giftcert_balance_giftCertID]";
app.resources["GIFT_CERT_FROM"] = "dwfrm_giftcert_purchase_from";
app.resources["GIFT_CERT_RECIPIENT"] = "dwfrm_giftcert_purchase_recipient";
app.resources["GIFT_CERT_RECIPIENT_EMAIL"] = "dwfrm_giftcert_purchase_recipientEmail";
app.resources["GIFT_CERT_RECIPIENT_CONF_EMAIL"] = "dwfrm_giftcert_purchase_confirmRecipientEmail";
app.resources["GIFT_CERT_RECIPIENT_MSG"] = "dwfrm_giftcert_purchase_message";
app.resources["GIFT_CERT_AMT"] = "dwfrm_giftcert_purchase_amount";
app.resources["GIFT_CERT_BALANCE"] = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/GiftCert-CheckBalance";
app.resources["GIFT_CERT_CUR_BALANCE"] = "Le solde de votre carte cadeau est de";
app.resources["GIFT_CERT_MISSINGCODE"] = "Merci d'entrer le code du cheque cadeau";
app.resources["GIFT_CERT_INVALIDCODE"] = "Merci de vérifier le code de votre chèque cadeau";
app.resources["GIFT_CERT_ERROR"] = "Merci d'entrer une information correcte";
app.resources["GIFT_BALANCE_ERROR_CODE"] = "Veuillez saisir le code de votre carte cadeau";
app.resources["GIFT_BALANCE_ERROR_PIN"] = "Veuillez saisir le code PIN";
app.resources["GIFT_BALANCE_ERROR_DIGIT"] = "Le code PIN doit comporter 4 chiffres";
app.resources["WISHLIST_LIST"] = "";
app.resources["WISHLIST_PROGRESS_IMAGE"] = "/on/demandware.static/Sites-QS-FR-Site/-/default/dw1bebffbb/images/loading-progress-98x22.gif";
// PDP
app.resources["SAVED_FOR_LATER"] = "Sauvegardé";
app.resources["SAVE_FOR_LATER"] = "Sauvegarder";
app.resources.verticalVideoLocation = "null";
app.resources["PHONE_VALIDATION"] = {"US":{"mask":"(999) 999-9999","placeholder":"(___) ___-____","regex":"^(\\+0?1\\s)?\\(?\\d{3}\\)?[\\s.-]\\d{3}[\\s.-]\\d{4}$|^[a-zA-Z0-9]{7,20}$"},"BR":{"mask":"(99)99999-9999","multiMask":["(00)00000-0000","(00)0000-00009"],"placeholder":"(__)____-____","regex":"^([0-9]{2})?(\\([0-9]{2}\\))([0-9]{4}|[0-9]{5})-[0-9]{4}$"},"NL":{"regex":"^[\\+]*([\\-0-9][ ]*){7,15}$"},"default":{"regex":"^[\\+]*([\\-0-9][ ]*){7,20}$"}};
app.resources["ZIP_MASK"] = "";
app.resources["ZIP_PLACEHOLDER"] = "0";
app.resources["CPF_MASK"] = "0";
app.resources["CPF_PLACEHOLDER"] = "0";
app.resources["GIFT_CARD_LIMIT"] = "Oops! Please enter a gift card value between $25 and $500.";
app.resources["GIFT_CARD_SELECT"] = "Sélectionnez ou saisissez un montant";
app.resources["MONEY"] = "0,00 €";
//The follow snippet is executed to pass some Demandare URLs into the script
app.minicart.url = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Cart-MiniAddProduct";
app.URLs.addProductToCart = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Cart-AddProduct";
app.URLs.updateLineItem = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Cart-UpdateLineItem";
app.URLs.wishlistAddress = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Wishlist-SetShippingAddress?AddressID=";
app.URLs.addProductToWishlist = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Wishlist-Add";
app.URLs.removeProductFromWishlist = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Wishlist-Remove";
app.URLs.SetShippingContext = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Hooking-SetShippingContext";
app.URLs.SetLocalization = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Geolocation-SetLocalization";
// S.E.O links scripting
app.URLs.userLogin = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Account-Show";
app.URLs.userRegister = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Account-StartRegister";
app.URLs.sizeChartShow = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/SizeChart-Show";
app.URLs.accountShow = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Account-Show";
app.URLs.contactUs = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/CustomerService-ContactUs";
app.URLs.logOut = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Login-Logout";
app.URLs.getShippingMethodsList = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/COShipping-UpdateShippingMethodList";
app.URLs.updateOrderTotals = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/COBilling-UpdateOrderTotals";
app.URLs.storeBillingAddress = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/COShipping-StoreUnsavedBillingAddress";
app.URLs.getProductUrl = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Product-Show";
app.URLs.searchUrl = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Search-Show";
app.URLs.getVariants = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Product-GetVariants";
app.URLs.getAvailability = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Product-GetAvailability";
app.URLs.loadingSmallImg = "/on/demandware.static/Sites-QS-FR-Site/-/default/dwa70bd09f/images/loading-small.gif";
app.URLs.formatMoney = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Product-FormatPrices";
app.URLs.removeImg = "/on/demandware.static/Sites-QS-FR-Site/-/default/dwffb20893/images/icon_remove.gif";
app.URLs.searchsuggest = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Search-GetSuggestions";
app.URLs.searchnavigation = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Search-IncludeLeftNavigation";
app.URLs.submitDialogURL = 'https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Page-AppResources/C1388056243';
app.URLs.productNav = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Product-Productnav";
app.URLs.SeverConnectionError = "La connection au serveur a échoué!";
app.URLs.quickview_product_url = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Proxy-Product2JSON";
app.URLs.PIConfirmDelete = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/PaymentInstruments-ConfirmDelete";
app.URLs.addressConfirmDelete = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Address-ConfirmDelete";
app.URLs.pageInclude = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Page-Include";
app.URLs.findInStoreTemplate = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/FindInStore-Show";
app.URLs.findInStoreSearch = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/FindInStore-ProductSearch";
app.URLs.findInStoreLineItems = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/FindInStore-DisplayStores";
app.URLs.cartShow = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/Cart-Show";
app.resources["NO_STORES_FOUND"] = "Sorry, but there were no stores found in this area with inventory in stock. Please try using the search box above to search in other areas.";
app.resources["phone_input_no_results_text"] = "Aucun résultat";
app.resources.getOtherRegionWebsiteJSON = "/on/demandware.store/Sites-QS-FR-Site/fr_FR/Home-GetOtherRegionsWebsiteJSON";
// DQE - Preferences
app.DqeProxyUrl = "https://www.quiksilver.fr/on/demandware.store/Sites-QS-FR-Site/fr_FR/DQE-Proxy";
app.DqeEmailCheckEnabled = true;
app.DqePhoneCheckEnabled = true;
app.DqeAddressCheckEnabled = true;
app.DqeClientRNVPCheckEnabled = false;
app.DqeEmailAutocheck = true;
app.DqeEmailSuggest = false;
app.DqePhoneAutocheck = true;
app.DqePhoneNumberFormat = 4;
app.DqeCitySearch = 0;
app.DqeSearchDelay = 500;
app.DqeSingleSearchDelay = 1000;
app.DqeZipPatterns = {
'PRT': /^\d{4}([\-]\d{3})?$/, //new
'IRL': /^[A-Za-z]\d{2}\s[A-Za-z\d]{4}$/, //new
'FRA': /^\d{5}$/,
'DEU': /^\d{5}$/,
'AUT': /^\d{4}$/,
'BEL': /^\d{4}$/,
'CAN': /^[A-Z\d]{3} ?[A-Z\d]{3}$/,
'KOR': /^\d{3}[ -]?\d{3}$/,
'ESP': /^\d{5}$/,
'USA': /^([A-Z]{2})?[ -]?\d{5}[ -]?(\d{4})?$/i,
'ISR': /^\d{5}$/,
'ITA': /^\d{5}$/,
'LUX': /^\d{4}$/i,
'NLD': /^\d{4} ?([A-Z]{2})?$/,
'POL': /^\d\d-?\d{3}$/,
'PRT': /^\d{4}-?\d{3}$/,
'CZE': /^\d{3} ?\d{2}$/,
'ROU': /^\d{6}$/,
'GBR': /^[A-Z][A-Z\d]{1,3} ?\d[A-Z]{2}$/i,
'SGP': /^\d{6}$/,
'SVN': /^\d{4}$/,
'SWE': /^(SE)?-?\d{3} ?\d{2}$/,
'CHE': /^\d{4}$/,
'TUR': /^\d{5}$/,
'CHN': /^\d{6}$/,
'CHN-en': /^\d{6}$/,
'RUS': /^\d{6}$/,
'NOR': /^\d{4}$/,
'DNK': /^\d{4}$/,
'FIN': /^\d{5}$/,
'THA': /^\d{5}$/,
'MAR': /^\d{5}$/,
'HUN': /^\d{4}$/,
'HKG': /^.*$/, //Hong-kong
'HKG-en': /^.*$/, //Hong-kong
'QAT': /^.*$/, //Qatar
'NZL': /^\d{4}$/, //Nouvelle-zélande
'HRV': /^(HR)?-?\d{5}$/ //Croatie
};
// form validation zip patterns
app.FormValidationZipPatterns = {
"AT": "^\\d{4}$",
"BE": "^\\d{4}$",
"BR": "^\\d{5}([\\-]?)(\\d{3})$",
"CA": "^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJ-NPRSTV-Z][ ]?\\d[ABCEGHJ-NPRSTV-Z]\\d$",
"CH": "^\\d{4}$",
"DE": "^\\d{5}$",
"DK": "^\\d{4}$",
"ES": "^\\d{5}$",
"FI": "^\\d{5}$",
"FR": "^\\d{5}$",
"GB": "^[A-Pa-pR-Ur-uWYZwyz](([A-Ha-hK-Yk-y]?\\d\\d?)|(\\d[A-Ha-hJKPSTUWjkpstuw])|([A-Ha-hK-Yk-y]\\d[ABEHMNPRabehmnprV-Yv-y]))\\s?\\d[ABabD-Hd-hJLNjlnP-Up-uW-Zw-z]{2}$",
"IT": "^\\d{5}$",
"LU": "^\\d{4}$",
"NL": "^\\d{4} ?([A-Z]{2})?$",
"PT": "^\\d{4}([\\-]\\d{3})?$",
"US": "^((\\d{5}[ -]{1,1}\\d{4})|(\\d{5})|([AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\\d[A-Za-z]\\s?\\d[A-Za-z]\\d))$",
"IE": "^[A-Za-z]\\d{2}\\s[A-Za-z\\d]{4}$",
"SE": "^(SE)?-?\\d{3} ?\\d{2}$"
};
//Geolocation references
app.resources["GEO_COUNTRY_CODE"] = "PT";
app.resources["SHIP_TO_COUNTRY_CODE"]= "FR";
app.globalRedirectURL = "null";
// translations for ARIA attributes
app.resources.aria = {};
app.resources.aria.closesearch = "Fermer la recherche";
// Abandonned cart preferences
app.resources.abandonedCart = {
enabled : true,
provider : "AdobeCampaign",
storeEmailUrl : "/on/demandware.store/Sites-QS-FR-Site/fr_FR/AbandonedCart-StoreEmail",
storeNpkUrl : "/on/demandware.store/Sites-QS-FR-Site/fr_FR/AbandonedCart-StoreNpk"
};
// Country Context Preferences
// switched on or off via site preference > general > Site Configuration
app.resources.categoryContext = {
enabled: false,
setCategoryContextUrl: "/on/demandware.store/Sites-QS-FR-Site/fr_FR/CategoryContext-Set",
cookieName: "brCategoryContext",
contextUrls: {"alt1":"/alt1/","men":"/homme/","women":"/femme/","kids":"/enfant/","surf":"/surf/","snow":"/snow/","sales":"/soldes/","gooddeals":"/bons-plans/","wetsuits":"/collection-wetsuits/","gift-card":"/gift-card/","size-chart":"/size-chart/","blog":"/blog/","collection":"/collection/","christmas":"/cadeaux-de-noel/","specialoffer":"/offres-speciales/","fit-guide":"/fit-guide/"}
};
// translation of jQuery validate
(function ($) {
$.extend($.validator.messages, {
required : "Ce champ est obligatoire.",
remote : "Veuillez corriger ce champ.",
email : "Veuillez fournir une adresse électronique valide.",
url : "Veuillez fournir une adresse URL valide.",
cpf : "forms.address.CPF.field.invalid",
date : "Veuillez fournir une date valide.",
dateISO : "Veuillez fournir une date valide (ISO).",
number : "Veuillez fournir un numéro valide.",
digits : "Veuillez fournir seulement des chiffres.",
creditcard : "Veuillez fournir un numéro de carte de crédit valide.",
equalTo : "Veuillez fournir encore la même valeur.",
equalToIgnoreCase : "Veuillez fournir encore la même valeur.",
maxlength : $.validator.format("Veuillez fournir au plus {0} caractères."),
minlength : $.validator.format("Veuillez fournir au moins {0} caractères."),
rangelength : $.validator.format("Veuillez fournir une valeur qui contient entre {0} et {1} caractères."),
range : $.validator.format("Veuillez fournir une valeur entre {0} et {1}."),
max : $.validator.format("Veuillez fournir une valeur inférieur ou égal à {0}."),
min : $.validator.format("Veuillez fournir une valeur supérieur ou égal à {0}."),
emailConfirmIgnoreCase : "Merci de confirmer votre adresse email",
validateCountryState : "Please select a state associated with the selected country.",
zip : {
DE : "Bitte gib deine Postleitzahl mit 5 Ziffern an",
US : "Merci de saisir un code postal au format suivant: XXXXX or XXXXX-XXXX (chiffres uniquement).",
FR : "Merci de saisir un code postal composé de 5 chiffres.",
CA : "Please provide your postal code in a format like J8R 2A5.",
GB : "Merci de saisir un code postal formaté comme celui-ci YO31 1EB",
NL : "Merci de saisir un code postal formaté comme celui-ci 1114 AA",
PT : "Merci de saisir un code postal formaté comme celui-ci 1114-185",
IE : "Please provide your postal code in a format like D02 AF30.",
BR : "global.zip.validation.hint.format",
ES : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée.",
IT : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée.",
AT : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée.",
BE : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée.",
CH : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée.",
DK : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée.",
FI : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée.",
LU : "Le code postal que vous avez saisi n'est pas référencé dans notre base de donnée."
}
});
$.validator.customOptions = {
showRequiredMessages : true
};
// Pre init
// initialize the category context feature, if enabled
if (app.resources.categoryContext.enabled) {
app.processPageContext();
// we check if we have a cookie
var oldCookieJson = $.cookie.json;
$.cookie.json = false;
var categoryContextCookie = $.cookie(app.resources.categoryContext.cookieName);
$.cookie.json = oldCookieJson;
var currentCategoryContext = app.PageContext.firstLevelCategoryId;
// we check if we are on a certain category page
// do we need to override the cookie with a new value?
if (currentCategoryContext && currentCategoryContext !== categoryContextCookie) {
categoryContextCookie = currentCategoryContext;
$.get(app.resources.categoryContext.setCategoryContextUrl + '?categoryContext=' + encodeURIComponent(categoryContextCookie));
}
// add the class, if we have a value
if (categoryContextCookie) {
$('body').addClass('category-context-' + categoryContextCookie);
if (app.PageContext.pageType === 'StoreFront') {
console.log('Redirect to saved category context page');
window.location.href = app.resources.categoryContext.contextUrls[categoryContextCookie];
}
}
}
}(jQuery));
for (var namespace in Widgets.widgetExecutions) {
Widgets.widgetExecutions[namespace][Widgets.widgetExecutions[namespace].length] = 'DQEAddressCompletion';
}
// Address Verification System widget
Widgets.registered['DQEAddressCompletion'] = function(elem) {
var config = myEval(elem.data('config'));
//console.log('start DQEAddressCompletion');
//console.log('address1FieldID: ' + config.address1FieldID);
//console.log('context: ' + config.context);
var dv_shipping, dv_billing;
if (config.context == 'shipping') {
dv_shipping = new DQEValidator(config);
} else {
config.context = 'billing';
dv_billing = new DQEValidator(config);
}
};
var DQEValidator = function(config) {
// console.log('run DQEValidator - ' + config.context);
// DQEValidator options -
// custom site preferences DQE Options (load the prefs)
var options = {
proxyUrl : app.DqeProxyUrl // DW-Server Proxy Url - DqeProxyUrl
, emailCheckEnabled : app.DqeEmailCheckEnabled // Enabled or disabled the email Check - DqeEmailCheckEnabled
, phoneCheckEnabled : app.DqePhoneCheckEnabled // Enabled or disabled the phone number Check - DqePhoneCheckEnabled
, addressCheckEnabled : app.DqeAddressCheckEnabled // Enabled or disabled the address Check - DqeAddressCheckEnabled
, clientRNVPCheckEnabled : app.DqeClientRNVPCheckEnabled// Enabled or disabled the client side RNVP address check - DqeClientRNVPCheckEnabled
, emailAutocheck : app.DqeEmailAutocheck // When this parameter is at true, checking is launched automatically as soon as the email address entry field is left - DqeEmailAutocheck
, emailSuggest : app.DqeEmailSuggest // When this parameter is at true, automatic completion of the address being entered is triggered: valid e-mail values are suggested to the user during entry - DqeEmailSuggest
, phoneAutocheck : app.DqePhoneAutocheck // When this parameter is at true, checking is launched automatically as soon as the phone entry field is left - DqePhoneAutocheck
, phoneNumberFormat : app.DqePhoneNumberFormat // Format 1: "+33 3 39 89 88 71", 2: "0033 3 39 89 88 71", 3: "+33339898871", 4: "0033339898871" - DqePhoneNumberFormat
, citySearch : 0//app.DqeCitySearch // 0 or 1 (if this parameter is present and is 1, it is possible to search for a postal code from the city field) - DqeCitySearch
, zipPatterns : app.DqeZipPatterns // Global Preference that holds the Regular expressions to test if a postal code has been entered to start searching for cities. Overwrites the internal zip patterns.
, searchDelay : app.DqeSearchDelay // The delay in milliseconds between when a keystroke occurs and when a ajax search is performed. DqeSearchDelay
, singleSearchDelay : app.DqeSingleSearchDelay // The delay in milliseconds between when a keystroke occurs and when single line address search is performed. DqeSingleSearchDelay
}
var HASH = "#"; // if you write # directly, it ends in an unrecognised error.
// gets the form id
var getFormId = function(){
//return '#RegistrationForm';
var formId = HASH + $(HASH + config.address1FieldID).closest('form').attr('id');
return formId;
};
// gets the field prefix
var getFieldIdPrefix = function(){
//return '#dwfrm_profile_address_';
var prefix = HASH + config.address1FieldID.replace('address1','');
return prefix;
};
// ---------------------------------------------------
// set some vars and form field id's
var form_id = getFormId()
, prefix = getFieldIdPrefix()
, firstName_id = prefix + 'firstName'
, lastName_id = prefix + 'lastName'
, address1_id = prefix + 'address1'
, address2_id = prefix + 'address2'
, address3_id = prefix + 'address3'
, province_id = prefix + 'province'
, zip_id = prefix + 'zip'
, city_id = prefix + 'city'
, countryCode_id = prefix + 'countryCode'
, phone_id = prefix + 'phone'
, email_id = prefix + 'email'
, emailconfirm_id = prefix + 'emailconfirm'
;
// add a hidden form field for submitting the address hash
var adrhash_id = prefix + 'adrhash';
$(form_id).append('');
$(form_id).append('');
// create the addressHash and stores in a hidden form field
var createAddressHash = function() {
// there is a problem with the URI encoding. client and server side it's not the same encoding result.
// therefore we can't use a client side hash to compare with the server side hash.
/*
var zip = $(zip_id).val()
, city = $(city_id).val()
, street = $(address1_id).val()
, compl = $(address2_id).val()
, prov = $(province_id).val()
;
var addr = compl + "|" + street + "|" + prov + "|" + zip + "|" + city;
var str = addr.toLowerCase();
str = str.replace(/ä/g, "ae");
str = str.replace(/ö/g, "oe");
str = str.replace(/ü/g, "ue");
str = str.replace(/ß/g, "ss");
str = encodeURIComponent(str);
var addressHash = b64_md5(str);
$(adrhash_id).val(addressHash);
*/
// instead we use 'SUCCESS'
$(adrhash_id).val('SUCCESS');
};
// removes the addressHash from the hidden form field
var removeAddressHash = function() {
$(adrhash_id).val('');
};
//console.log('form_id: ' + form_id);
//console.log('zip_id: ' + zip_id);
//console.log('city_id: ' + city_id);
//console.log('address1_id: ' + address1_id);
// ---------------------------------------------------
// init email check
if (options.emailCheckEnabled && $(email_id).length > 0 && !($(email_id).hasClass('dqeEmailValidation_initialized'))) {
$(email_id).addClass('dqeEmailValidation_initialized'); // mark field as dqe validated
/* DQE tests if attrib 'data-ui-autocomplete' on the city field to show the autocomplete on focus.
To fix this problem, we add the attrib to the fields with autocomplete.
$(email_id).attr('data-ui-autocomplete','true');
*/
$(email_id).attr('data-ui-autocomplete','true');
var dqe_email = $(email_id).dqemail({
server: options.proxyUrl
, autocheck: options.emailAutocheck
, suggest: options.emailSuggest
, last_name: lastName_id
, first_name: firstName_id
});
var _email_id = email_id.replace(HASH, '');
var _id_email_status = 'id_email_status_' + config.context;
var id_email_status = HASH + _id_email_status;
$(email_id).parent().append('');
dqe_email.on('checking', function() {
//console.log('checking');
$(id_email_status).attr('style','color:grey;');
$(id_email_status).html("Checking");
}).on('checked', function(ui, data) {
// 91: Syntax error
// 92: Unknown domain
// 93: Blacklisted domain
// 94: E-mail address considered to be spam
// 99: Service not available
// 02: E-mail address not found for this domain
// 01: E-mail correct but name could not be checked
// 00: Valid e-mail
$(id_email_status).attr('style','');
var code = data.code+'';
switch(code) {
default: break;
// ACCEPTED
case '00': case '99':
//console.log('email - accepted - code: ' + data.code);
$(email_id).addClass('valid');
$(email_id).removeClass('errorclient');
$(id_email_status).html('');
break;
// ACCEPTED WITH WARNING
case '01': case '02':
//console.log('email - accepted with warning - code: ' + data.code);
$(email_id).addClass('valid');
$(email_id).removeClass('errorclient');
$(id_email_status).html(app.resources.EMAIL_WARNING);
break;
// NOT ACCEPTED
case '91': case '92': case '93': case '94':
//console.log('email - not accepted - code: ' + data.code + ' msg: ' + data.msg);
$(email_id).removeClass('valid');
$(email_id).addClass('errorclient');
$(id_email_status).html(app.resources.INVALID_EMAIL);
break;
}
}).on("keypress", function() {
//console.log('keypress');
$(email_id).addClass('valid');
$(email_id).removeClass('errorclient');
$(id_email_status).html('');
});
/*
// we do not need the emailconfirm check
$.validator.addMethod('emailconfirmignorecase', function(phone) {
if ($(emailconfirm_id).hasClass('valid')) return true;
else return false; }, ''
);
var _id_emailconfirm_status = 'id_emailconfirm_status_' + config.context;
id_emailconfirm_status = HASH + _id_emailconfirm_status;
//$(emailconfirm_id).parent().append('');
$(emailconfirm_id).on('keyup', function() {
//console.log('on keyup');
if ($(email_id).val() != $(emailconfirm_id).val()) {
$(emailconfirm_id).removeClass('valid');
$(emailconfirm_id).addClass('errorclient');
$(id_emailconfirm_status).addClass('errormessage');
$(id_emailconfirm_status).html(app.resources.EQUALTOEMAIL);
} else {
$(emailconfirm_id).addClass('valid');
$(emailconfirm_id).removeClass('errorclient');
$(id_emailconfirm_status).html('');
$(id_emailconfirm_status).removeClass('errormessage');
}
});
*/
}
// ---------------------------------------------------
// init phone check
if (options.phoneCheckEnabled) {
var dqe_phone = $(phone_id).dqephone({
server: options.proxyUrl
, autocheck: options.phoneAutocheck
, country: countryCode_id
, format: 2 // we get only formtat 2, because we change the output ourselves
// input: "0033 3 39 89 88 71"
// output: "+33 3 39 89 88 71"
//, format: options.phoneNumberFormat // 0: Numerals only, 1: With separators, 2: Basic international, 3: Full international
});
var _phone_id = phone_id.replace(HASH, '');
var _id_phone_status = 'id_phone_status_' + config.context;
var id_phone_status = HASH + _id_phone_status;
$(phone_id).parent().append('');
// we detach the phone validation and create a new one, form.validation.js must be load before app.js
$(phone_id).removeClass('phone'); // detach the 'phone' validation method
$(phone_id).addClass(_phone_id);
$.validator.addMethod(_phone_id, function(phone) {
if (!$(phone_id).hasClass('errorclient')) return true;
return false;
}, app.resources.INVALID_PHONE );
/* not used
var callback_phoneCheck_func_name = 'callback_phone_' + config.context;
window[callback_phoneCheck_func_name] = function(data) {
//console.log('callback_phone: ' + config.context + ' - dqe_phone checked: ' + data.status);
};
*/
dqe_phone.on('checking', function() {
$(id_phone_status).attr('style','color:grey;');
$(id_phone_status).html("Checking");
}).on('checked', function(ui, data) {
//console.log('dqe_phone checked: ' + data.status);
$(id_phone_status).attr('style','');
if (data.status) { // ok = status = 1
$(phone_id).addClass('valid');
$(phone_id).removeClass('errorclient');
// Format 1: "+33 3 39 89 88 71", 2: "0033 3 39 89 88 71", 3: "+33339898871", 4: "0033339898871"
var newPhoneNumber = data.output;
if (options.phoneNumberFormat == 2 || options.phoneNumberFormat == 4) { // replacing leading '+' with '00'
newPhoneNumber = newPhoneNumber.replace(/[+]/g, '00');
}
if (options.phoneNumberFormat == 3 || options.phoneNumberFormat == 4) { // removes all spaces
newPhoneNumber = newPhoneNumber.replace(/-|\s/g, '');
}
$(phone_id).val(newPhoneNumber);
$(id_phone_status).html('');
} else { // nok = status = 0
$(phone_id).removeClass('valid');
$(phone_id).addClass('errorclient');
$(id_phone_status).html(app.resources.INVALID_PHONE);
}
}).on("keypress", function() {
$(phone_id).removeClass('errorclient');
$(id_phone_status).html('');
}).on("change", function() {
if ( $(phone_id).val() ) {
//dqe_phone.check(callback_phoneCheck_func_name, 1, $(phone_id).val());
} else {
$(phone_id).removeClass('errorclient');
$(id_phone_status).html('');
}
});
}
// ---------------------------------------------------
// init address check
if (options.addressCheckEnabled) {
/* DQE tests if attrib 'data-ui-autocomplete' on the city field to show the autocomplete on focus.
To fix this problem, we add the attrib to the fields with autocomplete.
$(city_id).attr('data-ui-autocomplete','true');
*/
$(zip_id).attr('data-ui-autocomplete','true');
$(city_id).attr('data-ui-autocomplete','true');
$(address1_id).attr('data-ui-autocomplete','true');
$(address2_id).attr('data-ui-autocomplete','true');
$(province_id).attr('data-ui-autocomplete','true');
var dqe_address = $(form_id).dqe({
server : options.proxyUrl
, country : countryCode_id
, zip : zip_id
, city : city_id
, street : address1_id
, prov : province_id // only for IT
, 'compl' : address2_id
, 'city_search' : options.citySearch
, single : address3_id // dedicated address search field
, searchDelay : options.searchDelay
, singleSearchDelay : options.singleSearchDelay
//, neighbourhood : 0
//, neighboursize : 100
//, local : '#id_local'
//, company : '#id_company'
//, geoloc : "callback_geoloc1"
//, realtime_override : 1 // ? nothing found about this param
});
// update DQE internal zip patterns with the global preference DqeZipPatterns
var updateZipPatterns = function(dqe) {
for (var key in options.zipPatterns) {
dqe.zip_pattern[key] = options.zipPatterns[key]
}
};
//for (var key in dqe_address.zip_pattern) { console.log(key + ': ' + dqe_address.zip_pattern[key]); }
updateZipPatterns(dqe_address);
var _id_address_status = 'id_address_status_' + config.context;
var id_address_status = HASH + _id_address_status;
$(address1_id).parent().append('');
setField_ok= function(field_id, message) {
$(field_id).removeClass('errorclient');
$(field_id).addClass('valid');
$(id_address_status).removeClass('errormessage');
$(id_address_status).html(message);
$(id_address_status).css('display', 'block');
}
setField_error = function(field_id, message) {
$(field_id).removeClass('valid');
$(field_id).addClass('errorclient');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(message);
$(id_address_status).css('display', 'block');
}
setField_warn = function(field_id, message) {
$(field_id).addClass('errorclient');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(message);
$(id_address_status).css('display', 'block');
}
dqe_address.on("override", function(event) {
if (!$(zip_id).val() || !$(address1_id).val()) {
$(id_address_status).html('');
} else {
var override = dqe_address.override();
//console.log('on override: ' + override.zip + '/' + override.city + '/' + override.street + ' -- "' + config.context + '"');
if (override.zip && !$(zip_id).val()) { setField_error(zip_id, app.resources.INVALID_ADDRESS); }
else { setField_ok(zip_id, ''); }
if (override.city && !$(city_id).val()) { setField_error(city_id, app.resources.INVALID_ADDRESS); }
else { setField_ok(city_id, ''); }
if (override.street && !$(address1_id).val()) { setField_error(address1_id, app.resources.INVALID_ADDRESS); }
else { setField_ok(address1_id, ''); }
/*
var error = override.zip || override.city || override.street;
if (error) {
if (override.zip) setField_error(zip_id, app.resources.INVALID_ADDRESS);
if (override.city) setField_error(city_id, app.resources.INVALID_ADDRESS);
if (override.street) setField_error(address1_id, app.resources.INVALID_ADDRESS);
removeAddressHash();
} else {
if (!override.zip) setField_ok(zip_id, '');
if (!override.city) setField_ok(city_id, '');
if (!override.street) setField_ok(address1_id, '');
createAddressHash();
}
*/
}
});
// the input order of the address is zip, city, address1, address2, then suggestions are available.
// If the address already been entered and you click on city or street, there are no suggestions available.
// This needs to be handled. (ECOM-6011)
var key = '';
// handles a click in the city field after reloading (outside of the input order)
dqe_address.city.on("click", function(event) {
if ( ($(zip_id).val() && !$(city_id).val()) || (!options.citySearch) ) {
var new_key = 'cityclick_'+$(zip_id).val();
if (key === new_key) return;
key = new_key;
dqe_address.show_cities(event, true);
}
/*
if ( $(zip_id).val() ) {
dqe_address.show_cities(event, true);
} else if ( !$(zip_id).val() && $(city_id).val() && options.citySearch) {
//dqe_address.show_cities(event, true);
dqe_address.search_cities();
}
*/
});
// handles a click in the street field after reloading (outside of the input order)
dqe_address.street.on("click", function(event) {
if ( $(zip_id).val() && $(city_id).val() && $(address1_id).val()) {
var new_key = 'streetclick_'+$(zip_id).val()+$(city_id).val()+$(address1_id).val();
if (key === new_key) return;
key = new_key;
// get the current_city_id and call show_streets()
var url = dqe_address.url({fn: 'CP', CodePostal: $(zip_id).val(), Alpha: 'false', Instance: 0, Pays: dqe_address.selected_country()});
dqe_address.ajax(url, function(result) {
if (result) {
var i = 1;
while (result[i]) {
//var cityName = dqe_address.trim(result[i]["Localite"]);
if ($(city_id).val() === result[i]["Localite"]) {
dqe_address.current_city_id = result[i]["IDLocalite"];
dqe_address.show_streets(true);
}
i++;
}
}
});
}
});
/*
10 Address correct
20 Address correct (street not recognized, but this concerns a CEDEX or post office box)
21 Town, facade number outside limits
22 Town, facade number absent (the rest of the address is correct)
23 City, facade number outside limits
24 City, facade number absent (the rest of the address is correct)
25 If CEDEXA activated, CEDEX address unknown by CEDEXA
30 Town, street not recognized
31 Town, street not recognized (neighborhood recognized but unable to determine street)
40 Town, street absent (neighborhood recognized but unable to determine street)
41 Town, street absent
50 City, street not recognized
51 City, street not recognized (neighborhood recognized but unable to determine street)
60 City, street absent (neighborhood recognized but unable to determine street)
61 City, street absent
70 PC/City cannot be corrected (street exists)
80 PC/City cannot be corrected (street does not exist)
90 International address detected
*/
// only called if clientRNVPCheckEnabled = true
var callback_checkAddress_func_name = 'callback_checkAddress_' + config.context;
window[callback_checkAddress_func_name] = function(data) {
//console.log('callback_checkAddress called: data:' + data.data +', error:' + data.error + ', label:' + data.label);
var code = data.data;
switch(code) {
default: break;
case 10: case 20:
//console.log('address ok');
$(id_address_status).removeClass('errormessage');
$(id_address_status).html('');
$(id_address_status).css('color', '#000');
$(id_address_status).css('display', 'block');
createAddressHash();
break;
case 21: case 22: case 23: case 24: case 25:
//console.log('warning address not ok');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(app.resources.INVALID_ADDRESS);
$(id_address_status).css('color', '#070');
$(id_address_status).css('display', 'block');
createAddressHash();
break;
case 30: case 31: case 40: case 41: case 50: case 51: case 60: case 61: case 70: case 80: case 90:
//console.log('address not ok');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(app.resources.INVALID_ADDRESS);
$(id_address_status).css('color', '#c00');
$(id_address_status).css('display', 'block');
removeAddressHash();
break;
}
};
// submit
$(form_id).on("submit", function() {
//console.log('submit');
if (options.clientRNVPCheckEnabled) {
dqe_address.check(callback_checkAddress_func_name);
}
return false;
});
}
};
// filling the year select
var maxYear = ((new Date).getFullYear()) - 12;
var yearSelect = $('#dwfrm_signup_birthdayfields_year');
for (i = maxYear; i > 1896; i--){
yearSelect.append('');
}
/*
// preselect the fields
$( '#dwfrm_signup_birthdayfields_day option[value=' + daySelect.attr('data-targeted-value') + ']').attr('selected','selected');
$( '#dwfrm_signup_birthdayfields_month option[value=' + monthSelect.attr('data-targeted-value') + ']').attr('selected','selected');
*/
$('#dwfrm_signup_birthdayfields_year option[value="' + yearSelect.attr('data-targeted-value') + '"]').attr('selected','selected');
// set up the interest checkboxes from DW profile.custom.interests
var interests = ''.split(',');
if (interests != '') {
for (var i = 0; i < interests.length; i++) {
$('#dwfrm_signup_'+interests[i]).prop('checked', 'checked');
}
}
// check or uncheck all checkboxes
$("#dwfrm_signup_all").bind("change", function () {
$('.form-interests input:checkbox').prop('checked', this.checked);
});
// fill the hidden form field selectedInterests
$(".form-interests input:checkbox").bind("change", function () {
var target = $('#dwfrm_signup_selectedInterests');
if ($(this).attr('name') != $("#dwfrm_signup_all").attr('name')) $("#dwfrm_signup_all").prop('checked', '');
target.attr('value', '');
$('.form-interests input:checkbox').each(function ( index, value ) {
//if( value.checked && $(value).attr('name')!='dwfrm_signup_all') {
if( value.checked ) {
if ( target.attr('value') == "" ) target.attr('value', target.attr('value') + ',' + $(value).attr('name') + ',');
else target.attr('value', target.attr('value') + $(value).attr('name') + ',' );
}
});
target.attr('value', target.attr('value').replace(new RegExp('dwfrm_signup_', 'g'), '') );
target.attr('value', target.attr('value').substring(1, target.attr('value').length - 1) );
});
// add widget to execution pipe
Widgets.widgetExecutions['checkout'].push('gcSmartSelect');
// the actual select widget
Widgets.registered['gcSmartSelect'] = function(elem) {
// if this widget is included, we are adding the google capcha script, not before
DOMUtils.addAsyncScript("https://www.google.com/recaptcha/api.js?hl=" + app.constants.SITE_LANGUAGE , 'google-recaptcha');
var fidField = elem.find('#dwfrm_billing_giftcardredeem_fidelityCardNumber').closest('.formfield')
, gcField = elem.find('#dwfrm_billing_giftCertCode')
, verifyButton = $('.verifygiftcard')
, simpleWidth = gcField.width()
, wideWidth = simpleWidth * 2 - verifyButton.width()
, applyButton = $('.applygiftcard')
, pinButton = $('.cardpin')
, checkCard = function (cardId) {
if (cardId.length === 19) {
return 'svs'
} else {
return 'invalid';
}
}
, isMobile = function () {
return document.documentElement.clientWidth < 737;
}
, current_radio_val = function(){
return $('.gift-card input[type="radio"]:checked').val();
}
, radio_change = function(){
if (current_radio_val() == 'CEGID_GIFT_CARD') {
verifyButton.show();
if (isMobile()) {
verifyButton.css('margin-top', '10px');
verifyButton.find('button')[0].style.setProperty('margin', '0');
}
pinButton.show();
applyButton.hide();
fidField.hide();
} else {
verifyButton.hide();
pinButton.hide();
$('#CEGID_GIFT_CARD_multiple').hide();
$('.applygiftcard').show();
fidField.show();
}
}
, verify_number = function () {
var valid = true;
// we only validate, in case ther is actualy a value - this field is not rquired
if (current_radio_val() == 'CEGID_GIFT_CARD' && gcField.val()) {
if (checkCard(gcField.val()) == 'svs') {
applyButton.show();
pinButton.show();
$('.pin-information').show();
verifyButton.hide();
// we make the registration form ignore to pass the validation
$('.giftcard-registrationform input').addClass('ignore');
} else {
$('#CEGID_GIFT_CARD_multiple').hide();
applyButton.hide();
verifyButton.show();
pinButton.show();
valid = false;
}
}
return valid
}
;
$.validator.addMethod("multi-giftcard", verify_number, app.resources.GIFTCARD_CAN_NOT_BE_VALIDATED);
// ignore validation on pageload to enable cc only payments
$('.giftcard-registrationform input').addClass('ignore');
$('.pin-information').show();
verifyButton.click(function(){
gcField.valid();
});
elem.find('input[type="radio"]').change(radio_change);
// init the field in case of error
radio_change();
};