HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/triad-infosec/wp-content/plugins/genesis-blocks/dist/assets/js/dismiss.js
/**
 * Handles dismissible notices from the Notice block.
 */

/**
 * IE 11 polyfill for Nodelist.forEach.
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
 */
if ( window.NodeList && ! NodeList.prototype.forEach ) {
	NodeList.prototype.forEach = Array.prototype.forEach;
}

document.addEventListener( 'DOMContentLoaded', function() {
	var notices = document.querySelectorAll(
		'.gb-block-notice.gb-dismissable[data-id]'
	);

	notices.forEach( function( element ) {
		var uid = element.getAttribute( 'data-id' );

		var dismissible = element.querySelector( '.gb-notice-dismiss' );

		if ( ! localStorage.getItem( 'notice-' + uid ) ) {
			element.style.display = 'block';
		}

		if ( dismissible ) {
			dismissible.addEventListener( 'click', function( event ) {
				event.preventDefault();
				localStorage.setItem( 'notice-' + uid, '1' );
				element.style.display = '';
			} );
		}
	} );
} );