Файловый менеджер - Редактировать - /home/harasnat/www/labour/wp-content/themes/woostify/assets/js/woocommerce/multi-step-checkout.min.js
Назад
"use strict";var woostifyValidateEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())},woostifyExpandOrderReview=function(){var e=document.querySelector(".has-multi-step-checkout"),t=document.querySelector("form.woocommerce-checkout"),i=!!t&&t.querySelector(".woostify-before-order-review"),o=1;e&&i&&(i.onclick=function(){1===o?(t.classList.add("expanded-order-review"),o=2):(t.classList.remove("expanded-order-review"),o=1)})},woostifyMultiStepCheckout=function(){var e=document.querySelector(".has-multi-step-checkout"),t=document.querySelector(".multi-step-checkout");if(e&&t){var i=t.querySelectorAll(".multi-step-item"),o=document.querySelector("form.woocommerce-checkout");if(i.length&&o){document.querySelector(".woocommerce-form-coupon-toggle"),o.querySelector("#shipping_method"),o.querySelector(".cart-subtotal");var r=o.querySelector(".multi-step-checkout-wrapper"),c=(o.querySelector('.multi-step-checkout-content[data-step="first"]'),o.querySelector('.multi-step-checkout-content[data-step="second"]')),n=(o.querySelector('.multi-step-checkout-content[data-step="last"]'),o.querySelector(".multi-step-checkout-button-wrapper")),l=(o.querySelectorAll(".woocommerce-billing-fields__field-wrapper .validate-required"),n?n.querySelectorAll(".multi-step-checkout-button"):[]),d=!!n&&n.querySelector('.multi-step-checkout-button[data-action="continue"]'),a=d?d.getAttribute("data-continue"):"";l.length&&l.forEach((function(e){e.onclick=function(){var i=e.getAttribute("data-action"),o=t.querySelector(".multi-step-item.active"),r=!!o&&o.previousElementSibling,c=!!o&&o.nextElementSibling;"back"==i&&r&&r.click(),"continue"==i&&c&&c.click(),jQuery("html, body").animate({scrollTop:jQuery(t).offset().top},300)}}));var s=function(e){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.length){var i=function(e,t){var i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>0&&void 0!==arguments[1]&&arguments[1],r=i?i.value.trim():"";o&&(r?"email"==i.type?woostifyValidateEmail(r)?o.classList.remove("field-required"):o.classList.add("field-required"):o.classList.remove("field-required"):o.classList.add("field-required"))};t.forEach((function(e){var t=e.querySelector("[name]");t&&t.addEventListener("input",(function(){i(t,e)}))}))}},u=function(e){var t=o.querySelectorAll(".woocommerce-billing-fields__field-wrapper .validate-required"),i=document.getElementById("ship-to-different-address-checkbox"),r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r||s(t),i&&(t=i.checked?o.querySelectorAll(".woocommerce-billing-fields__field-wrapper .validate-required, .woocommerce-shipping-fields__field-wrapper .validate-required"):o.querySelectorAll(".woocommerce-billing-fields__field-wrapper .validate-required"),i.addEventListener("change",(function(){t=this.checked?o.querySelectorAll(".woocommerce-billing-fields__field-wrapper .validate-required, .woocommerce-shipping-fields__field-wrapper .validate-required"):o.querySelectorAll(".woocommerce-billing-fields__field-wrapper .validate-required"),r||s(t)}))),r)return t};u(),i.forEach((function(e,t){e.onclick=function(){var o=e.nextElementSibling,n=o?o.innerText:"",l=!1,s=u(!0);if(s.length&&s.forEach((function(e){var t=e.querySelector("[name]");if(t){var i=t.value.trim();if(!i)return l=!0,void e.classList.add("field-required");if("email"==t.type){if(!woostifyValidateEmail(i))return l=!0,void e.classList.add("field-required");e.classList.remove("field-required")}else e.classList.remove("field-required")}})),o||document.getElementById("terms")&&(document.getElementById("terms").checked=!1),l&&t>0)document.getElementById("place_order")&&(o&&document.getElementById("terms")&&(document.getElementById("terms").checked=!0),document.getElementById("place_order").click());else{var m=document.querySelector(".woocommerce-NoticeGroup");m&&(m.style.display="none"),d&&(d.innerHTML=a+" "+n);var p=siblings(e);e.classList.add("active"),p.length&&p.forEach((function(e){e.classList.remove("active")}));var f=document.querySelectorAll(".multi-step-review-information"),h=document.getElementById("billing_email"),v=h?h.value.trim():"",y=document.getElementById("billing_address_1"),g=document.getElementById("billing_address_2"),q=document.getElementById("billing_city"),w=!(!q||"select-one"!==q.type)&&q.querySelector('option[value="'+q.value+'"]'),S=document.getElementById("billing_country"),_=document.getElementById("billing_state"),k=!!_&&_.querySelector('option[value="'+_.value+'"]'),b=!!S&&S.querySelector('option[value="'+S.value+'"]'),L=document.getElementById("ship-to-different-address-checkbox"),E=document.getElementById("shipping_address_1"),T=document.getElementById("shipping_address_2"),x=document.getElementById("shipping_city"),A=document.getElementById("shipping_state"),B=document.getElementById("shipping_country"),I=!!A&&B.querySelector('option[value="'+A.value+'"]'),M=!!B&&B.querySelector('option[value="'+B.value+'"]'),H=document.querySelector('#shipping_method .shipping_method[checked="checked"]')||document.querySelector('#shipping_method .shipping_method[data-index="0"]'),j=!!H&&H.id,C=!!j&&document.querySelector('#shipping_method label[for="'+j+'"]'),Q="",O="",V="";Q+=y?y.value.trim():"",Q+=g?" "+g.value.trim():"",Q+=w?", "+w.innerText.trim():q?", "+q.value.trim():"",Q+=k?", "+k.innerText.trim():"",Q+=b?", "+b.innerText.trim():"",V=Q,L&&L.checked&&(O+=E?E.value.trim():"",O+=T?" "+T.value.trim():"",O+=x?", "+x.value.trim():"",O+=I?", "+I.innerText.trim():"",O+=M?", "+M.innerText.trim():"",V=O),f.length&&f.forEach((function(e){var t=e.querySelector('.multi-step-review-information-row[data-type="email"] .review-information-content'),i=e.querySelector('.multi-step-review-information-row[data-type="address"] .review-information-content'),o=e.querySelector('.multi-step-review-information-row[data-type="shipping"] .review-information-content');t&&(t.innerHTML=v),i&&(i.innerHTML=V),o&&C&&(o.innerHTML=C.innerHTML)})),function(){if(c){var e=document.querySelectorAll("#shipping_method .shipping_method"),t="";if(e.length)if(r.classList.remove("no-shipping-available"),1===e.length){var i=document.querySelector("#shipping_method .shipping_method + label");i&&(t+='<div class="shipping-methods-modified-item">',t+='<label class="shipping-methods-modified-label"><span>'+i.innerHTML+"</span></label>",t+="</div>")}else e.forEach((function(e,i){var o="checked"==e.getAttribute("checked")?'checked="checked"':"",r=e.nextElementSibling;t+='<div class="shipping-methods-modified-item">',t+='<label class="shipping-methods-modified-label" for="shipping-methods-index-'+i+'"><input type="radio" '+o+' name="shipping-method-modified[0]" id="shipping-methods-index-'+i+'" class="shipping-methods-modified-input" value="'+e.value+'"><span>'+r.innerHTML+"</span></label>",t+="</div>"}));else r.classList.add("no-shipping-available");document.querySelector(".shipping-methods-modified")?document.querySelector(".shipping-methods-modified").innerHTML=t:c.insertAdjacentHTML("beforeend",'<div class="shipping-methods-modified">'+t+"</div>");var o=document.querySelectorAll(".shipping-methods-modified-input");o.length&&o.forEach((function(e,t){e.checked&&e.value.includes("local_pickup")&&r.classList.add("has-local-pickup"),e.onclick=function(){var i=t+1,o=document.querySelector("#shipping_method li:nth-of-type("+i+') input[type="radio"]');o&&o.click(),e.value.includes("local_pickup")?r.classList.add("has-local-pickup"):r.classList.remove("has-local-pickup")}}))}}();var z=document.querySelectorAll(".review-information-link");z.length&&z.forEach((function(e){e.onclick=function(){var t=e.closest(".multi-step-review-information-row"),o=!!t&&t.getAttribute("data-type");if(o)switch(o){default:case"email":i[0].click(),h&&h.focus();break;case"address":i[0].click(),L&&L.checked&&E?E.focus():y&&y.focus();break;case"shipping":i[1].click()}}}));var R=t+1,Z=r.querySelector(".multi-step-checkout-content.active"),D=r.querySelector(".multi-step-checkout-content:nth-of-type("+R+")");Z&&Z.classList.remove("active"),D&&D.classList.add("active");var G=0==t,N=R==i.length;if(r.classList.remove("first","last"),G){r.classList.add("first");var $=document.querySelector(".woostify-before-order-review .woostify-before-order-review-total-price strong");$&&($.innerText=woostify_multi_step_checkout.content_total)}else N&&r.classList.add("last");jQuery(document.body).trigger("update_checkout")}}}));jQuery(document.body).on("updated_checkout",(function(e,t){var i,o=(i="",i+='<tr class="shipping-placeholder">',i+="<th>"+woostify_woocommerce_general.shipping_text+"</th>",(i+="<td>"+woostify_woocommerce_general.shipping_next+"</td>")+"</tr>");document.querySelector("form.woocommerce-checkout .cart-subtotal")&&!document.querySelector(".shipping-placeholder")&&document.querySelector("form.woocommerce-checkout .cart-subtotal").insertAdjacentHTML("afterend",o);var r=document.querySelector(".multi-step-checkout-wrapper.first"),c=document.querySelector(".woocommerce-checkout-review-order-table");if(r){var n=document.querySelector(".order-total td"),l=document.querySelector(".woostify-before-order-review-total-price strong");n&&(n.innerHTML=t.fragments._first_step_price),l&&(l.innerHTML=t.fragments._first_step_price)}else{c&&(c.innerHTML=t.fragments[".woocommerce-checkout-review-order-table"]);var d=document.querySelector(".order-total td"),a=document.querySelector(".woostify-before-order-review-total-price strong");d&&a&&(a.innerHTML=d.innerText)}}))}}};document.addEventListener("DOMContentLoaded",(function(){woostifyMultiStepCheckout(),woostifyExpandOrderReview()}));
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.02 |
proxy
|
phpinfo
|
Настройка