MediaWiki:Common.js/WatchlistNotice.js

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/*
 *  Description: Hide the watchlist message for one week.
 *  Maintainers: [[w:User:Ruud Koot|Ruud Koot]]
 *  Updated by:  [[User:Darklama|darklama]]
 */
 
function addDismissButton() {
	var $watchlistMessage = $('#watchlist-message');
 
	if ( !$watchlistMessage.length ) return;
	if ( $.cookie('hidewatchlistmessage') === 'yes' ) {
		$watchlistMessage.hide();
		return;
	}
 
	$('<span>[<a id="dismissButton" title="Hide this message for one week">dismiss</a>]</span>')
		.appendTo( $watchlistMessage )
		.click( function() {
			$.cookie('hidewatchlistmessage', 'yes', { 'expires': 7, 'path': '/' });
			$watchlistMessage.hide();
		});
}
 
if ( mw.config.get('wgCanonicalSpecialPageName') === 'Watchlist') $(document).ready( addDismissButton );