1jQuery(function ($) { 2 window.zcredit_helper = { 3 open_payment_dialog(iframe_url, iframe_width, iframe_height) { 4 5 // Destroy old dialogs 6 $("dialog#zcredit__payment-dialog").remove(); 7 8 // Append dialog markup to body 9 $(document.body).append(` 10 <dialog id="zcredit__payment-dialog"> 11 <div class="zcredit__dialog-body"> 12 <div class="zcredit__dialog-title_bar"> 13 <button class="zcredit__close-btn"> 14 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g id="feClose0" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="feClose1" fill="currentColor"><path id="feClose2" d="M10.657 12.071L5 6.414L6.414 5l5.657 5.657L17.728 5l1.414 1.414l-5.657 5.657l5.657 5.657l-1.414 1.414l-5.657-5.657l-5.657 5.657L5 17.728z"/></g></g></svg> 15 </button> 16 </div> 17 <iframe src="${iframe_url}" class="zcredit__payment-iframe" autofocus></iframe> 18 </div> 19 </dialog> 20 `) 21 22 this.resize_iframe(iframe_width, iframe_height) 23 24 let dialog = document.querySelector("dialog#zcredit__payment-dialog") 25 26 dialog.showModal() 27 28 // Close on click outside 29 dialog.addEventListener("click", (event) => { 30 if (event.target === dialog) { 31 dialog.close(); 32 } 33 }); 34 35 // Close on click on close btn 36 $(document).on("click", "#zcredit__payment-dialog .zcredit__close-btn", () => { 37 dialog.close(); 38 }) 39 40 // Prevent background scrolling when modal is open 41 $("html").addClass("zcredit__overflow-hidden") 42 dialog.addEventListener("close", function () { 43 $("html").removeClass("zcredit__overflow-hidden") 44 }); 45 }, 46 47 resize_iframe(width, height) { 48 let iframe = $(".zcredit__payment-iframe"); 49 let selected_payment_method = $('input[name="payment_method"]:checked').val(); 50 51 if (selected_payment_method === "zcredit_google_pay") { 52 iframe.css('height', "220px"); 53 } else if (selected_payment_method === "zcredit_bit_pay") { 54 iframe.css('height', "350px"); 55 } else { 56 iframe.css('height', height || 'auto') 57 } 58 iframe.css('width', width || 'auto') 59 }, 60 61 add_inline_iframe(iframe_url, iframe_width, iframe_height, location = "") { 62 // Destroy old dialogs 63 $("#zcredit__payment-inline").remove(); 64 65 if (!location) location = ".wc_payment_methods"; 66 67 if (!$(location).length) { 68 location = ".wc-block-checkout__actions"; 69 } 70 71 // Append dialog markup to body 72 $(location).after(` 73 <div id="zcredit__payment-inline"> 74 <div class="zcredit__dialog-body"> 75 <iframe src="${iframe_url}" class="zcredit__payment-iframe" autofocus></iframe> 76 </div> 77 </div> 78 `) 79 this.resize_iframe(iframe_width, iframe_height) 80 } 81 } 82});
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.