1'use strict'; 2 3(function ($) { 4 $(function () { 5 if (wooac_vars.style === 'notiny') { 6 $.notiny.addTheme('wooac', { 7 notification_class: 'notiny-theme-wooac', 8 }); 9 } 10 11 // Auto show 12 if ((wooac_vars.added_to_cart === 'yes') && (wooac_vars.show_normal === 'yes')) { 13 setTimeout(function () { 14 wooac_show(); 15 }, parseInt(wooac_vars.delay)); 16 } 17 }); 18 19 $(document.body).on('click touch', wooac_vars.add_to_cart_button, function (e) { 20 if (wooac_vars.show_adding === 'yes') { 21 var $btn = $(this); 22 var product_name = $btn.closest(wooac_vars.archive_product).find(wooac_vars.archive_product_name).eq(0).text(); 23 var product_image = $btn.closest(wooac_vars.archive_product).find(wooac_vars.archive_product_image).eq(0).attr('src'); 24 25 if ($btn.hasClass('single_add_to_cart_button') || $btn.is(wooac_vars.single_add_to_cart_button)) { 26 product_name = $btn.closest(wooac_vars.single_product).find(wooac_vars.single_product_name).eq(0).text(); 27 product_image = $btn.closest(wooac_vars.single_product).find(wooac_vars.single_product_image).eq(0).attr('src'); 28 } 29 30 $('.wooac-product-image').attr('src', product_image); 31 $('.wooac-product-name').html(product_name); 32 33 wooac_show_adding(); 34 } 35 }); 36 37 $(document.body).on('added_to_cart', function (e, fragments, cart_hash, $button) { 38 var silent = false; 39 40 if (wooac_vars.silent_button_class !== undefined && wooac_vars.silent_button_class !== '' && $button !== undefined) { 41 var silent_button_classes = wooac_vars.silent_button_class.split(','); 42 43 silent_button_classes.forEach((item) => { 44 var silent_button_class = item.replace('.', '').trim(); 45 46 if ($button.hasClass(silent_button_class)) { 47 silent = true; 48 return false; 49 } 50 }); 51 } 52 53 if (silent) { 54 return; 55 } 56 57 if (wooac_vars.style === 'notiny') { 58 $('.notiny-theme-wooac').remove(); 59 } else { 60 wooac_hide(); 61 } 62 63 if (wooac_vars.show_ajax === 'yes') { 64 setTimeout(function () { 65 wooac_show(); 66 }, parseInt(wooac_vars.delay)); 67 } 68 }); 69 70 $(document).on('click touch', '#wooac-continue', function (e) { 71 e.preventDefault(); 72 73 wooac_hide(); 74 75 var url = $(this).attr('data-url'); 76 77 if (url !== '') { 78 window.location.href = url; 79 } 80 }); 81 82 $(document).on('click touch', '.wooac-popup .woosq-btn', function (e) { 83 e.preventDefault(); 84 85 wooac_hide(); 86 }); 87})(jQuery); 88 89function wooac_show() { 90 if (jQuery.trim(jQuery('.wooac-wrapper').html()).length) { 91 jQuery('body').removeClass('wooac-show-adding'); 92 jQuery('body').addClass('wooac-show'); 93 94 if (wooac_vars.style === 'notiny') { 95 let notiny_image = jQuery('.wooac-notiny-added img').attr('src'); 96 let notiny_text = jQuery('.wooac-notiny-added').text(); 97 98 jQuery.notiny({ 99 theme: 'wooac', position: wooac_vars.notiny_position, image: notiny_image, text: notiny_text, 100 }); 101 } else { 102 jQuery.magnificPopup.open({ 103 items: { 104 src: jQuery('.wooac-popup-added'), type: 'inline', 105 }, mainClass: 'mfp-wooac', callbacks: { 106 beforeOpen: function () { 107 this.st.mainClass = 'mfp-wooac ' + wooac_vars.effect; 108 109 wooac_suggested_unslick(); 110 wooac_upsell_funnel_unslick(); 111 }, open: function () { 112 if (parseInt(wooac_vars.close) > 0) { 113 setTimeout(function () { 114 jQuery('.wooac-popup-added').magnificPopup('close'); 115 }, parseInt(wooac_vars.close)); 116 } 117 118 wooac_suggested_slick(); 119 wooac_upsell_funnel_slick(); 120 121 if (wooac_vars.confetti) { 122 wooac_confetti(); 123 } 124 }, afterClose: function () { 125 jQuery('body').removeClass('wooac-show'); 126 }, 127 }, 128 }); 129 } 130 131 jQuery(document.body).trigger('wooac_show'); 132 } 133} 134 135function wooac_hide() { 136 jQuery('body').removeClass('wooac-show-adding'); 137 jQuery('body').removeClass('wooac-show'); 138 jQuery.magnificPopup.close(); 139 jQuery(document.body).trigger('wooac_hide'); 140} 141 142function wooac_show_adding() { 143 jQuery('body').addClass('wooac-show-adding'); 144 145 if (wooac_vars.style === 'notiny') { 146 let notiny_image = jQuery('.wooac-notiny-adding img').attr('src'); 147 let notiny_text = jQuery('.wooac-notiny-adding').text(); 148 149 jQuery.notiny({ 150 theme: 'wooac', 151 position: wooac_vars.notiny_position, 152 image: notiny_image, 153 text: notiny_text, 154 autohide: false, 155 }); 156 } else { 157 jQuery.magnificPopup.open({ 158 items: { 159 src: '.wooac-popup-adding', type: 'inline', 160 }, mainClass: 'mfp-wooac', callbacks: { 161 beforeOpen: function () { 162 this.st.mainClass = 'mfp-wooac ' + wooac_vars.effect; 163 }, 164 }, 165 }); 166 } 167 168 jQuery(document.body).trigger('wooac_show_adding'); 169} 170 171function wooac_suggested_unslick() { 172 if (wooac_vars.suggested_carousel && (jQuery('.wooac-popup .wooac-suggested-product').length > 1) && jQuery('.wooac-popup .wooac-suggested-products').hasClass('slick-initialized')) { 173 jQuery('.wooac-popup .wooac-suggested-products').slick('unslick'); 174 } 175} 176 177function wooac_suggested_slick() { 178 if (wooac_vars.suggested_carousel && (jQuery('.wooac-popup .wooac-suggested-product').length > 1)) { 179 jQuery('.wooac-popup .wooac-suggested-products').slick(JSON.parse(wooac_vars.slick_params)); 180 } 181} 182 183function wooac_upsell_funnel_unslick() { 184 if (wooac_vars.upsell_funnel_carousel && (jQuery('.wooac-popup .wpcuf-uf-product').length > 1) && jQuery('.wooac-popup .wpcuf-uf-products').hasClass('slick-initialized')) { 185 jQuery('.wooac-popup .wooac-suggested-products').slick('unslick'); 186 } 187} 188 189function wooac_upsell_funnel_slick() { 190 if (wooac_vars.upsell_funnel_carousel && (jQuery('.wooac-popup .wpcuf-uf-product').length > 1)) { 191 jQuery('.wooac-popup .wpcuf-uf-products').slick(JSON.parse(wooac_vars.slick_params)); 192 } 193} 194 195function wooac_confetti(id = 'wooac-canvas') { 196 var canvas = document.getElementById(id); 197 198 canvas.confetti = canvas.confetti || confetti.create(canvas, {resize: true}); 199 200 if (wooac_vars.confetti_params !== undefined) { 201 canvas.confetti(wooac_vars.confetti_params); 202 } else { 203 canvas.confetti(); 204 } 205}
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.