1jQuery(document).ready(function ($) { 2 3 var $wdpTable = $('.wdp_table '); 4 var $dynamicPricing = awdajaxobject.dynamicPricing; 5 var $variablePricing = awdajaxobject.variablePricing; 6 7 // Shortcode Listing Page Carousel 8 $('.wdp-carousel').owlCarousel({ 9 loop: false, 10 margin: 10, 11 dots: true, 12 nav: false, 13 responsiveClass: true, 14 responsive: { 15 0: { 16 items:1, 17 nav:true 18 }, 19 600: { 20 items:2 21 }, 22 800: { 23 items:3 24 }, 25 1000: { 26 items:4 27 } 28 } 29 }); 30 $('.wdp-slider').owlCarousel({ 31 loop: false, 32 dots: true, 33 nav: false, 34 items: 1 35 }); 36 37 // Timer 38 function makeTimer() { 39 40 var selectedDate = $("#timer").data('time'); 41 // Format 25 December 2020 23:59:00 GMT+05:30 42 // Safari timer fix - pregreplace dateformat 43 var endTime = new Date(selectedDate.replace(/-/g, "/")); 44 endTime = (Date.parse(endTime) / 1000); 45 46 var now = new Date(); 47 now = (Date.parse(now) / 1000); 48 49 var timeLeft = endTime - now; 50 51 var days = Math.floor(timeLeft / 86400); 52 var hours = Math.floor((timeLeft - (days * 86400)) / 3600); 53 var minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60); 54 var seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60))); 55 56 var label_days = $("#days").data('label'); 57 var label_hrs = $("#hours").data('label'); 58 var label_mins = $("#minutes").data('label'); 59 var label_secs = $("#seconds").data('label'); 60 61 if (hours < "10") { hours = "0" + hours; } 62 if (minutes < "10") { minutes = "0" + minutes; } 63 if (seconds < "10") { seconds = "0" + seconds; } 64 65 $("#days").html(days + "<span>"+label_days+"</span>"); 66 $("#hours").html(hours + "<span>"+label_hrs+"</span>"); 67 $("#minutes").html(minutes + "<span>"+label_mins+"</span>"); 68 $("#seconds").html(seconds + "<span>"+label_secs+"</span>"); 69 70 } 71 72 // checking if timer is enabled 73 if ( $("#timer").length > 0 ) { 74 setInterval(function() { makeTimer(); }, 1000); 75 } 76 77 //Refresh Cart on Payment Mode Change 78 $( document.body ).on( 'change', 'input[name="payment_method"], input.shipping_method', function (e) { 79 let data = { 80 'action': 'awdpschange', 81 'nonce': awdajaxobject.nonce, 82 'awbcompvalue': e.target.value, 83 'awbcompname': e.target.name 84 }; 85 $.post(awdajaxobject.url, data, function(response) { $( 'body' ).trigger( 'update_checkout' ); }); 86 }); 87 88 if ( typeof wp.hooks !== 'undefined' ) { 89 // wp.hooks.addFilter('wcpa_product_price', 'wcpa', (productPrice, product_id, variation_id) => { 90 // $.ajax({ url: awdajaxobject.url, data: {action: 'wdpDiscountedPrice', prodID: product_id, varID: variation_id} }).done(function(data) { 91 // productPrice = data ? data : productPrice; 92 // return productPrice; 93 // }).fail(function(data){ 94 // return productPrice; 95 // }); 96 // }, 10); 97 // document.dispatchEvent(new Event("wcpaTrigger", {bubbles: true})); 98 // $( '.variations_form' ).on( 'woocommerce_variation_select_change', function() { 99 // wp.hooks.addFilter('wcpa_product_price', 'wcpa', (productPrice, product_id, variation_id) => { 100 // $.ajax({ url: awdajaxobject.url, data: {action: 'wdpDiscountedPrice', prodID: product_id, varID: variation_id} }).done(function(data) { 101 // productPrice = data ? data : productPrice; 102 // return productPrice; 103 // }).fail(function(data){ 104 // return productPrice; 105 // }); 106 // }, 10); 107 // document.dispatchEvent(new Event("wcpaTrigger", {bubbles: true})); 108 // }); 109 // // $('form.cart').find('[name=quantity]').on('change input', function(){ 110 // // let qn = $(this).parents('form.cart').find('input[name="quantity"]').val(); 111 // // wp.hooks.addFilter('wcpa_product_price', 'wcpa', (productPrice, product_id, variation_id) => { 112 // // $.ajax({ url: awdajaxobject.url, data: {action: 'wdpDiscountedPrice', prodID: product_id, varID: variation_id} }).done(function(data) { 113 // // productPrice = data ? qn * data : qn * productPrice; 114 // // return productPrice; 115 // // }).fail(function(data){ 116 // // return qn * productPrice; 117 // // }); 118 // // }, 10); 119 // // document.dispatchEvent(new Event("wcpaTrigger", {bubbles: true})); 120 // // }); 121 122 $('form.cart').find('[name=quantity]').on('change input', function() { 123 let qnty = $(this).parents('form.cart').find('input[name="quantity"]').val(); 124 let product_id = $(this).parents('form.cart').find('button[name="add-to-cart"]').val(); 125 let variation_id = $(this).parents('form.cart').find('input[name="variation_id"]').val(); 126 $.ajax({ 127 dataType : "json", 128 url : awdajaxobject.url, 129 data : {action: 'wdpDynamicDiscount', 130 prodID: product_id, 131 varID: variation_id, 132 proCount: qnty }, 133 success: function(response) { 134 function modifyProductPrice() { 135 return response; 136 } 137 wp.hooks.addFilter('wcpa_product_price', 'wcpa', modifyProductPrice,
13710); 138 document.dispatchEvent(new Event("wcpaTrigger", {bubbles: true})); 139 } 140 }); 141 }); 142 } 143 144 if ( $wdpTable.length > 0 ) { 145 146 if ( $variablePricing ) { 147 $( ".single_variation_wrap" ).on( "show_variation", function ( event, variation ) { 148 let attributes = variation.attributes; 149 let price = variation.display_price; 150 let price_html = variation.price_html; 151 let variation_id = variation.variation_id; 152 let loader = '<div class="wdpLoader"><span></span><span></span><span></span></div>'; 153 $wdpTable.find('tbody td').html(loader); 154 $('.wdpHiddenPrice').html(price_html); // hidden variation price 155 let varPrice = $('.wdpHiddenPrice del').length ? $('.wdpHiddenPrice ins .amount').text() : $('.wdpHiddenPrice .amount').text(); 156 varPrice = varPrice ? varPrice.replace(/[^\d\.]/g, '') : price; 157 let data = { 158 'action': 'wdpAjax', 159 'nonce': awdajaxobject.nonce, 160 'type': 'change', 161 'attributes': attributes, 162 'price': varPrice, 163 'variation_id': variation_id, 164 'DisData': $wdpTable.attr('data-table'), 165 'Rule': $wdpTable.attr('data-rule'), 166 } 167 $.post(awdajaxobject.url, data, function(response) { 168 if ( response ) { 169 $wdpTable.attr('data-price', varPrice); 170 $wdpTable.find('tbody').html(response); 171 } 172 }); 173 }); 174 } 175 176 if ( $dynamicPricing ) { 177 let loader = '<div class="wdpLoader"><span></span><span></span><span></span></div>'; 178 $('form.cart').find('[name=quantity]').on('change input', function(){ 179 if ( $wdpTable.attr('data-product') === '' ) { return; } 180 let data = { 181 'action': 'wdpAjax', 182 'nonce': awdajaxobject.nonce, 183 'ProdID': $wdpTable.attr('data-product'), 184 'DisData': $wdpTable.attr('data-table'), 185 'ProdPrice': $wdpTable.attr('data-price'), 186 'ProdVarPrice': $wdpTable.attr('data-var-price'), 187 'ProdQty': $(this).parents('form.cart').find('input[name="quantity"]').val() 188 }; 189 $(".wdpDynamicValue .wdpPrice").html(loader); 190 $(".wdpDynamicValue .wdpTotal").html(loader); 191 $.post(awdajaxobject.url, data, function(response) { 192 if ( response ) { 193 response = JSON.parse(response); 194 // $(".wdpDynamicValue .wdpPrice").removeClass('wdpLoader'); 195 // $(".wdpDynamicValue .wdpTotal").removeClass('wdpLoader'); 196 $(".wdpDynamicValue .wdpPrice").html(response.currency + response.price); 197 $(".wdpDynamicValue .wdpTotal").html(response.currency + response.total); 198 $(".wdpDynamicValue").show(); 199 } 200 }); 201 }); 202 } 203 204 } 205 206});
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.