1jQuery(function( $ ) { 2 3 var selectedCountry = "ZA"; 4 var fastSelectActive = "y"; 5 6 if( selectedCountry == "ZA" ) 7 { 8 fw_is_southafrica(); 9 } 10 11// var selectedCountryCalc = $('select#calc_shipping_country').val(); 12// if( selectedCountryCalc == "ZA" ) 13// { 14// fw_is_southafrica(); 15// } 16 17$( "#billing_city_field .fstElement" ).click(function() { 18 if (window.matchMedia("(max-width: 767px)").matches) 19 { 20 $('html,body').animate({scrollTop: $('#billing_city_field').offset().top}, 500); 21 } 22}); 23 24$( "#shipping_city_field .fstElement" ).click(function() { 25 if (window.matchMedia("(max-width: 767px)").matches) 26 { 27 $('html,body').animate({scrollTop: $('#shipping_city_field').offset().top}, 500); 28 } 29}); 30 31 32 $('select#billing_country').change(function() 33 { 34 var selectedCountry = $('select#billing_country').val(); 35 if( selectedCountry != "ZA" ) 36 { 37 if( fastSelectActive == "y" ) { 38 $('#billing_city').data('fastselect').destroy(); 39 $('#shipping_city').data('fastselect').destroy(); 40 } 41 $('#billing_postcode').prop("readonly", false); 42 $('#billing_city').attr("placeholder", "City" ); 43 $("label[for='billing_city']").text("City"); 44 $('#shipping_postcode').prop("readonly", false); 45 $('#shipping_city').attr("placeholder", "" ); 46 $("label[for='shipping_city']").text("City"); 47 48 $('#billing_city').attr("autocomplete", "new-password" ); 49 $('#shipping_city').attr("autocomplete", "new-password" ); 50 51 52 fastSelectActive = "n"; 53 } 54 else 55 { 56 fw_is_southafrica(); 57 } 58 }); 59 60 $('select#shipping_country').change(function() 61 { 62 var selectedCountry = $('select#shipping_country').val(); 63 if( selectedCountry != "ZA" ) 64 { 65 if( fastSelectActive == "y" ) { 66 $('#billing_city').data('fastselect').destroy(); 67 $('#shipping_city').data('fastselect').destroy(); 68 } 69 $('#billing_postcode').prop("readonly", false); 70 $('#billing_city').attr("placeholder", "City" ); 71 $("label[for='billing_city']").text("City"); 72 $('#shipping_postcode').prop("readonly", false); 73 $('#shipping_city').attr("placeholder", "" ); 74 $("label[for='shipping_city']").text("City"); 75 76 77 fastSelectActive = "n"; 78 } 79 else 80 { 81 fw_is_southafrica(); 82 } 83 }); 84 85 86 function fw_is_southafrica() 87 { 88 /* checkout page */ 89 fastSelectActive = "y"; 90 $("label[for='billing_city']").text("Find your delivery suburb, province and postal code combination"); 91 var fwBillingCity = $('#billing_city').val(); 92 var fwBillingPostcode = $('#billing_postcode').val(); 93 $('#billing_city').attr("placeholder", "CLICK HERE AND START TYPING YOUR SUBURB OR POSTAL CODE" ); 94 95 $("label[for='shipping_city']").text("Find your delivery suburb, province and postal code combination"); 96 var fwShippingCity = $('#shipping_city').val(); 97 var fwShippingPostcode = $('#shipping_postcode').val(); 98 $('#shipping_city').attr("placeholder", "CLICK HERE AND START TYPING YOUR SUBURB OR POSTAL CODE" ); 99 100 $('#calc_shipping_city').attr("placeholder", "CLICK HERE AND START TYPING YOUR SUBURB OR POSTAL CODE"); 101 $('#calc_shipping_city').attr('data-url', 'https://api.siteway.co.za/fastway/woo/v1/find-suburb-province-all/'); 102 103 $('#calc_shipping_city').attr('data-load-once', 'false'); 104 $('#calc_shipping_city').fastselect( { toggleButtonClass: 'calcVal', searchPlaceholder: 'Enter your suburb or postal code...', noResultsText: 'No suburbs found, please try again' }); 105 106 $('#billing_city').attr('data-url', 'https://api.siteway.co.za/fastway/woo/v1/find-suburb-province-all/'); 107 $('#billing_city').attr('data-load-once', 'false'); 108 $('#shipping_city').attr('data-url', 'https://api.siteway.co.za/fastway/woo/v1/find-suburb-province-all/'); 109 $('#shipping_city').attr('data-load-once', 'false'); 110 $('#shipping_city').prop('required', true); 111 $('#billiing_city').prop('required', true); 112 $('#billing_city').fastselect({ toggleButtonClass: 'billingVal', searchPlaceholder: 'Enter your suburb or postal code...', noResultsText: 'No suburbs found, please try again' }); //{ toggleButtonClass: 'billingVal' } 113 $('#shipping_city').fastselect({ toggleButtonClass: 'shippingVal', searchPlaceholder: 'Enter your suburb or postal code...', noResultsText: 'No suburbs found, please try again' }); 114 115 $('#billing_postcode').prop("readonly", true); 116 $('#shipping_postcode').prop("readonly", true); 117 118 $('.fstQueryInput').attr("autocomplete", "new-password" ); 119 } 120 121 122 $("#billing_city").change(function () { 123 124 var fwPcProv = $(".billingVal").text(); 125 console.log( "------------------" ); 126 console.log( "Billing address" ); 127 console.log( "------------------" ); 128 console.log( "Selected Entry = " + fwPcProv ); //Berea Park (Gauteng - 0002) 129 // Get the suburb 130 fwPcSuburbArray = fwPcProv.split(' ('); 131 fwSuburb = fwPcSuburbArray[0]; 132 console.log( "Suburb = " + fwSuburb ); //Berea Park 133 var fwPPArray = fwPcSuburbArray[1].split(' - '); 134 var billingPostalCode = fwPPArray[1].replace(")", "");; 135 var billingProvince = fwPPArray[0]; 136 137 $('#billing_postcode').val( billingPostalCode ); 138 $('#billing_city').val( fwSuburb ); 139 140 console.log( "Postcode = " + billingPostalCode ); //0002 141 console.log( "Province = " + billingProvince ); // Berea Park 142 143 if( billingProvince == "Gauteng" ) { 144 $("#billing_state").val("GP").trigger("change"); 145 } 146 if( billingProvince == "Free State" ) { 147 $("#billing_state").val("FS").trigger("change"); 148 } 149 if( billingProvince == "Eastern Cape" ) { 150 $("#billing_state").val("EC").trigger("change"); 151 } 152 if( billingProvince == "KwaZulu-Natal" ) { 153 $("#billing_state").val("KZN").trigger("change"); 154 } 155 if( billingProvince == "Limpopo" ) { 156 $("#billing_state").val("LP").trigger("change"); 157 } 158 if( billingProvince == "Mpumalanga" ) { 159 $("#billing_state").val("MP").trigger("change"); 160 } 161 if( billingProvince == "Northern Cape" ) { 162 $("#billing_state").val("NC").trigger("change"); 163 } 164 if( billingProvince == "North West" ) { 165 $("#billing_state").val("NW").trigger("change"); 166 } 167 if( billingProvince == "Western Cape" ) { 168 $("#billing_state").val("WC").trigger("change"); 169 } 170 Swal.fire({ 171 title: 'You have selected', 172 icon: 'info', 173 html: fwSuburb + '<br/>' + billingPostalCode + '<br/>' + billingProvince + '<br/><br/><em>as your delivery destination.</em><br /></br><img src="https://api.siteway.co.za/fastway.gif" style="display:block;margin:auto;" />', 174 }); 175 }); 176 177 $("#shipping_city").change(function () { 178 var fwPcProv = $(".shippingVal").text(); 179 180 console.log( "------------------" ); 181 console.log( "Shipping address" ); 182 console.log( "------------------" ); 183 console.log( "Selected Entry = " + fwPcProv ); //Berea Park (Gauteng - 0002) 184 // Get the suburb 185 fwPcSuburbArray = fwPcProv.split(' ('); 186 fwSuburb = fwPcSuburbArray[0]; 187 console.log( "Suburb = " + fwSuburb ); //Berea Park 188 var fwPPArray = fwPcSuburbArray[1].split(' - '); 189 var shippingPostalCode = fwPPArray[1].replace(")", "");; 190 var shippingProvince = fwPPArray[0]; 191 192 $('#shipping_postcode').val( shippingPostalCode ); 193 $('#shipping_city').val( fwSuburb ); 194 195 196 console.log( "Postcode = " + shippingPostalCode ); //0002 197 console.log( "Province = " + shippingProvince ); // Berea Park 198 199 if( shippingProvince == "Gauteng" ) { 200 $("#shipping_state").val("GP").trigger("change"); 201 } 202 if( shippingProvince == "Free State" ) { 203 $("#shipping_state").val("FS").trigger("change"); 204 } 205 if( shippingProvince == "Eastern Cape" ) { 206 $("#shipping_state").val("EC").trigger("change"); 207 } 208 if( shippingProvince == "KwaZulu-Natal" ) { 209 $("#shipping_state").val("KZN").trigger("change"); 210 } 211 if( shippingProvince == "Limpopo" ) { 212 $("#shipping_state").val("LP").trigger("change"); 213 } 214 if( shippingProvince == "Mpumalanga" ) { 215 $("#shipping_state").val("MP").trigger("change"); 216 } 217 if( shippingProvince == "Northern Cape" ) { 218 $("#shipping_state").val("NC").trigger("change"); 219 } 220 if( shippingProvince == "North West" ) { 221 $("#shipping_state").val("NW").trigger("change"); 222 } 223 if( shippingProvince == "Western Cape" ) { 224 $("#shipping_state").val("WC").trigger("change"); 225 } 226 227 Swal.fire({ 228 title: 'You have selected', 229 icon: 'info', 230 html: fwSuburb + '<br/>' + shippingPostalCode + '<br/>' + shippingProvince + '<br/><br/><em>as your delivery destination.</em><br /></br><img src="https://api.siteway.co.za/fastway.gif" style="display:block;margin:auto;" />', 231 }); 232 }); 233 234 $('input[name^="shipping_method"]:checked').change(function () { 235 alert( "shipping method changed" ); 236 }); 237 238 $( document.body ).on( 'updated_checkout', function(){ 239 if ( $('input[name^="shipping_method"]').is(':radio')) 240 { 241 } 242}); 243 244 245/* Cart Page */ 246 247 $("#calc_shipping_city").change(function () { 248 //var fwPostcode = $(".fstSelected").text(); 249 var fwPostcode = $(".fstToggleBtn").text(); 250 var fwSelectedPostcode = $('#calc_shipping_city').val(); 251 fwPostcode = fwPostcode.replace(fwSelectedPostcode, ""); 252 fwPostcode = fwPostcode.replace(" (", ""); 253 fwPostcode = fwPostcode.replace(")", ""); 254 console.log( "a - " + fwPostcode ); 255 $('#calc_shipping_postcode').val(fwPostcode); 256 }); 257 258 $(document).ajaxComplete(function () { 259 var fwSelectedShippingMeth = $('input[name^="shipping_method"]:checked').val(); 260 261 setTimeout(function(){ 262 $('#calc_shipping_city').attr('data-url', 'https://api.siteway.co.za/fastway/woo/v1/find-suburb-province-all/'); 263 $('#calc_shipping_city').attr('data-load-once', 'false'); 264 $('#calc_shipping_city').attr("placeholder", "Please select your suburb"); 265 $('#calc_shipping_city').fastselect({ toggleButtonClass: 'calcVal', searchPlaceholder: 'Enter your suburb or postal code...', noResultsText: 'No suburbs found, please try again' }); 266 // } 267 },500); 268 269 $("#calc_shipping_city").change(function () { 270 271 var fwPcProv = $(".calcVal").text(); 272 273 console.log( "------------------" ); 274 console.log( "Cart address" ); 275 console.log( "------------------" ); 276 console.log( "Selected Entry = " + fwPcProv ); //Berea Park (Gauteng - 0002) 277 // Get the suburb 278 fwPcSuburbArray = fwPcProv.split(' ('); 279 fwSuburb = fwPcSuburbArray[0]; 280 console.log( "Suburb = " + fwSuburb ); //Berea Park 281 var fwPPArray = fwPcSuburbArray[1].split(' - '); 282 var cartPostalCode = fwPPArray[1].replace(")", "");; 283 var cartProvince = fwPPArray[0]; 284 285 $('#calc_shipping_postcode').val( cartPostalCode ); 286 $('#calc_shipping_city').val( fwSuburb ); 287 288 console.log( "Postcode = " + cartPostalCode ); //0002 289 console.log( "Province = " + cartProvince ); 290 291 $('#calc_shipping_postcode').val(cartPostalCode); 292 $('#calc_shipping_postcode').prop("readonly", true); 293 294 if( cartProvince == "Gauteng" ) { 295 $("#calc_shipping_state").val("GP").trigger("change"); 296 } 297 if( cartProvince == "Free State" ) { 298 $("#calc_shipping_state").val("FS").trigger("change"); 299 } 300 if( cartProvince == "Eastern Cape" ) { 301 $("#calc_shipping_state").val("EC").trigger("change"); 302 } 303 if( cartProvince == "KwaZulu-Natal" ) { 304 $("#calc_shipping_state").val("KZN").trigger("change"); 305 } 306 if( cartProvince == "Limpopo" ) { 307 $("#calc_shipping_state").val("LP").trigger("change"); 308 } 309 if( cartProvince == "Mpumalanga" ) { 310 $("#calc_shipping_state").val("MP").trigger("change"); 311 } 312 if( cartProvince == "Northern Cape" ) { 313 $("#calc_shipping_state").val("NC").trigger("change"); 314 } 315 if( cartProvince == "Northern Cape" ) { 316 $("#calc_shipping_state").val("NC").trigger("change"); 317 } 318 if( cartProvince == "North West" ) { 319 $("#calc_shipping_state").val("NW").trigger("change"); 320 } 321 if( cartProvince == "Western Cape" ) { 322 $("#calc_shipping_state").val("WC").trigger("change"); 323 } 324 Swal.fire({ 325 title: 'You have selected', 326 icon: 'info', 327 html: fwSuburb + '<br/>' + cartPostalCode + '<br/>' + cartProvince + '<br/><br/><em>as your delivery destination.</em><br /></br><img src="https://api.siteway.co.za/fastway.gif" style="display:block;margin:auto;" />', 328 }); 329 }); 330 331}); 332
vendor: 3 bytes, line 333
333});
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.