//resources
app.resources.MISSINGCHK = "Please check this checkbox";
app.resources.MISSINGVAL = "Please Enter {0}";
app.resources.MISSINGCITY = "Please enter your city";
app.resources.SERVER_ERROR = "Server connection failed!";
app.resources.MISSING_LIB = "jQuery is undefined.";
app.resources.BAD_RESPONSE = "Bad response, Parser error";
app.resources.INVALID_ADDRESS = "The address is not correct";
app.resources.INVALID_PHONE = "Please specify a valid phone number.";
app.resources.INVALID_EMAIL = "Please enter a valid email address.",
app.resources.INVALID_CPF = "forms.address.CPF.field.invalid";
app.resources.INVALID_CITY = "City not recognised",
app.resources.DOB_INCOMPLETE = "The date of birth is incomplete.";
app.resources.EQUALTO = "Please enter the same value again.",
app.resources.EQUALTOEMAIL = "Please confirm email address",
app.resources.INVALID_EMAILLIST = "The following email addresses are not correct:";
app.resources.REMOVE = "Remove";
app.resources.CLOSE = "Close";
app.resources.NEXT = "global.next";
app.resources.PREV = "Previous";
app.resources.QTY = "Qty";
app.resources.PLEASE_SELECT = "( please select )";
app.resources.CLICK_TO_EDIT = "click to edit";
app.resources.SUBMIT = "Submit";
app.resources.WRONG_DATE_FORMAT = "Please enter a date in the format mm/dd/yy";
app.resources.PRINT_NOW = "print now";
// 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";
// Other State select option
app.resources.otherStateOptionName = "Other";
app.resources.otherStateOptionValue = "OTHER";
// Date Picker localisation
app.resources.dates = {};
app.resources.dates['TODAY'] = "Today";
app.resources.dates['WEEKHEADER'] = "CW";
app.resources.dates['DATE_FORMAT'] = "mm/dd/yy";
app.resources.dates['MONTH'] = [
"January"
, "February"
, "March"
, "April"
, "May"
, "June"
, "July"
, "August"
, "September"
, "October"
, "November"
, "December"
];
app.resources.dates['MONTH_SHORT'] = [
"Jan"
, "Feb"
, "Mar"
, "Apr"
, "May"
, "Jun"
, "Jul"
, "Aug"
, "Sep"
, "Oct"
, "Nov"
, "Dec"
];
app.resources.dates['DAY_NAMES'] = [
"Sunday"
, "Monday"
, "Tuesday"
, "Wednesday"
, "Thursday"
, "Friday"
, "Saturday"
];
app.resources.dates['DAY_NAMES_SHORT'] = [
"Sun"
, "Mon"
, "Tue"
, "Wed"
, "Thu"
, "Fri"
, "Sat"
];
app.resources.dates['DAY_NAMES_MIN'] = [
"S"
, "M"
, "T"
, "W"
, "Th"
, "F"
, "S"
];
// product availability messages
app.resources["IN_STOCK"] = "In Stock";
app.resources["QTY_IN_STOCK"] = "{0} Item(s) In Stock";
app.resources["PREORDER"] = "Pre-Order";
app.resources["QTY_PREORDER"] = "{0} item(s) are available for pre-order.";
app.resources["REMAIN_PREORDER"] = "The remaining items are available for pre-order.";
app.resources["BACKORDER"] = "Back Order";
app.resources["QTY_BACKORDER"] = "Back Order {0} item(s)";
app.resources["REMAIN_BACKORDER"] = "The remaining items are available on back order.";
app.resources["NOT_AVAILABLE"] = "Not available.";
app.resources["REMAIN_NOT_AVAILABLE"] = "The remaining items are currently not available. Please adjust the quantity.";
app.resources["IN_STOCK_DATE"] = "The expected in-stock date is {0}.";
app.resources["NON_SELECTED"] = "Not Selected";
app.resources["MISSING_VAL"] = "Select {0}";
app.resources["SIZECHART_TITLE"] = "Size Chart";
app.resources["SEND_TO_FRIEND"] = "Send to a Friend";
app.resources["MISSING_VAL"] = "Select {0}";
//shipping resources
app.resources["SHIP_STATE_LABEL"] ="State";
app.resources["SHIP_PROVINCE_LABEL"] ="Province";
app.resources["SHIP_QualifiesFor"] = "This shipment qualifies for"
app.resources["STOREPICKUP"] = "Select pickup location"
app.resources["STOREPICKUP_POSTCODE"] = "Postcode value is required."
app.resources["STOREPICKUP_EMPTY_RESULT"] = "No results found"
//shipping resources
app.resources["BILL_GC"] = "GIFT_CERTIFICATE";
// bonus products messages
app.resources["BONUS_PRODUCTS"] = "Bonus Product(s)";
app.resources["SELECT_BONUS_PRODUCT"] = "Select or Update";
app.resources["BONUS_PRODUCT_MAX"] = "The maximum number of bonus products have been selected. Please remove one in order to add additional bonus products.";
app.resources["SIMPLE_SEARCH"] = "Enter Keyword or Item #";
// Gift Cert resources
app.resources["REG_ADDR_ERROR"] = "Couldn't Load Address";
app.resources["GIFTCARD_CAN_NOT_BE_VALIDATED"] = "We're sorry, but the gift card number you entered is not correct.";
app.resources.loyalty = {};
app.resources.loyalty.notifyTCChange = "false";
app.resources.loyalty.getCustomerAcceptationUrl = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Account-LoyaltyGetTcAcceptationValue";
app.resources.loyalty.setCustomerAcceptationUrl = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Account-LoyaltySetTcAcceptationValue";
app.resources.loyalty.getTcAcceptationPop = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Account-LoyaltyGetTcAcceptationPopup";
app.resources.loyalty.saveCustomerEmailUrl = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Account-LoyaltySaveCustomerEmail";
//Store pickup page
app.resources.storepickup = {};
app.resources.storepickup.storesicon = "http://www.quiksilver.ie/on/demandware.static/Sites-QS-IE-Site/-/default/dw009547d0/images/icons/pushpin.png";
app.resources.storepickup.selectlabel = "Select";
app.resources.storepickup.storeicons_url = "/on/demandware.static/-/Sites-QS-IE-Library/en_IE/v1509424255261/REPLACEME";
app.resources.storepickup.storeicons_config = null; // as JSON String
app.resources.storepickup.sessionlocale = "en";
app.resources.storepickup.currency_symbol = "€";
app.resources.storepickup.deliveryTimeText1 = "checkout.pickstore.deliveryTimeText1";
app.resources.storepickup.deliveryTimeText2 = "checkout.pickstore.deliveryTimeText2";
app.resources.storepickup.noresultstitle = "No Results Found";
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 = "Send address via";
app.resources.storelocator.emaillink = "Email";
app.resources.storelocator.viewstorehours = "View store opening times";
app.resources.storelocator.phonelabel = "Tel:";
app.resources.storelocator.dayrange = "From Monday to Sunday";
app.resources.storelocator.monday = "Monday";
app.resources.storelocator.tuesday = "Tuesday";
app.resources.storelocator.wednesday = "Wednesday";
app.resources.storelocator.thursday = "Thursday";
app.resources.storelocator.friday = "Friday";
app.resources.storelocator.saturday = "Saturday";
app.resources.storelocator.sunday = "Sunday";
app.resources.storelocator.hoursrange = "from %OPEN% to %CLOSE%";
app.resources.storelocator.storesicon = "/on/demandware.static/Sites-QS-IE-Site/-/default/dwf11e52b9/images/icons/stores-icon.png";
app.resources.storelocator.outletsicon = "/on/demandware.static/Sites-QS-IE-Site/-/default/dw8d19d2f1/images/icons/outlets-icon.png";
app.resources.storelocator.boardridersclubicon = "/on/demandware.static/Sites-QS-IE-Site/-/en_IE/v1509424255261/images/icons/boardridersclub-icon.png";
app.resources.storelocator.dealersicon = "/on/demandware.static/Sites-QS-IE-Site/-/default/dw474cc18e/images/icons/authorized-dealers-icon.png";
app.resources.storelocator.providerURL = "http://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 = "No Results Found";
app.resources.storelocator.noresultsfound = "No locations were found using your search criteria";
app.resources.storelocator.noresultshelp = "Please ensure that you entered a city and state/province";
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-IE-Site/en_IE/GiftCert-CheckBalance";
app.resources["GIFT_CERT_CUR_BALANCE"] = "Your current gift certificate balance is";
app.resources["GIFT_CERT_MISSINGCODE"] = "Please enter Gift Certificate Code";
app.resources["GIFT_CERT_INVALIDCODE"] = "Please check Gift Certificate Code";
app.resources["GIFT_CERT_ERROR"] = "Please enter the correct information";
app.resources["GIFT_BALANCE_ERROR_CODE"] = "Please enter a gift certificate code";
app.resources["GIFT_BALANCE_ERROR_PIN"] = "Please enter a pin code";
app.resources["GIFT_BALANCE_ERROR_DIGIT"] = "Pin code must be 4 digits";
app.resources["WISHLIST_LIST"] = "";
app.resources["WISHLIST_PROGRESS_IMAGE"] = "/on/demandware.static/Sites-QS-IE-Site/-/default/dw1bebffbb/images/loading-progress-98x22.gif";
// PDP
app.resources["SAVED_FOR_LATER"] = "Saved in your wishlist";
app.resources["SAVE_FOR_LATER"] = "Save";
app.resources["PHONE_REGEXP"] = /^[+]*([-0-9][ ]*){7,20}$/;
app.resources["PHONE_MASK"] = "";
app.resources["PHONE_MULTIPLEMASKS"]= [0];
app.resources["PHONE_PLACEHOLDER"] = "0";
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"] = "Select or indicate amount.";
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-IE-Site/en_IE/Cart-MiniAddProduct";
app.URLs.addProductToCart = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Cart-AddProduct";
app.URLs.wishlistAddress = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Wishlist-SetShippingAddress?AddressID=";
app.URLs.SetShippingContext = "http://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Hooking-SetShippingContext";
app.URLs.SetLocalization = "http://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Geolocation-SetLocalization";
// S.E.O links scripting
app.URLs.userLogin = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Account-Show?nextPage=Home-Show";
app.URLs.userRegister = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Account-StartRegister";
app.URLs.sizeChartShow = "/on/demandware.store/Sites-QS-IE-Site/en_IE/SizeChart-Show";
app.URLs.accountShow = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Account-Show";
app.URLs.contactUs = "/on/demandware.store/Sites-QS-IE-Site/en_IE/CustomerService-ContactUs";
app.URLs.logOut = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Login-Logout";
app.URLs.getShippingMethodsList = "/on/demandware.store/Sites-QS-IE-Site/en_IE/COShipping-UpdateShippingMethodList";
app.URLs.updateOrderTotals = "/on/demandware.store/Sites-QS-IE-Site/en_IE/COBilling-UpdateOrderTotals";
app.URLs.storeBillingAddress = "/on/demandware.store/Sites-QS-IE-Site/en_IE/COShipping-StoreUnsavedBillingAddress";
app.URLs.getProductUrl = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Product-Show";
app.URLs.searchUrl = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Search-Show";
app.URLs.getVariants = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Product-GetVariants";
app.URLs.getAvailability = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Product-GetAvailability";
app.URLs.loadingSmallImg = "/on/demandware.static/Sites-QS-IE-Site/-/default/dwa70bd09f/images/loading-small.gif";
app.URLs.formatMoney = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Product-FormatPrices";
app.URLs.removeImg = "/on/demandware.static/Sites-QS-IE-Site/-/default/dwffb20893/images/icon_remove.gif";
app.URLs.searchsuggest = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Search-GetSuggestions";
app.URLs.submitDialogURL = 'http://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Page-AppResources/C1611201897';
app.URLs.productNav = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Product-Productnav";
app.URLs.SeverConnectionError = "Server connection failed!";
app.URLs.quickview_product_url = "http://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Proxy-Product2JSON";
app.URLs.PIConfirmDelete = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/PaymentInstruments-ConfirmDelete";
app.URLs.addressConfirmDelete = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/Address-ConfirmDelete";
app.URLs.pageInclude = "/on/demandware.store/Sites-QS-IE-Site/en_IE/Page-Include";
app.URLs.findInStoreTemplate = "/on/demandware.store/Sites-QS-IE-Site/en_IE/FindInStore-Show";
app.URLs.findInStoreSearch = "/on/demandware.store/Sites-QS-IE-Site/en_IE/FindInStore-ProductSearch";
app.URLs.findInStoreLineItems = "/on/demandware.store/Sites-QS-IE-Site/en_IE/FindInStore-DisplayStores";
app.URLs.cartShow = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/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"] = "No results found";
// DQE - Preferences
app.DqeProxyUrl = "https://www.quiksilver.ie/on/demandware.store/Sites-QS-IE-Site/en_IE/DQE-Proxy";
app.DqeEmailCheckEnabled = true;
app.DqePhoneCheckEnabled = true;
app.DqeAddressCheckEnabled = true;
app.DqeClientRNVPCheckEnabled = false;
app.DqeEmailAutocheck = false;
app.DqeEmailSuggest = false;
app.DqePhoneAutocheck = true;
app.DqePhoneNumberFormat = 4.0;
app.DqeCitySearch = 0.0;
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': /^L?-?\d{4}$/i,
'NLD': /^[1-9][0-9]{3}\s?[A-Z]{2}$/, //updated
'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
};
//Geolocation references
app.resources["GEO_COUNTRY_CODE"] = "US";
app.resources["SHIP_TO_COUNTRY_CODE"]= "IE";
app.globalRedirectURL = "null";
// translations for ARIA attributes
app.resources.aria = {};
app.resources.aria.closesearch = "Close Search";
// translation of jQuery validate
(function ($) {
$.extend($.validator.messages, {
required : "This field is required.",
remote : "Please fix this field.",
email : "Please enter a valid email address.",
url : "Please enter a valid URL.",
cpf : "forms.address.CPF.field.invalid",
date : "Please enter a valid date.",
dateISO : "Please enter a valid date (ISO).",
number : "Please enter a valid number.",
digits : "Please enter only digits.",
creditcard : "Please enter a valid credit card number.",
equalTo : "Please enter the same value again.",
equalToIgnoreCase : "Please enter the same value again.",
maxlength : $.validator.format("Please enter no more than {0} characters."),
minlength : $.validator.format("Please enter at least {0} characters."),
rangelength : $.validator.format("Please enter a value between {0} and {1} characters long."),
range : $.validator.format("Please enter a value between {0} and {1}."),
max : $.validator.format("Please enter a value less than or equal to {0}."),
min : $.validator.format("Please enter a value greater than or equal to {0}."),
emailConfirmIgnoreCase : "Please confirm email address.",
validateCountryState : "Please select a state associated with the selected country.",
zip : {
DE : "Bitte gib deine Postleitzahl mit 5 Ziffern an",
US : "Please provide your zip code in the format: XXXXX or XXXXX-XXXX (digits only).",
FR : "Please provide your postal code with 5 digits.",
CA : "Please provide your postal code in a format like J8R 2A5.",
GB : "Please provide your postal code in a format like YO31 1EB.",
NL : "Please provide your postal code in a format like 1114 AA.",
PT : "Please provide your postal code in a format like 1114-185.",
BR : "global.zip.validation.hint.format",
ES : "Your entered postal code does not match with a city in our database.",
IT : "Your entered postal code does not match with a city in our database.",
AT : "Your entered postal code does not match with a city in our database.",
BE : "Your entered postal code does not match with a city in our database.",
CH : "Your entered postal code does not match with a city in our database.",
DK : "Your entered postal code does not match with a city in our database.",
FI : "Your entered postal code does not match with a city in our database.",
LU : "Your entered postal code does not match with a city in our database."
}
});
$.validator.customOptions = {
showRequiredMessages : true
};
}(jQuery));
// zip validation
app.resources["ZIP_NOT_SHIPPABLE"] = "Not Shippable";
app.resources["ZIP_NOT_SHIPPABLE_EXPLENATION"] = "We're sorry, but we are not shipping to this address. Please choose a different shipping location for your order.";
app.resources["ZIP_NOHIT"] = "There are no cities with this postal code in our database.";
app.resources["ZIP_VALIDATION_HINT"] = {
"default" : "Your entered postal code does not match with a city in our database.",
"GB": "Please provide your postal code in a format like YO31 1EB.",
"NL": "Please provide your postal code in a format like 1114 AA.",
"PT": "Please provide your postal code in a format like 1114-185."
};
// zip validation url
app.URLs.findCityByZip = "/on/demandware.store/Sites-QS-IE-Site/en_IE/ZipCode-FindCityByZip";
for (var namespace in Widgets.widgetExecutions) {
Widgets.widgetExecutions[namespace][Widgets.widgetExecutions[namespace].length] = 'findCityByZip';
}
//the city - zip select and validation widget
Widgets.registered['findCityByZip'] = function(elem) {
var config = myEval(elem.data('config'))
, cf = new CityFinder(config);
;
if (config.context == 'shipping') {
ActiveCityFinders.shippingAddress = cf;
} else {
ActiveCityFinders.billingAddress = cf;
}
if (ActiveCityFinders.contextScopes['shipping_methods'] !== undefined) {
// the event came before the widget initilization
// so we runn it again, because now we have the billing and shipping address objects
ActiveCityFinders.addressContextChange();
}
};
// registering the event listeners
$(document).on('address-billing-shipping-change', function( event, data ) {
ActiveCityFinders.addressContextChange(data.match, data.scope);
})
// allows to make the CityFinders exessable from the outside
var ActiveCityFinders = {
billingAddress : null
, shippingAddress : null
, contextScopes : {} // stores the different scopes, which can trigger a different shipping address - mainly a store_pickup shipping method or the address input
, addressContextChange : function(differentShippingAddress, scope){
var s
, isDifferent = false;
;
if(scope) this.contextScopes[scope] = differentShippingAddress;
// if one of the context switches indicates a different shipping adress
// (shipping method select or different address selection) we know that
// we can switch the billing address context to billing, otheriwse it is
// shipping.
for (s in this.contextScopes){
isDifferent = isDifferent || this.contextScopes[s];
}
if (this.billingAddress) {
this.billingAddress.changeContext(isDifferent ? 'billing' : 'shipping');
}
}
}
// The Cache Component, wich stores the zip codes CityFinder instance independent (They use the same data)
var CityFinderCache = {
cityCache: {} // data cache
, activeRequests: {} // stores requests status from possible multiple components
, addToCache: function(storesResult) {
if (storesResult) {
for (var countryCode in storesResult) {
if (! this.cityCache[countryCode]) {
this.cityCache[countryCode] = storesResult[countryCode];
} else {
for (var base in storesResult[countryCode]){
this.cityCache[countryCode][base] = storesResult[countryCode][base]
}
}
}
}
}
/**
* @param countryCode String The ISO Country code
* @param zipCode String The currently entered zip code
* @param baseLength Integer The minimal length for the country zip code - used as key
*/
, getFromCache: function(countryCode, zipCode, baseLength) {
var base = zipCode.substr(0, baseLength);
if (! this.cityCache[countryCode] || ! this.cityCache[countryCode][base]) {
return false;
}
var result = {};
result[base] = this.cityCache[countryCode][base];
return result;
}
}
// The UI and Network Component
var CityFinder = function(configAdjust){
// City Finder INIT
var config = {
'baseLength' : 2,
'minUpdateLength' : 3,
'updateDelay' : 300
};
$.extend( config, configAdjust );
this.debug = function(){
debug('context: ' + context);
debug('config: %o', config);
}
this.changeContext = function(newContext){
if (context != newContext){
context = newContext;
that.triggerUpdate(null, true); // we run the update in order to have the latest shipping / blocked for shipping information
}
}
// public method
this.triggerUpdate = function(e, contextChanged){
var zip = retriveZipCode(keyField, countryfield.val()), // also supply the country field, to get the right format for GB
countryCodes = [],
countryOptions, cOption, i;
if (zip.length > (config.baseLength - 1) && (!e || e.keyCode > 44 ||e.keyCode == 8 || e.keyCode === undefined || e.keyCode == 32)) { // at least config.baseLength chars
// get the Country possibilitys
if (countryfield.val()) {
countryCodes[0] = countryfield.val();
} else {
countryOptions = countryfield.find('option');
for (i = 0; i < countryOptions.length; i++) {
cOption = $(countryOptions.get(i));
if (cOption.attr('value')) {
countryCodes[countryCodes.length] = cOption.attr('value');
}
}
}
// we are missing data, do the request to retrieve this
var data = {countryCode: countryCodes.join(','), postalCode: zip };
if (contextChanged || keyField.data('countryCode') != data.countryCode || keyField.data('postalCode') != data.postalCode ) {
// set the data for the next change
keyField.data(data);
// lock, if we have this already in the cache
updateSelect(citySelect, countryCodes, keyField )
}
}
}
var HASH = "#" // this is a weired thing with isml.. if you write # directly, it ends in an unrecognised error.
, that = this
, countryfield = $(HASH + config.countryField).change(function(e){
that.triggerUpdate(e);
})
, keyField = $(HASH + config.keyField).bind('keyup', that.triggerUpdate).bind('change', that.triggerUpdate)
, citySelectChangeFunc = function(){
var opt = $(this).find('option:selected'),
currentZip,
newBaseZip,
currentRange
;
countryfield.val(opt.data('country'));
clearErrors(keyField, opt.data('country'));
// special Great britain, PT andf NL behaviour
if (spaceValCountrys[opt.data('country')]) {
currentZip = retriveZipCode(keyField, opt.data('country')); // remove the space char for validation reasons
newBaseZip = opt.data('zip');
currentRange = currentZip.substr(newBaseZip.length);
keyField.val(newBaseZip + spaceValCountrys[opt.data('country')].spaceChar + currentRange);
keyField.valid();
} else if (opt.data('zip')) {
keyField.val(opt.data('zip'));
}
}
// defining the change callback of the city select elem
, citySelect = $(HASH + config.valueField).change(citySelectChangeFunc)
, cityInput = $( '') // '' gives an template error - DW renders a '');
}
}
/**
* Main Update function
*
* @param citySelectElem : jQueryList The element of the corresponding cityDropDown
* @param zipElem : jQueryList The element, where the zipCode is type currently
* @param countryCodes : Array of the requested countrys
*/
var updateSelect = function(citySelectElem, countryCodes, zipElem){
// mark as loading
markAsLoading(citySelectElem);
var zipCode = retriveZipCode(zipElem);
var doRequest = false;
var requestCountryCodes = [];
var storesResult = {};
// clear the errors
clearErrors(zipElem, countryCodes[0]);
// find out, if we already have the corresponding data in the cache
for (var i = 0; i < countryCodes.length; i++) {
var result = CityFinderCache.getFromCache(countryCodes[i], zipCode, config.baseLength);
if (! result) {
var doRequest = true;
requestCountryCodes[requestCountryCodes.length] = countryCodes[i];
} else {
storesResult[countryCodes[i]] = result;
}
}
// for performance reasons, get the time of the typing, to avoid key response problems
var delay = (zipCode.length >= 5) ? 0 : config.updateDelay;
updateTimeBorder = new Date().getTime() + delay;
if (doRequest) {
// we are missing data, do the request to retrieve this
var data = {countryCode: requestCountryCodes.join(','), postalCode: zipCode.substr(0, config.baseLength) };
var reqID = data.countryCode + data.postalCode;
if (! CityFinderCache.activeRequests[reqID]) {
CityFinderCache.activeRequests[reqID] = 'IN PROGRESS'; //
// make the call
var start = new Date().getTime();
var req = $.ajax({
url: app.URLs.findCityByZip,
data : data,
dataType: 'json',
success: function(res) {
var zipCode = retriveZipCode(zipElem);
var duration = new Date().getTime() - start;
// add to cache
CityFinderCache.addToCache(res);
if (res !== false) {
// updates the city select either a bit later (if the user was still typing) or imidiatley
// timeout 0
setTimeout(citySelectElem, res, zipElem, ((zipCode.length >= 5 || duration >= delay) ? 0 : delay - duration));
} else {
// we had a res, but it was invalid
noHitHandling();
}
CityFinderCache.activeRequests[reqID] = 'FINISHED';
}
});
} else if (CityFinderCache.activeRequests[reqID] == 'FINISHED'){
// the request was done, but the result was obviously false, because we had no data in the cache
noHitHandling();
}
} else {
setTimeout(citySelectElem, storesResult, zipElem, delay);
}
}
// this function deals with the change from select to input
var noHitHandling = function(){
if (cityInputIsSelect == true) {
var currentVal = citySelect.attr('data-targeted-value');
citySelect.empty().parent().find('.layer').hide();
citySelect.replaceWith(cityInput);
cityInput.val(currentVal);
cityInputIsSelect = false; // switching the mode
// error(zipElem, 'nohit-zip'); // old legacy handling
}
}
// function to register the timeout for a element updtae event
var setTimeout = function(citySelectElem, storesResult, zipElem, delay){
var tDelay = (delay) ? delay : config.updateDelay;
var id = zipElem.attr('id');
if (! lastTimeouts[id]) lastTimeouts[id] = [];
lastTimeouts[id][lastTimeouts[id].length] = window.setTimeout(function(){delayedUpdateCitySelect(citySelectElem, storesResult, zipElem);}, tDelay);
}
/**
* Security loop in order to make sure the timeout does not occur to early
*/
var delayedUpdateCitySelect = function(citySelectElem, storesResult, zipElem){
var time = new Date().getTime();
var id = zipElem.attr('id');
lastTimeouts[id].shift() // remove the first element of the array, to have an idea, how many are still to come
if (time >= updateTimeBorder) {
updateCitySelect(citySelectElem, storesResult, zipElem);
} else {
if (! lastTimeouts[id].length) {
// something went wrong, try again in 50 ms
setTimeout(citySelectElem, storesResult, zipElem, 50);
}
}
}
// returns the cleared zip code without any space chars like ' ' or '-'
var retriveZipCode = function(zipElem, countryCode) {
if(! countryCode) countryCode = countryfield.val(); // we default the country code to the currently selected country
var spaceVal = (spaceValCountrys[countryCode]) ? spaceValCountrys[countryCode].spaceChar : ' ';
return zipElem.val().replace(new RegExp('[' + spaceVal + ']', 'g'), '').toLocaleUpperCase();
}
/**
* @param storesResult : Map this already the valid subtree, it can contain several languages and has the format { DE : { 148 : {2 : {8: {citys: [Benken, Görzke, Dangelsdorf], shippable: true}}}, 'FR': ...}
*/
var updateCitySelect = function(citySelectElem, storesResult, zipElem) {
// get currentZipCode
var zipCode = enteredZipCode = retriveZipCode(zipElem)
, currentCity = citySelectElem.val()
, zipSplit, message, character, subTree, subZip, countryCode;
citySelectElem.empty();
if (zipCode.length >= config.minUpdateLength) {
if (storesResult) {
citySelectElem.removeClass('errorclient');
var base = zipCode.substr(0, config.baseLength);
var zipFound = false;
// loop over the complete result
for (countryCode in storesResult) {
zipCode = retriveZipCode(zipElem, countryCode);
subTree = storesResult[countryCode][base];
subZip = base;
for (var i = config.baseLength; i < zipCode.length; i++) {
character = zipCode.substr(i, 1);
if (subTree[character]) {
subTree = subTree[character];
subZip += character;
// Special GB, NL, PT postcode behaviour
} else if (spaceValCountrys[countryCode] && i >= spaceValCountrys[countryCode].minMatchLength) {
zipCode = subZip;
break;
} else {
// this zip does not exist
subTree = false;
// displayError(zipElem, countryCode);
break;
}
}
if (subTree){
zipFound = true;
if (cityInputIsSelect == false) {
cityInput.replaceWith(citySelectElem);
citySelectElem.change(citySelectChangeFunc); // we are adding the change handler again, because it was lost due to the detach
cityInputIsSelect = true;
}
// now add the options recursivley
var optionCount = addOptionsToCitySelect(citySelectElem, countryCode, zipCode, subTree, true, enteredZipCode);
if (optionCount > 0) {
if (optionCount > 1) citySelectElem.prepend($(''));
citySelectElem.val(currentCity);
} else {
// We have no available option, so we switch back to the free input
noHitHandling();
// citySelectElem.change();
}
}
}
// no valid zip in the whole result
if (! zipFound) {
// displayError(zipElem, countryCode);
// citySelectElem.addClass('errorclient');
noHitHandling();
}
} else {
error(zipElem, 'nohit-zip');
}
}
citySelectElem.parent().find('.layer').hide();
}
var validateZipCode = function(zipElem, countryCode) {
var zip = retriveZipCode(zipElem, countryCode)
, countrySetup = spaceValCountrys[countryCode]
, valid = true
, cursorPos = oldCursorPos = zipElem.getCursorPosition()
, charPos, rawZip
;
if (countrySetup) {
charPos = (countrySetup.spaceCharPosition > -1) ? countrySetup.spaceCharPosition : zip.length + countrySetup.spaceCharPosition;
rawZip = zipElem.val();
valid = false;
if (charPos < countrySetup.minMatchLength || countrySetup.minMatchLength > zip.length) {
if (rawZip.indexOf(countrySetup.spaceChar) > countrySetup.minMatchLength) zip = rawZip;
} else if (rawZip.length > countrySetup.minMatchLength){
zip = zip.substr(0, charPos) + countrySetup.spaceChar + zip.substr(charPos);
valid = zip.length <= countrySetup.maxlength && zip.match(countrySetup.regex);
if (cursorPos >= rawZip.length) {
cursorPos++;
} else if (rawZip != zip && cursorPos > charPos) {
cursorPos--;
}
}
}
// we need this check, because crome, safari and opera are putting the focus here always otherwise
// this will lead to a traped cursor in the focued field
if ( zip.toUpperCase() != rawZip.toUpperCase() ) {
zipElem.val(zip)
zipElem.setCursorPosition(cursorPos);
}
return valid;
}
/* Displays a zip validation error */
var displayError = function(zipElem, countryCode) {
var errorclass = (app.resources["ZIP_VALIDATION_HINT"][countryCode]) ? 'postalcode' : 'nomatch-zip';
error(zipElem, errorclass);
}
var clearErrors = function(zipElem, countryCode) {
zipElem.removeClass('errorclient');
zipElem.removeClass(errorClasses.join(' '));
if (countryCode && app.resources["ZIP_VALIDATION_HINT"][countryCode]) {
zipElem.addClass('postalcode');
}
zipElem.parent().find('.errorclient, .errormessage').hide();
}
var error = function(zipElem, errorclass){
// reset of the form
clearErrors(zipElem)
if (errorclass) {
zipElem.addClass(errorclass);
}
// validate the element
zipElem.valid();
}
/**
* The recursive function, which searches the subtree and and is adding options to the citySelectElem
*/
var addOptionsToCitySelect = function(citySelectElem, countryCode, baseZip, subTree, first, enteredZipCode) {
var len = 0 // number of added citys
, shippable = true
, label
, option
, leaf, range
, ceRange // currently entered range
, displayZip // something like 1104 [AA-ZZ] or 14828
;
for (var character in subTree) {
// leaf?
if (character == 'ranges') {
leaf = subTree['ranges'];
ceRange = enteredZipCode.substr(baseZip.length);
//loop over the ranges
for (var r = 0; r < leaf.length; r++) {
range = leaf[r];
// we test now against the range, because we are working with string, we can only compare
// strings with the same length '6' >= '6JJ' is false!
// check against: ceRange >= rS && ceRange <= rE
if (! range['rS'] || ( ceRange >= range['rS'].substr(0, ceRange.length) && ceRange <= range['rE'].substr(0, ceRange.length) ) ) {
len += range['cities'].length;
for (var i = 0; i < range['cities'].length; i++){
var entry = range['cities'][i];
shippable = context == CONTEXT.SHIPPING ? range['shippable'] : true;
var oData = {
'zip': baseZip,
'country' : countryCode,
'city' : entry
}
displayZip = range['rS'] ? baseZip + spaceValCountrys[countryCode].spaceChar + range['rS'] + ' - ' + baseZip + spaceValCountrys[countryCode].spaceChar + range['rE'] : baseZip;
label = (countryCode == 'IE') ? displayZip + ' (' + entry + ')' : entry + ' (' + displayZip + ')';
option = '';
// add the options
citySelectElem.append($(option).data(oData));
}
}
}
// for everything except shippable we traverse the tree further
} else {
// branch, check also, if the second part is already blocking the possible options
if (baseZip.length >= enteredZipCode.length || character == enteredZipCode.substr(baseZip.length, 1) ) {
len += addOptionsToCitySelect(citySelectElem, countryCode, baseZip + character, subTree[character], false, enteredZipCode)
}
}
}
return len;
}
}
// 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) );
});
// EULERIAN TAG MASTER
// OLD EATM_addtocart_collector function, renamed for more global name
function tag_container_addtocart_collector(response) {
var EA_minicart_added_product = $(response).filter('#EA_minicart_added_product');
if (EA_minicart_added_product) {
var prd_name = EA_minicart_added_product.data('name');
var prd_pid = EA_minicart_added_product.data('pid');
var prd_price = EA_minicart_added_product.data('price');
var prd_scart = EA_minicart_added_product.data('scart');
var prd_scartcumul = EA_minicart_added_product.data('scartcumul');
var prd_amount = EA_minicart_added_product.data('amount');
var prd_quantity = EA_minicart_added_product.data('quantity');
var prd_IDcolor = EA_minicart_added_product.data('IDcolor');
EA_response = EA_collector([ 'path', '/mini-panier' ]
,"scart", prd_scart
,"scartcumul", prd_scartcumul
,"amount", prd_amount
,"prdref",prd_pid
,"prdname",prd_name
,"prdamount",prd_price
,"prdquantity",prd_quantity
,"IDcolor",prd_IDcolor
);
}
}
// 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 === 8) {
return 'cegid';
} else 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.css('display', 'inline-block');
verifyButton.css('float', 'right');
if (isMobile()) {
verifyButton.css('margin-top', '10px');
verifyButton.find('button')[0].style.setProperty('margin', '0');
} else {
verifyButton.find('button')[0].style.setProperty('height', '25px', 'important');
}
applyButton.hide();
fidField.hide();
gcField.width(wideWidth);
} else {
verifyButton.hide();
pinButton.hide();
$('#CEGID_GIFT_CARD_multiple').hide();
$('.applygiftcard').show();
fidField.show();
gcField.width(simpleWidth);
}
}
, 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()) == 'cegid') {
$('#CEGID_GIFT_CARD_multiple').show();
applyButton.show();
pinButton.hide();
$('.pin-information').hide();
gcField.width(wideWidth - 14);
verifyButton.hide();
// enable validation again
$('.giftcard-registrationform input').removeClass('ignore');
} else if (checkCard(gcField.val()) == 'svs') {
$('#CEGID_GIFT_CARD_multiple').hide();
gcField.width(simpleWidth);
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();
$('.pin-information').hide();
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');
// fix some button styles because of the reuse of the form elements
applyButton.css('margin-top', '10px');
if (isMobile()) {
applyButton.find('button')[0].style.setProperty('margin', '0');
}
verifyButton.click(function(){
gcField.valid();
});
elem.find('input[type="radio"]').change(radio_change);
// init the field in case of error
radio_change();
};