/*
JS enhancements, events etc for Widget:Sitenotice
See detailed documentation in Dev/mediawiki
*/

(function () {
	
	
	// =============================
	// A : All Banners Functionality
	
	
	// -----
	// Setup
	
	// Check if there is an active banner that is not blocked by the user, if so append Close-Button
	
	if( $('#siteNotice .banner').length > 0 ) {
		$('#siteNotice .sitenotice-body').prepend( $( `
			<div class="sitenotice-close" title="Hide this notice for me">
				<img src="/w/images/thumb/0/0b/End-of-year-times.png/28px-End-of-year-times.png" with="14" height="14" alt="close" />
			</div>
		`));
		$('#siteNotice .sitenotice-body .sitenotice-close').hide().fadeIn();
	}
	
	// ------
	// Events

	$('#siteNotice .sitenotice-close').on( 'click', function() {
		if( $('#siteNotice .banner').length > 0 ) {
			Cookies.set( 'ctbc_hide-sitenotice-' + $('#siteNotice .sitenotice-body').attr( 'data-sitenotice-id' ), 'true', { expires: 30, sameSite: 'strict' } );
			$('#siteNotice').hide();
		}
	});
	
	
	// ================================
	// B : Custom Banners Functionality
	
	
})();

/*
[[Category:MultiWiki]]
*/