1var wps_wocuf_pro_custom_offer_bought = false; 2 3jQuery( document ).ready( 4 function ($) { 5 jQuery( "#wps_wocuf_pro_offer_loader" ).hide(); 6 7 jQuery( ".wps_wocuf_pro_custom_buy" ).on( 8 "click", 9 function (e) { 10 jQuery( "#wps_wocuf_pro_offer_loader" ).show(); 11 12 if (wps_wocuf_pro_custom_offer_bought) { 13 e.preventDefault(); 14 return; 15 } 16 17 wps_wocuf_pro_custom_offer_bought = true; 18 } 19 ); 20 21 jQuery( ".wps_wocuf_pro_no" ).on( 22 "click", 23 function (e) { 24 jQuery( "#wps_wocuf_pro_offer_loader" ).show(); 25 } 26 ); 27 28 /** 29 * Shortcode Scripts since v3.0.0 30 */ 31 jQuery( ".wps_upsell_quantity_input" ).on( 32 "change", 33 function (e) { 34 var updated_quantity = jQuery( this ).val(); 35 36 jQuery( "a" ).map( 37 function () { 38 // Check if any of them are empty. 39 if (this.href.includes( "wps_wocuf_pro_buy" )) { 40 if (false == this.href.includes( "fetch" )) { 41 var paramurl = this.href + "&fetch=1"; 42 jQuery( this ).attr( "href", paramurl ); 43 } 44 45 var currentquantity = jQuery( this ).attr( "href" ).split( "fetch=" ); 46 47 if ("" != currentquantity[1]) { 48 currentquantity = currentquantity[1]; 49 } else { 50 currentquantity = 1; 51 } 52 53 var newUrl = this.href.replace( 54 "fetch=" + currentquantity, 55 "fetch=" + updated_quantity 56 ); 57 jQuery( this ).attr( "href", newUrl ); 58 } 59 60 // For variable products. 61 else if (this.href.includes( "#wps_upsell" )) { 62 jQuery( ".wps_wocuf_pro_quantity" ).val( updated_quantity ); 63 } 64 } 65 ); 66 } 67 ); 68 69 /** 70 * Sweet Alert when Upsell Action Buttons are clicked in Preview Mode. 71 * since v3.0.0 72 */ 73 jQuery( document ).ready( 74 function ($) { 75 $( document ).on( 76 "click", 77 'a[href$="#preview"]', 78 function (e) { 79 e.preventDefault(); 80 81 // Check if SweetAlert is available 82 if (typeof swal !== "undefined") { 83 swal( 84 wps_upsell_public.alert_preview_title, 85 wps_upsell_public.alert_preview_content, 86 "info" 87 ); 88 } else if (typeof Swal !== "undefined") { 89 Swal.fire( 90 wps_upsell_public.alert_preview_title, 91 wps_upsell_public.alert_preview_content, 92 "info" 93 ); 94 } else { 95 alert( 96 wps_upsell_public.alert_preview_title + 97 "\n\n" + 98 wps_upsell_public.alert_preview_content 99 ); 100 } 101 } 102 ); 103 } 104 ); 105 106 /** 107 * Adding Upsell Loader since v3.0.0 108 */ 109 if ("undefined" !== typeof wps_upsell_public) { 110 if (wps_upsell_public.show_upsell_loader) { 111 wps_upsell_loader_message = wps_upsell_public.upsell_actions_message; 112 113 wps_upsell_loader_message_html = ""; 114 115 if (wps_upsell_loader_message.length) { 116 wps_upsell_loader_message_html = 117 '<p class="wps_upsell_loader_text">' + 118 wps_upsell_loader_message + 119 "</p>"; 120 } 121 122 jQuery( "body" ).append( 123 '<div class="wps_upsell_loader">' + 124 wps_upsell_loader_message_html + 125 "</div>" 126 ); 127 128 jQuery( document ).on( 129 "click", 130 "a", 131 function (e) { 132 // Check if any of them are empty. 133 if ( 134 this.href.includes( "wps_wocuf_pro_buy" ) || 135 this.href.includes( "#wps_upsell" ) 136 ) { 137 // Show loader on click. 138 jQuery( ".wps_upsell_loader" ).show(); 139 } 140 } 141 ); 142 } 143 } 144 } 145);
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.