1jQuery(document).ready(function($) { 2 /** 3 * Notices in checkout 4 */ 5 $( document.body ).on( 'updated_checkout', function() { 6 var noticesEl = $( '#wcs-notices-pending' ); 7 8 if ( noticesEl.length > 0 ) { 9 // Clear existing notices 10 $( '#wcs-notices' ).remove(); 11 12 var shippingRow = $( 'tr.woocommerce-shipping-totals td:eq(0)' ); 13 14 if ( shippingRow.length > 0 ) { 15 shippingRow.append( noticesEl ); 16 noticesEl.css( 'display', 'block' ).attr( 'id', 'wcs-notices' ); 17 } 18 } 19 } ); 20 21 /** 22 * Notices in cart 23 */ 24 $( document.body ).on( 'wcs_updated_cart', function() { 25 var noticesEl = $( '#wcs-notices-pending' ); 26 27 if ( noticesEl.length > 0 ) { 28 // Clear existing notices 29 $( '#wcs-notices' ).remove(); 30 31 var shippingRow = $( 'tr.woocommerce-shipping-totals td:eq(0)' ); 32 33 if ( shippingRow.length > 0 ) { 34 shippingRow.append( noticesEl ); 35 noticesEl.css( 'display', 'block' ).attr( 'id', 'wcs-notices' ); 36 } 37 } 38 } ); 39 $( document.body ).trigger( 'wcs_updated_cart' ); 40 $( document.body ).on( 'updated_cart_totals', function() { 41 $( document.body ).trigger( 'wcs_updated_cart' ); 42 } ); 43 44 45 var wcsDebug = { 46 init: function() { 47 this.toggleDebug(); 48 this.setInitial(); 49 50 var self = this; 51 $( document.body ).on( 'updated_checkout', function( data ) { 52 self.setInitial(); 53 } ); 54 }, 55 56 /** 57 * Toggle debug on click 58 */ 59 toggleDebug: function() { 60 var self = this; 61 62 $( document.body ).on( 'click', '#wcs-debug-header', function( e ) { 63 if ( $( '#wcs-debug-contents' ).is( ':visible' ) ) { 64 $( '#wcs-debug' ).toggleClass( 'closed', true ); 65 } else { 66 $( '#wcs-debug' ).toggleClass( 'closed', false ); 67 } 68 69 $( '#wcs-debug-contents' ).slideToggle( 200, function() { 70 self.saveStatus(); 71 } ); 72 } ); 73 }, 74 75 /** 76 * Save debug open / closed status to cookies 77 */ 78 saveStatus: function() { 79 if ( typeof Cookies == 'undefined' ) { 80 return; 81 } 82 83 Cookies.set( 'wcs_debug_status', $( '#wcs-debug-contents' ).is( ':visible' ) ); 84 }, 85 86 /** 87 * Set initial stage for debug 88 */ 89 setInitial: function() { 90 if ( typeof Cookies == 'undefined' ) { 91 return; 92 } 93 94 var status = Cookies.get( 'wcs_debug_status' ); 95 96 $( '#wcs-debug-contents' ).toggle( status === 'true' ); 97 $( '#wcs-debug' ).toggleClass( 'closed', $( '#wcs-debug-contents' ).is( ':hidden' ) ); 98 } 99 } 100 101 wcsDebug.init(); 102});
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.