PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/bettingbin.com/wp-content/plugins/jetpack_bkp/modules/scan/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/bettingbin.com/wp-content/plugins/jetpack_bkp/modules/scan/admin-bar-notice.js

( function ( localized ) {
	function ready( fn ) {
		if ( document.readyState != 'loading' ) {
			fn();
		} else {
			document.addEventListener( 'DOMContentLoaded', fn );
		}
	}

	function fetch_scan_treats_and_add_link() {
		var xhrRequest = new XMLHttpRequest();
		xhrRequest.open( 'GET', localized.scan_endpoint, true );
		xhrRequest.onload = function () {
			if ( this.status == 200 ) {
				// Success!
				var body = JSON.parse( this.response );
				if ( body && body.data ) {
					var apiResponse = JSON.parse( body.data );
					var numberOfThreats =
						apiResponse.threats && apiResponse.threats.length ? apiResponse.threats.length : 0;
					update_threats_link( numberOfThreats );
				} else {
					update_threats_link( 0 );
				}
			} else {
				update_threats_link( 0 );
			}
		};
		xhrRequest.setRequestHeader( 'X-WP-Nonce', localized.nonce );
		xhrRequest.send();
	}

	ready( function () {
		fetch_scan_treats_and_add_link();
	} );

	function update_threats_link( numberOfThreats ) {
		var element = document.getElementById( 'wp-admin-bar-jetpack-scan-notice' );
		if ( ! element ) {
			return;
		}

		if ( ! numberOfThreats ) {
			element.parentNode.removeChild( element );
			return;
		}

		var textLabel = numberOfThreats == 1 ? localized.singular : localized.multiple;
		element.innerHTML =
			'<a href="' + localized.scan_dashboard_url + '" class="ab-item">' + textLabel + '</a>';
	}
} )( window.Jetpack_Scan );