<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-watchlist-notice-core.js</id>
	<title>MediaWiki:Gadget-watchlist-notice-core.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-watchlist-notice-core.js"/>
	<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=MediaWiki:Gadget-watchlist-notice-core.js&amp;action=history"/>
	<updated>2026-04-08T01:38:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=MediaWiki:Gadget-watchlist-notice-core.js&amp;diff=10056&amp;oldid=prev</id>
		<title>Caleb Cooper: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=MediaWiki:Gadget-watchlist-notice-core.js&amp;diff=10056&amp;oldid=prev"/>
		<updated>2020-01-28T15:04:23Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:04, 28 January 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=MediaWiki:Gadget-watchlist-notice-core.js&amp;diff=10055&amp;oldid=prev</id>
		<title>powerstorewiki&gt;Caleb Cooper: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=MediaWiki:Gadget-watchlist-notice-core.js&amp;diff=10055&amp;oldid=prev"/>
		<updated>2020-01-21T18:20:56Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/**&lt;br /&gt;
 * Add dismiss buttons to watchlist-message, then unhide it&lt;br /&gt;
 * Allows multiple dismiss buttons on [[MediaWiki:Watchlist-messages]] with bumpable cookie IDs (now used for LS).&lt;br /&gt;
 * Note: HTML is backwards compatible with old version, new version ignores old syntax, except for dismissed IDs.&lt;br /&gt;
 * @author: [[:en:User:Ruud Koot]]&lt;br /&gt;
 * @author: [[:en:User:MZMcBride]]&lt;br /&gt;
 */&lt;br /&gt;
/*jslint white: true, regexp: true */&lt;br /&gt;
/*global jQuery, mediaWiki */&lt;br /&gt;
( function ( mw, $ ) {&lt;br /&gt;
&amp;#039;use strict&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
var storageKey = &amp;#039;hidewatchlistmessages&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
function getDismissedNotices () {&lt;br /&gt;
	var hiddenNotices = mw.storage.get( storageKey )&lt;br /&gt;
		|| mw.storage.session.get( storageKey );&lt;br /&gt;
&lt;br /&gt;
	try {&lt;br /&gt;
		return JSON.parse( hiddenNotices ) || []; &lt;br /&gt;
	} catch (e) {&lt;br /&gt;
		return [];&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function saveDismissedNotices ( notices ) {&lt;br /&gt;
	notices = JSON.stringify( notices );&lt;br /&gt;
	mw.storage.set( storageKey, notices )&lt;br /&gt;
		|| mw.storage.session.set( storageKey, notices );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Remove ids which are no longer defined&lt;br /&gt;
function expungeOldNotices ( currentList ) {&lt;br /&gt;
	var dismissedNotices = getDismissedNotices(),&lt;br /&gt;
		originalLength = dismissedNotices.length;&lt;br /&gt;
	for ( var i = dismissedNotices.length - 1; i &amp;gt;= 0; i--) {&lt;br /&gt;
		if( !( dismissedNotices[i] in currentList ) ) {&lt;br /&gt;
			dismissedNotices.splice( i, 0 );&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	if( originalLength !== dismissedNotices.length ) {&lt;br /&gt;
		saveDismissedNotices( dismissedNotices );&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function dismissWatchlistMessage( event ) {&lt;br /&gt;
	var $message = $( this ).closest( &amp;#039;.watchlist-message&amp;#039; );&lt;br /&gt;
	var cid = $( this ).data( &amp;#039;watchlistMessage&amp;#039; ).cid;&lt;br /&gt;
	var notices = getDismissedNotices();&lt;br /&gt;
	&lt;br /&gt;
	$message.hide();&lt;br /&gt;
	&lt;br /&gt;
	notices.push( cid );&lt;br /&gt;
	saveDismissedNotices( notices );&lt;br /&gt;
	&lt;br /&gt;
	event.preventDefault();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function addDismissButton() {&lt;br /&gt;
	var watchItems = $( &amp;#039;div.watchlist-message&amp;#039; );&lt;br /&gt;
	var watchItemIds = [];&lt;br /&gt;
	var dismissedNotices = getDismissedNotices();&lt;br /&gt;
	var dismissedNoticesLength = dismissedNotices.length;&lt;br /&gt;
	&lt;br /&gt;
	if ( watchItems.length === 0) {&lt;br /&gt;
		watchItems = $( &amp;#039;li.watchlist-message&amp;#039; );&lt;br /&gt;
	}&lt;br /&gt;
	if ( watchItems.length === 0) {&lt;br /&gt;
		return;&lt;br /&gt;
	}&lt;br /&gt;
	for ( var i = 0; i &amp;lt; watchItems.length; i++ ) {&lt;br /&gt;
		var watchlistCookieID = parseInt( watchItems[i].className.replace( /.*cookie\-ID\_(\d*).*/ig, &amp;#039;$1&amp;#039; ) );&lt;br /&gt;
		if ( isNaN( watchlistCookieID ) ) {&lt;br /&gt;
			continue;&lt;br /&gt;
		}&lt;br /&gt;
		watchItemIds.push( watchlistCookieID );&lt;br /&gt;
		if ( dismissedNotices.indexOf( watchlistCookieID ) !== -1 ) {&lt;br /&gt;
			watchItems[i].style.display = &amp;#039;none&amp;#039;;&lt;br /&gt;
			continue;&lt;br /&gt;
		}&lt;br /&gt;
		var Button     = document.createElement( &amp;#039;span&amp;#039; );&lt;br /&gt;
		var ButtonLink = document.createElement( &amp;#039;a&amp;#039; );&lt;br /&gt;
		var ButtonText = document.createTextNode( &amp;#039;dismiss&amp;#039; );&lt;br /&gt;
		&lt;br /&gt;
		ButtonLink.className = &amp;#039;dismissButton&amp;#039;;&lt;br /&gt;
		ButtonLink.setAttribute( &amp;#039;href&amp;#039;, &amp;#039;#&amp;#039; );&lt;br /&gt;
		ButtonLink.setAttribute( &amp;#039;title&amp;#039;, &amp;#039;Hide this message&amp;#039; );&lt;br /&gt;
		ButtonLink.appendChild( ButtonText );&lt;br /&gt;
		$( ButtonLink ).data( &amp;#039;watchlistMessage&amp;#039;, {&lt;br /&gt;
			index: i,&lt;br /&gt;
			cid: watchlistCookieID&lt;br /&gt;
		} );&lt;br /&gt;
		$( ButtonLink ).click( dismissWatchlistMessage );&lt;br /&gt;
		&lt;br /&gt;
		Button.appendChild( document.createTextNode(&amp;#039; [&amp;#039; ) );&lt;br /&gt;
		Button.appendChild( ButtonLink );&lt;br /&gt;
		Button.appendChild( document.createTextNode( &amp;#039;]&amp;#039; ) );&lt;br /&gt;
		watchItems[i].appendChild( Button );&lt;br /&gt;
	}&lt;br /&gt;
	expungeOldNotices( watchItemIds );&lt;br /&gt;
	&lt;br /&gt;
	$( &amp;#039;#watchlist-message&amp;#039; ).show();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$( addDismissButton );&lt;br /&gt;
&lt;br /&gt;
}( mediaWiki, jQuery ) );&lt;/div&gt;</summary>
		<author><name>powerstorewiki&gt;Caleb Cooper</name></author>
	</entry>
</feed>