1jQuery(document).ready(function(){ 2 3 jQuery(document.body).on("updated_checkout",async function(){ 4 console.clear(); 5 await getUspsDebugLogs(); 6 }); 7 8 jQuery(document.body).on("updated_cart_totals",async function(){ 9 console.clear(); 10 await getUspsDebugLogs(); 11 }); 12 13 14 if(window?.wp?.data?.select('wc/store/cart')?.getCartData()){ 15 16 localStorage.setItem('elex-usps-debug-data',JSON.stringify(wp.data.select('wc/store/cart').getCartData())); 17 18 wp.data.subscribe(async () =>{ 19 20 if( 21 localStorage.getItem('elex-usps-debug-data') !== JSON.stringify(wp.data.select('wc/store/cart').getCartData()) 22 ){ 23 await getUspsDebugLogs(); 24 } 25 26 localStorage.setItem('elex-usps-debug-data',JSON.stringify(wp.data.select('wc/store/cart').getCartData())); 27 28 29 }); 30 31 } 32 33}); 34 35async function getUspsDebugLogs(){ 36 37 const response = await jQuery.ajax({ 38 type: "get", 39 url: elex_usps_console.ajax_url, 40 data:{ 41 action: "elex_usps_get_debug_logs", 42 _ajax_nonce: elex_usps_console.nonce, 43 }, 44 dataType: "json", 45 }); 46 if(response?.success && response?.data){ 47 const responseData =response?.data; 48 if(responseData?.elex_usps_debug_logs){ 49 console.log( 50 responseData?.elex_usps_debug_logs 51 ?.replaceAll("%colored_text_start%", "%c") 52 ?.replaceAll("%colored_text_end%", "%c"), 53 responseData?.elex_usps_debug_logs?.includes("%colored_text_start%") 54 ? "color: red" 55 : "", 56 responseData?.elex_usps_debug_logs?.includes("%colored_text_end%") 57 ? "color: initial" 58 : "" 59 ) 60 } 61 62 } 63}
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.