Page MenuHomeWickedGov Phorge

ext.dismissableSiteNotice.js
No OneTemporary

Size
931 B
Referenced Files
None
Subscribers
None

ext.dismissableSiteNotice.js

( function () {
var 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.
$( function () {
// 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
Sat, Oct 3, 05:15 (2 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8b/2b/57904f6a22ecd7d4f6912226d4c8
Default Alt Text
ext.dismissableSiteNotice.js (931 B)

Event Timeline