1console.log('before asl_init'); 2//document.addEventListener('DOMContentLoaded', asl_init ); 3asl_init(); 4 5function asl_init() { 6 7 console.log( 'asl_init' ); 8 const _currentCartHash = asl_getCookie('woocommerce_cart_hash').toString().toLowerCase(); 9 const _previousCartHash = ( localStorage.getItem('_previousCartHash') ?? 'false' ).toLowerCase(); 10 11 console.log( _currentCartHash, _previousCartHash, _currentCartHash === _previousCartHash ); 12 // Update the stored cart hash value 13 localStorage.setItem('_previousCartHash', _currentCartHash ); 14 15 if ( _currentCartHash === false 16 || ( _currentCartHash === _previousCartHash ) ) { 17 18 asl_interceptXHR(); 19 } 20} 21function asl_getCookie( _name ) { 22 23 const _value = `; ${document.cookie}`; 24//console.log( 'asl_getCookie ' + _value ); 25 const _parts = _value.split(`; ${_name}=`); 26 return (_parts.length === 2) ? 27 _parts.pop().split(';').shift() : 28 false; 29} 30 31function asl_interceptXHR() { 32 33 //console.log('asl_interceptXHR'); 34 const _send = XMLHttpRequest.prototype.send; 35 XMLHttpRequest.prototype.send = function( p_data ) { 36 37 //console.log( p_data ); 38//console.log( ' --- ' ); 39 //console.log( this ); 40 if ( ( typeof p_data === 'string' ) 41 && p_data.includes( 'action=adscale/ajaxGetCart' ) 42 //_body.get('action') === 'adscale/ajaxGetCart' 43 ) { 44 console.log('Blocked XHR: adscale/ajaxGetCart'); 45 // Implement your blocking logic here, or modify the request as needed 46 return; // This line blocks the request 47 } 48 _send.apply( this, arguments ); 49 }; 50}
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.