1 2 3let previousPaymentMethod = jQuery('input[name^="payment_method"]:checked').val(); 4 5jQuery(document).on("click", "button[data-pplcz-select-parcel-shop],a[data-pplcz-select-parcel-shop]", function(ev) { 6 ev.preventDefault(); 7 8 9 const mapSetting = { 10 address : jQuery(this).data('address') ?? null, 11 country : jQuery(this).data('country') ?? null, 12 hiddenPoints : jQuery(this).data('hidden-points') ?? null, 13 countries : jQuery(this).data('countries') ?? null 14 } 15 16 17 const what = jQuery(this).data("pplcz-select-parcel-shop"); 18 19 const updateCheckout = (data)=> { 20 jQuery("[name=pplcz_parcelshop]").val(JSON.stringify(data)); 21 jQuery("body").trigger("update_checkout"); 22 } 23 24 switch(what) 25 { 26 case "cash": 27 PplMap(data => updateCheckout(data), { withCash: true, ...mapSetting}); 28 break; 29 case "clear": 30 updateCheckout(null); 31 break; 32 default: 33 34 PplMap(data => updateCheckout(data), mapSetting); 35 break; 36 } 37}); 38 39function pplcz_posn_required () { 40 let req = false; 41 42 try { 43 const data = jQuery('[name=pplcz_parcelshop]').val(); 44 if (data) { 45 const parcel = JSON.parse(decodeURIComponent(data)); 46 req = parcel && parcel.posnRequired; 47 } 48 } 49 catch (e) 50 { 51 52 } 53 if (req) { 54 jQuery("#shipping_pplcz_posn_field").show(); 55 } 56 else { 57 jQuery("#shipping_pplcz_posn_field").hide(); 58 } 59} 60 61jQuery('body').on('updated_checkout', function() { 62 63 const trigger = jQuery("a[data-pplcz-select-parcel-shop], button[data-pplcz-select-parcel-shop]").first(); 64 65 if (trigger.length > 0) { 66 window.pplczLastPplMapData = { 67 address: trigger.data("address") ?? null, 68 country: trigger.data("country") ?? null, 69 hiddenPoints: trigger.data("hidden-points") ?? null, 70 countries: trigger.data("countries") ?? null 71 }; 72 } 73 const showmap = jQuery('.pplcz-parcelshop-inner').data('pplcz-showmap'); 74 if (showmap == 1) { 75 jQuery("a[data-pplcz-select-parcel-shop]").trigger("click") 76 } 77 pplcz_posn_required(); 78 79}); 80 81 82(function ($) { 83 $('form.checkout').on('change','input[name^=\"payment_method\"]', function () { 84 const selectedPaymentMethod = $('input[name^="payment_method"]:checked').val(); 85 const payments = [previousPaymentMethod, selectedPaymentMethod]; 86 87 //const codMethod = jQuery('a.pplcz-parcel').data('cod-method'); 88 const codMethod = jQuery('#pplcz_cod_method').val(); 89 90 previousPaymentMethod = selectedPaymentMethod; 91 92 if (payments.indexOf(codMethod) > -1) 93 { 94 $('body').trigger('update_checkout'); 95 } 96 }); 97 pplcz_posn_required(); 98})(jQuery);
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.