https://www.ludwigsroses.co.za/wp-content/litespeed/js/979cb347a183c97e49098f35f0a489cb.js?ver=489cb
1(function($){$(function(){const uniqueElements={};const methodBoxElements=document.querySelectorAll('#wc-blocks-notice-1');removeDuplicateElements(methodBoxElements);let formIsDirty=!1 2$('.woocommerce-input-wrapper').on('change',function(){formIsDirty=!0 3const timeoutHandler=setInterval(function(){if(formIsDirty){$('body').trigger('update_checkout') 4formIsDirty=!1}else{clearInterval(timeoutHandler)}},500)}) 5const collectTimer=setInterval(function(){let methodInputs=$('input[name="iihtcg_selector_input"]') 6selectionMade=!1 7$.each(methodInputs,function(i,input){if(input.checked===!0){selectionMade=input.value}})},500) 8const methodBoxEnabled=$('#iihtcg_selector') 9if(methodBoxEnabled.length){jQuery(document.body).on('updated_checkout',function(){jQuery('*[id*=local_pickup]').each(function(){if(selectionMade=='tcg'){jQuery(this).parent().hide()}else{jQuery(this).parent().show()}})}) 10const wbf=$('div.woocommerce-billing-fields') 11const wbfParent=wbf.parent() 12const wbfOverlay=document.createElement('div') 13wbfOverlay.setAttribute('id','woocommerce_billing_field_overlay') 14wbfOverlay.style.opacity='20%' 15wbfOverlay.style.zIndex='999' 16wbf.replaceWith(wbfOverlay) 17wbfOverlay.append(wbf[0]) 18const orf=$('#order_review') 19const orfParent=orf.parent() 20const orfOverlay=document.createElement('div') 21orfOverlay.setAttribute('id','order_review_field_overlay') 22orfOverlay.style.opacity='20%' 23orfOverlay.style.zIndex='999' 24orf.replaceWith(orfOverlay) 25orfOverlay.append(orf[0]) 26const iihtcgSelectors=$('input[name="iihtcg_selector_input"]') 27let selectionMade=!0 28showHideShipping(selectionMade) 29$('#iihtcg_method_field').hide() 30jQuery('article .woocommerce-checkout').show() 31if(typeof iihtcgSelectors!='undefined'){$.each(iihtcgSelectors,function(i,selector){if(selector.checked===!0){selectionMade=selector.value 32showHideShipping(selectionMade)}else{showHideShipping(!1)}}) 33iihtcgSelectors.on('change',function(e){if(this.checked===!0){selectionMade=this.value 34showHideShipping(selectionMade)} 35$('body').trigger('update_checkout') 36jQuery('#billing_state').selectWoo()})} 37setTimeout(function(){const countries=$('span[aria-labelledby="select2-billing_country-container"]') 38if(countries&&countries.length>1){countries[1].style.display='none'} 39const states=$('span[aria-labelledby="select2-billing_state-container"]') 40if(states&&states.length>1){states[1].style.display='none'} 41const tcgBillingPlaces=$('span[aria-labelledby="select2-billing_tcg_place_lookup-container"]') 42if(tcgBillingPlaces&&tcgBillingPlaces.length>1){tcgBillingPlaces[1].style.display='none'}},2000) 43function recreateProvinceSelect2OnLoad(){jQuery('#select2-billing_state-container').parent().parent().remove() 44jQuery('#billing_state').selectWoo() 45jQuery('#billing_state').selectWoo()} 46recreateProvinceSelect2OnLoad() 47const deliverToDifferentAddress=$('h3#ship-to-different-address') 48function hideDeliverToDifferentAddress(){if(deliverToDifferentAddress.length){deliverToDifferentAddress.hide()}} 49hideDeliverToDifferentAddress() 50$('input[name="iihtcg_selector_input"]').on('change',function(){const lookupPlaceLabelSelector=$('input[name="billing_tcg_place_lookup_place_label"]') 51const proceedToPaymentButtonSelector=$('a:contains(\'Proceed to payment\')') 52if($(this).val()==='collect'){proceedToPaymentButtonSelector.show() 53hideDeliverToDifferentAddress()}else{deliverToDifferentAddress.show() 54addAsteriskSuburbCity() 55if((typeof lookupPlaceLabelSelector.val()==='undefined')||lookupPlaceLabelSelector.val().trim()===''){proceedToPaymentButtonSelector.hide()}}})} 56function removeDuplicateElements(allElements){allElements.forEach((element)=>{const id=element.id;if(id){if(uniqueElements[id]){element.remove()}else{uniqueElements[id]=!0}}})} 57function fieldsValid(){let valid=!0 58const inputValidationRequired=$('.validate-required input') 59const selectValidationRequired=$('.validate-required select') 60$.each(inputValidationRequired,function(i,val){if(val.id.substr(0,7)==='billing'&&val.value===''){valid=!1}}) 61$.each(selectValidationRequired,function(i,val){if(val.id.substr(0,7)==='billing'&&val.value===''&&val.id.search('tcg_place_lookup')===-1){valid=!1}}) 62return valid} 63function showHideShipping(selectionMade){const wbfOverlay=$('#woocommerce_billing_field_overlay') 64const orfOverlay=$('#order_review_field_overlay') 65const selectBilling=$('#billing_tcg_place_lookup_field') 66const select2Container=$('span.select2-container--open') 67if(!selectionMade){$('#iihtcg_method').val('none') 68selectBilling.hide() 69select2Container.hide() 70disableAllFieldsExceptShippingMethod() 71return} 72if(selectionMade==='collect'){$('#order_review').show() 73$('#please_select').hide() 74$('#please_complete').show() 75wbfOverlay.css('opacity','1') 76orfOverlay.css('opacity','1') 77$('#iihtcg_method').val('collect') 78selectBilling.hide() 79select2Container.hide() 80enableAllFieldsExceptMethod() 81return} 82if(selectionMade==='tcg'){$('#order_review').show() 83$('#please_select').hide() 84wbfOverlay.css('opacity','1') 85orfOverlay.css('opacity','1') 86$('#iihtcg_method').val('tcg') 87selectBilling.show() 88enableAllFieldsExceptMethod()}} 89function disableAllFieldsExceptShippingMethod(){if(jQuery('[name=iiht
89cg_selector_input]').length){jQuery(':input').not('[name=iihtcg_selector_input]').prop('disabled',!0)}} 90disableAllFieldsExceptShippingMethod() 91function enableAllFieldsExceptMethod(){if(jQuery('[name=iihtcg_selector_input]').length){jQuery(':input').not('[name=iihtcg_selector_input]').prop('disabled',!1)}} 92$('body').on('click','.shipping-calculator-button',function(){var cartShippingAreaPanel=$('#tcg-cart-shipping-area-panel') 93var shippingForm=cartShippingAreaPanel.prev('.woocommerce-shipping-calculator') 94var updateShippingButton=shippingForm.find('button[name=calc_shipping]') 95updateShippingButton.parent('p').before(cartShippingAreaPanel) 96cartShippingAreaPanel.show()}) 97function select2LocationSelect(){var billstr='' 98var suburbSelect 99var shipToDifferentPlace=$('#ship-to-different-address-checkbox').prop('checked') 100if(!shipToDifferentPlace){suburbSelect=$('#billing_tcg_place_lookup_field select')}else{suburbSelect=$('#shipping_tcg_place_lookup_field select')} 101if(suburbSelect.length>0){suburbSelect.select2({placeholder:'Start typing Suburb name...',minimumInputLength:3,ajax:{url:theCourierGuy.url,dataType:'json',delay:350,data:function(term){return{q:term,action:'wc_tcg_get_places'}},closeOnSelect:!0,selectOnClose:!0,processResults:function(data){var results=[] 102$.each(data,function(index,item){results.push({id:item.suburb_key,text:item.suburb_value,selected:(index===0&&billstr.length>0)})}) 103return{results:results,}},cache:!1}}).on('change',function(evt){var select=$(this) 104var placeLabelInput=select.prev('input') 105var placeIdInput=placeLabelInput.prev('input') 106$(this).children().each(function(){var option=$(this) 107if(option.val()!==''){placeIdInput.val(option.val()) 108placeLabelInput.val(option.text())}}) 109if(select.attr('name')==='shipping_tcg_place_lookup'){let billingSelect=$('#billing_tcg_place_lookup') 110let billingSelectOptions=$('#billing_tcg_place_lookup option') 111if(billingSelectOptions.length==0||(billingSelectOptions.length==1&&billingSelectOptions[0].value=='')){billingSelect.empty() 112$('input[name="billing_tcg_place_lookup_place_id"]').val(placeIdInput.val()) 113$('input[name="billing_tcg_place_lookup_place_label"]').val(placeLabelInput.val()) 114let opt='<option value="'+placeIdInput.val()+'">'+placeLabelInput.val()+'</option>' 115billingSelect.append(opt)}} 116$('body').trigger('update_checkout')}) 117if(!shipToDifferentPlace&&billstr.length>2){suburbSelect.select2('open') 118$('input.select2-search__field').val(billstr) 119$('input.select2-search__field').trigger('input')}}} 120$('.tcg-insurance').on('change',function(){$('.tcg-suburb-field select').trigger('change') 121$('body').trigger('update_checkout');$('body').trigger('update_order_review')}) 122$("#shipping_insurance").change(function(){setShippingInsuranceValues();$('body').trigger('update_checkout')});$("#billing_insurance").change(function(){setBillingInsuranceValues();$('body').trigger('update_checkout')});function setBillingInsuranceValues(){if($('#billing_insurance').prop('checked')===!0){$('#billing_insurance').val(1)}else{$('#billing_insurance').val(0)}} 123function setShippingInsuranceValues(){if($("#shipping_insurance").prop('checked')===!0){$("#shipping_insurance").val(1)}else{$("#shipping_insurance").val(0)}} 124function clearPlaceSelects(){var placeSelects=$('.tcg-suburb-field').find('select') 125placeSelects.children('option').remove() 126placeSelects.val(null).trigger('change') 127$('input[name=billing_tcg_place_lookup_place_id]').val('') 128$('input[name=billing_tcg_place_lookup_place_label]').val('') 129$('input[name=shipping_tcg_place_lookup_place_id]').val('') 130$('input[name=shipping_tcg_place_lookup_place_label]').val('')} 131function toggleSuburbPanelDisplay(tcgSuburbSelect,tcgSuburbSelectPanel){if(tcgSuburbSelect.val()==='ZA'){if(theCourierGuy.southAfricaOnly==='true'){tcgSuburbSelectPanel.show()}}else{if(theCourierGuy.southAfricaOnly==='true'){tcgSuburbSelectPanel.hide()} 132clearPlaceSelects()}} 133$('#billing_country').on('change',function(event){var tcgSuburbSelectPanel=$('#billing_tcg_place_lookup_field') 134toggleSuburbPanelDisplay($(this),tcgSuburbSelectPanel)}) 135$('#shipping_country').on('change',function(event){var tcgSuburbSelectPanel=$('#shipping_tcg_place_lookup_field') 136toggleSuburbPanelDisplay($(this),tcgSuburbSelectPanel)}) 137if(theCourierGuy.southAfricaOnly==='true'){var billingCountry=$('#billing_country') 138if(billingCountry.length>0){billingCountry.trigger('change')} 139var shippingCountry=$('#shipping_country') 140if(shippingCountry.length>0){shippingCountry.trigger('change')}}
141function triggerPlaceSelect(targetSelect,sourceSelect){var placeLabelInput=sourceSelect.prev('input') 142var placeIdInput=placeLabelInput.prev('input') 143var newOption=new Option(placeLabelInput.val(),placeIdInput.val(),!0,!0) 144targetSelect.append(newOption).trigger('change') 145targetSelect.val(placeIdInput.val()) 146targetSelect.trigger('change')} 147$('#ship-to-different-address-checkbox').on('change',function(){var shipToDifferentAddressValue=$(this).prop('checked') 148var shippingPlaceSelect=$('#shipping_tcg_place_lookup') 149var billingPlaceSelect=$('#billing_tcg_place_lookup') 150if(shipToDifferentAddressValue===!0){$('#billing_insurance_field').hide() 151$('#billing_tcg_place_lookup_field').hide() 152triggerPlaceSelect(shippingPlaceSelect,billingPlaceSelect) 153if($('#billing_insurance').prop('checked')===!0){$("#shipping_insurance").val(1);$("#shipping_insurance").prop('checked',!0).attr('checked','checked').trigger('change')}else{$("#shipping_insurance").val(0);$("#shipping_insurance").prop('checked',!1).removeAttr('checked').trigger('change')} 154$('p#billing_tcg_place_lookup_field').removeClass('validate-required') 155$('p#billing_tcg_place_lookup_field').removeClass('woocommerce-validated')}else{$('#billing_insurance_field').show() 156if($('#billing_country').val()==='ZA'||theCourierGuy.southAfricaOnly==='false'){$('#billing_tcg_place_lookup_field').show()} 157triggerPlaceSelect(billingPlaceSelect,shippingPlaceSelect) 158if($("#shipping_insurance").prop('checked')===!0){$('#billing_insurance').val(1);$('#billing_insurance').prop('checked',!0).attr('checked','checked').trigger('change')}else{$('#billing_insurance').val(0);$('#billing_insurance').prop('checked',!1).removeAttr('checked').trigger('change')} 159$('p#billing_tcg_place_lookup_field').removeClass('validate-required') 160$('p#billing_tcg_place_lookup_field').addClass('validate-required') 161$('p#billing_tcg_place_lookup_field').removeClass('woocommerce-validated') 162$('p#billing_tcg_place_lookup_field').addClass('woocommerce-validated')}}) 163$('input[name="billing_tcg_place_lookup_place_label"]').on('change',function(){const lookupPlaceLabelSelector=$('input[name="billing_tcg_place_lookup_place_label"]') 164const proceedToPaymentButtonSelector=$('a:contains(\'Proceed to payment\')') 165if(lookupPlaceLabelSelector.val().trim()===''){proceedToPaymentButtonSelector.hide()}else{proceedToPaymentButtonSelector.show()}}) 166function hideProceedToPaymentOnLoad(){const lookupPlaceLabelSelector=$('input[name="billing_tcg_place_lookup_place_label"]') 167const proceedToPaymentButtonSelector=$('a:contains(\'Proceed to payment\')') 168if(lookupPlaceLabelSelector.length){if(lookupPlaceLabelSelector.val().trim()===''&&proceedToPaymentButtonSelector.length){proceedToPaymentButtonSelector.hide()}}} 169hideProceedToPaymentOnLoad() 170const suburbCityLabelSelectorBilling=$('label[for="billing_tcg_place_lookup"]') 171const suburbCityLabelSelectorShipping=$('label[for="shipping_tcg_place_lookup"]') 172const requiredAsterisk='<abbr class="required" title="required">*</abbr>' 173function addAsteriskSuburbCity(){if(suburbCityLabelSelectorBilling.length&&!suburbCityLabelSelectorBilling.html().includes(requiredAsterisk)){suburbCityLabelSelectorBilling.append(requiredAsterisk)} 174if(suburbCityLabelSelectorShipping.length&&!suburbCityLabelSelectorShipping.html().includes(requiredAsterisk)){suburbCityLabelSelectorShipping.append(requiredAsterisk)}} 175addAsteriskSuburbCity() 176$('input#billing_first_name').on('change',function(ev){$('body').trigger('update_checkout')}) 177$('input#billing_last_name').on('change',function(ev){$('body').trigger('update_checkout')}) 178$('input#billing_phone').on('change',function(ev){$('body').trigger('update_checkout')}) 179$('input#billing_city').on('change',function(ev){let method=!1 180if(typeof iihtcgSelectors!='undefined'&&iihtcgSelectors){$.each(iihtcgSelectors,function(i,selector){if(selector.checked===!0){method=selector.value}})}}) 181if(typeof $('#billing_insurance')!='undefined'){setBillingInsuranceValues() 182$('#billing_insurance').val(0)} 183if(typeof $("#shipping_insurance")!='undefined'){setShippingInsuranceValues() 184$('#shipping_insurance').val(0)} 185$(document).on('change','input[name*="tcg_ship_logic_"]',function(e){const $optins=$('input[name*="tcg_ship_logic_"]') 186let optin='' 187$.each($optins,(k,v)=>{if(v.checked){optin+=v.value}}) 188$('input#ship_logic_opt_ins').val(optin) 189$('input#ship_logic_opt_ins').trigger('change') 190$('body').trigger('update_checkout')}) 191var suburbAdminSelect=$('select.tcg-suburb-field') 192if(suburbAdminSelect.length>0){suburbAdminSelect.select2({placeholder:'Start typing Suburb name...',minimumInputLength:3,ajax:{url:theCourierGuy.url,dataType:'json',delay:350,data:function(term){return{q:term,action:'wc_tcg_get_places'}},closeOnSelect:!0,processResults:function(data){var results=[] 193$.each(data,function(index,item){results.push({id:item.suburb_key,text:item.suburb_value})}) 194return{results:results,}},cache:!1}}).on('change',function(evt){$(this).children().each(function(k,v){if(k==1){$('#woocommerce_the_courier_guy_shopPlace').val($(v).text())}})})} 195var overrideSelects=$('.tcg-override-per-service') 196var overrideInputs=$('.tcg-override-per-service-input') 197overrideSelects.on('change',function(){var selectedOptionValue=$(this).children('option:selected').val() 198if(selectedOptionValue!==''){$(this).nextAll('span').hide() 199$(this).nextAll('span.tcg-override-per-service-span-'+selectedOptionValue).show()}}) 200overrideInputs.on('blur',function(){var overrideSelect=$(this).parent('span').prevAll('select.tcg-override-per-service') 201var overrideValues={} 202overrideSelect.nextAll('span').each(function(){var input=$(this).children('input') 203var serviceId=input.data('service-id') 204var overrideSelectOption=overrideSelect.find('option[value="'+serviceId+'"]') 205var serviceLabel=overrideSelectOption.data('service-label') 206var overrideValue=input.val() 207if(overrideValue!==''){var prefix=' - ' 208if(input.hasClass('wc_input_price')){prefix=' - R ' 209input.val(parseFloat(overrideValue).toFixed(2)) 210overrideValue=input.val()} 211overrideValues[serviceId]=overrideValue 212serviceLabel=serviceLabel+prefix+overrideValue} 213overrideSelectOption.html(serviceLabel)}) 214if(Object.keys(overrideValues).length>0){overrideSelect.nextAll('input').val(JSON.stringify(overrideValues))}else{overrideSelect.nextAll('input').val('')}})})})(jQuery) 215;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.