if(typeof DC_Lightspeed_JSON == 'undefined') { function DC_Lightspeed_JSON_func() { var jsonCache = null; var callbacksToCall = []; var isLoading = false; var forceReload = false; function loadJson() { // Loading the password reset page adds a 'The reset link has expired' error to the sessions. // As a workaround we just ignore this page. if(document.location.href.includes("/account/reset/?token=")) { return; } // Don't break the reCaptcha if(document.location.href.includes("/services/challenge/")) { return; } isLoading = true; var url = document.location.pathname + addParamToUrl(document.location.search, "format", "json"); var xhr = new XMLHttpRequest(); xhr.open("GET", url); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { if(!forceReload) { if(xhr.status == 200 || xhr.status == 404) { try { jsonCache = JSON.parse(xhr.responseText); for(var i=0;i').replace(/'/g,'\'').replace(/&/g, '&'); jsonCache = JSON.parse(json); }catch(ex) {} } } if(jsonCache === null) { callbacksToCall.push(callback); if(!isLoading) { loadJson(); } }else{ if(mayCallImmediately) { callback(jsonCache); }else{ setTimeout(function () { callback(jsonCache); }, 1); } } }; this.fetch = function (callback) { if(isLoading) { forceReload = true; callbacksToCall.push(callback); }else{ callbacksToCall.push(callback); loadJson(); } }; this.getOrFetch = function(doFetch, callback) { if(doFetch) { this.fetch(callback); }else{ this.get(callback); } } } DC_Lightspeed_JSON = new DC_Lightspeed_JSON_func(); } DC_Lightspeed_JSON.get(dcCustomFieldValidation); dcCustomFieldTypes = {"text":"text"}; var dcHead = $("head"); var dcBody = $("body"); var dcCustomCss = ".product-option input[type='number'] { -webkit-appearance: none; height: 45px; padding: 0px 10px; display: block; width: 100%; border: 1px solid; border-color: #e1e1e1; color: #858585; outline: none;}.product-info .cart button.btn { padding: 0px 10px; font-weight: 600; border: none; line-height: 45px; height: 45px; vertical-align: top; width: calc(100% - 170px); background-color: #ffa200; color: #fff; text-align: center; border-radius: 0; font-size: 15px;}.product-info .cart.productpageAddCart button.btn { width: calc(100% - 227px);}.product-info .cart button.btn { background-color: #000000;}.product-info .cart button.btn:hover { opacity: 0.9;}<" + "/style>"; if(dcHead.length === 1) { dcHead.append(dcCustomCss); } else if(body.length === 1) { dcBody.append(dcCustomCss); } else { document.write(dcCustomCss); } var currentSubmitButton = $("#product_configure_form a.btn"); var newSubmitButton = ""; currentSubmitButton.after(newSubmitButton).remove(); function dcCustomFieldValidation(data) { if(data.product && data.product.custom) { var dcHasCustomFields = false; $.each(data.product.custom, function(key, value) { if(dcCustomFieldTypes[value.type]) { dcHasCustomFields = true; return true; } }); if(dcHasCustomFields === true) { $.ajax("https://customfieldvalidation.cmdcbv.app/public/223631/data", { data: { product: data.product.id }, success: function(values) { $.each(values, function(key, value) { var dcCustomField = $("input[name='custom[" + value.id + "]']"); if(dcCustomField.length === 1) { dcCustomField.attr("type", value.type); if (value.type == "number") { if(value.value1) { dcCustomField.attr("min", value.value1); } if(value.value2) { dcCustomField.attr("max", value.value2); } if(value.value3) { dcCustomField.attr("step", value.value3); } } } }); } }) } } }