Page MenuHomeWickedGov Phorge

ext.dismissableSiteNotice.js
No OneTemporary

Size
927 B
Referenced Files
None
Subscribers
None

ext.dismissableSiteNotice.js

( function () {
const cookieName = 'dismissSiteNotice',
siteNoticeId = mw.config.get( 'wgSiteNoticeId' );
// If no siteNoticeId is set, exit.
if ( !siteNoticeId ) {
return;
}
// If the user has the notice dismissal cookie set, exit.
if ( $.cookie( cookieName ) === siteNoticeId ) {
return;
}
// Otherwise, show the notice ...
mw.util.addCSS( '.client-js .mw-dismissable-notice { display: block; }' );
// ... and enable the dismiss button.
$( () => {
// eslint-disable-next-line no-jquery/no-global-selector
$( '.mw-dismissable-notice-close' )
.css( 'visibility', 'visible' )
.find( 'a' )
.on( 'click keypress', function ( e ) {
if (
e.type === 'click' ||
e.type === 'keypress' && e.which === 13
) {
$( this ).closest( '.mw-dismissable-notice' ).hide();
$.cookie( cookieName, siteNoticeId, {
expires: 30,
path: '/'
} );
}
} );
} );
}() );

File Metadata

Mime Type
text/plain
Expires
Aug 16 2026, 03:38 (12 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
54/b4/00f12a6580bbdc0d5c1c99780856
Default Alt Text
ext.dismissableSiteNotice.js (927 B)

Event Timeline