1// JavaScript Document 2function insertParam(key, value) 3{ 4 key = encodeURI(key); value = encodeURI(value); 5 6 var kvp = document.location.search.substr(1).split('&'); 7 8 var i=kvp.length; var x; while(i--) 9 { 10 x = kvp[i].split('='); 11 12 if (x[0]==key) 13 { 14 x[1] = value; 15 kvp[i] = x.join('='); 16 break; 17 } 18 } 19 20 if(i<0) {kvp[kvp.length] = [key,value].join('=');} 21 22 //this will reload the page, it's likely better to store this until finished 23 document.location.search = kvp.join('&'); 24} 25function wc_os_trigger_permission_for_spit($, internal){ 26 27 var wc_os_customer_permitted = $('#wc_os_customer_permitted').prop('checked') ? 'on' : 'off'; 28 29 if(wc_os_customer_permitted=='on'){ 30 if($('.wc_os_review_order').length>0){ 31 $('.wc_os_review_order').show(); 32 }else{ 33 34 if(wos_obj.wc_os_packages_overview == 'on'){ 35 setTimeout(function(){ document.location.reload(); }, 1000); 36 } 37 38 } 39 }else{ 40 $('.wc_os_review_order').hide(); 41 } 42 43 44 var total_shipping_cost = (wc_os_customer_permitted == 'on' ? wos_obj.total_shipping_cost : 0); 45 46 var data = { 47 action : 'wc_os_customer_permitted_method', 48 wc_os_customer_permitted_nonce: wos_obj.wc_os_customer_permitted_nonce, 49 wc_os_customer_permitted : wc_os_customer_permitted, 50 total_shipping_cost: total_shipping_cost, 51 } 52 53 $(this).prop('disabled', true); 54 55 $.post(wos_obj.ajax_url, data, function(response){ 56 57 $(this).prop('disabled', false); 58 59 var resp = $.parseJSON(response); 60 61 if($('tr.fee td').length>0){ 62 $('tr.fee').eq(0).find('td').html(resp.fee); 63 } 64 if($('tr.order-total td').length>0 && $.trim(resp.total)!=''){ 65 $('tr.order-total td').html(resp.total); 66 } 67 68 //$('tr.fee').show(); 69 70 //console.log(0); 71 72 if(!internal){ 73 74 if( 75 $('.woocommerce-checkout-review-order-table .woocommerce-shipping-totals').length>0 76 || 77 $('.woocommerce-checkout-review-order-table tr.fee').length>0 78 ){ 79 //console.log(1); 80 if(wos_obj.wc_os_shipping_methods==1){ 81 //console.log(2); 82 83 if(wc_os_customer_permitted=='on'){ 84 //console.log(3); 85 $('tr.fee').show(); 86 //if($('.woocommerce-checkout-review-order-table tr.fee').length==0){ document.location.reload(); } 87 }else{ 88 //console.log(4); 89 $('tr.fee').hide(); 90 //if($('.woocommerce-checkout-review-order-table .woocommerce-shipping-totals').length==0){ document.location.reload(); } 91 } 92 93 document.location.reload(); 94 } 95 }else{ 96 97 98 99 } 100 } 101 102 }); 103 104 if(wc_os_customer_permitted=='on'){ 105 106 if($('.wc_os_review_order').length>0){ 107 $('.woocommerce-checkout-review-order-table').find('thead, tbody').hide(); 108 } 109 //$('.wc_os_review_order').show(); 110 //console.log(wos_obj.chosen_shipping_method); 111 if(wos_obj.chosen_shipping_method!=''){ 112 var input_obj = $('input[value="'+wos_obj.chosen_shipping_method+'"]'); 113 114 // if(!input_obj.is(':checked')){ document.location.reload(); } 115 116 var input_label = input_obj.parent().find('label'); 117 if(input_label.length>0){ 118 var shipping_cost = $('.wc_os_update_shipping_cost').html(); 119 //input_label.find('span').html(shipping_cost); 120 } 121 //shipping_method_0_lpc_sign 122 //shipping_method_0_lpc_relay 123 } 124 }else{ 125 //$('.wc_os_review_order').hide(); 126 $('.woocommerce-checkout-review-order-table').find('thead, tbody').show(); 127 128 } 129 130} 131jQuery(document).ready(function($){ 132 133 134 135 setTimeout(function(){ 136 if($('.woocommerce-order-details').length>0 && wos_obj.posted==0){ 137 if($('.woocommerce-order-details').length>0){ 138 $('.woocommerce-order-details').eq(0).insertAfter($('.woocommerce-order-details').eq(1)); 139 } 140 if(window.location.search.indexOf('refreshed') > -1){ 141 }else{ 142 if(wos_obj.orders_page_refresh=='true'){ 143 insertParam('refreshed', 'true'); 144 } 145 } 146 } 147 148 }, 500); 149 150 $('body').on('click', '#wc_os_customer_permitted', function(){ 151 wc_os_trigger_permission_for_spit($, false); 152 }); 153 154 if(wos_obj.is_checkout==true){ 155 156 setTimeout(function(){ 157 //$('#nasa-before-load').remove(); 158 if($('#wc_os_customer_permitted').length>0){ 159 // $('#wc_os_customer_permitted').click().delay(1000).click(); 160 if(wos_obj.wc_os_customer_permitted == 'on'){ 161 //$('#wc_os_customer_permitted').trigger('click');//.delay(1000).click(); 162 //wc_os_trigger_permission_for_spit($, false); 163 wc_os_trigger_permission_for_spit($, true); //23/10/2020 164 } 165 } 166 }, 1000); 167
168 var wocp1 = setInterval(function(){ 169 if($('.wc_os_customer_permission').length>1){ 170 $('.wc_os_customer_permission').eq(0).remove(); 171 wc_os_trigger_permission_for_spit($, true); 172 //clearInterval(wocp1); 173 //console.log('wocp1: '+wocp1); 174 } 175 if($('tr.fee').eq(1).length>0){ 176 $('tr.fee').eq(1).remove(); 177 } 178 179 180 }, 500); 181 182 var wocp2 = setInterval(function(){ 183 if($('.wc_os_review_order').length>1){ 184 $('.wc_os_review_order').eq(0).remove(); 185 //clearInterval(wocp2); 186 //console.log('wocp2: '+wocp2); 187 } 188 189 190 }, 500); 191 192 $( 'form.checkout' ).on( 'change', 'input[name^="payment_method"]', function() { 193 $('body').trigger('update_checkout'); 194 }); 195 196 } 197 198 if($(".wos_notice_div.wos_product").length>1){ 199 $(".wos_notice_div.wos_product").eq(0).remove(); 200 } 201 202 if($(".wos_notice_div.wos_product").length>0){ 203 $(".wos_notice_div.wos_product").eq(0).show(); 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.