<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://eurovision.jobogamer.xyz/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-find-archived-section.js</id>
	<title>MediaWiki:Gadget-find-archived-section.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://eurovision.jobogamer.xyz/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-find-archived-section.js"/>
	<link rel="alternate" type="text/html" href="https://eurovision.jobogamer.xyz/index.php?title=MediaWiki:Gadget-find-archived-section.js&amp;action=history"/>
	<updated>2026-07-25T10:40:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.4</generator>
	<entry>
		<id>https://eurovision.jobogamer.xyz/index.php?title=MediaWiki:Gadget-find-archived-section.js&amp;diff=101&amp;oldid=prev</id>
		<title>Alfie: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://eurovision.jobogamer.xyz/index.php?title=MediaWiki:Gadget-find-archived-section.js&amp;diff=101&amp;oldid=prev"/>
		<updated>2026-03-19T09:58:27Z</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 05:58, 19 March 2026&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>Alfie</name></author>
	</entry>
	<entry>
		<id>https://eurovision.jobogamer.xyz/index.php?title=MediaWiki:Gadget-find-archived-section.js&amp;diff=100&amp;oldid=prev</id>
		<title>en&gt;Xaosflux: +case &quot;Wikipedia:Teahouse&quot;:</title>
		<link rel="alternate" type="text/html" href="https://eurovision.jobogamer.xyz/index.php?title=MediaWiki:Gadget-find-archived-section.js&amp;diff=100&amp;oldid=prev"/>
		<updated>2024-05-07T10:31:04Z</updated>

		<summary type="html">&lt;p&gt;+case &amp;quot;Wikipedia:Teahouse&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/**  _____________________________________________________________________________&lt;br /&gt;
 * |                                                                             |&lt;br /&gt;
 * |                    === WARNING: GLOBAL GADGET FILE ===                      |&lt;br /&gt;
 * |                  Changes to this page affect many users.                    |&lt;br /&gt;
 * | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |&lt;br /&gt;
 * |_____________________________________________________________________________|&lt;br /&gt;
 *&lt;br /&gt;
 * Gadget to navigate to an archived section after following its broken link.&lt;br /&gt;
 *&lt;br /&gt;
 * Author: SD0001&lt;br /&gt;
 * Documentation: [[User:SD0001/find-archived-section]]&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// START EDITING HERE FOR LOCALISATION&lt;br /&gt;
// Messages: translate these strings if porting to a non-English language wiki&lt;br /&gt;
mw.messages.set({&lt;br /&gt;
	&amp;quot;fas-finding&amp;quot;: &amp;#039;Looks like the discussion &amp;quot;$1&amp;quot; has been archived. Finding archived discussion...&amp;#039;,&lt;br /&gt;
	&amp;quot;fas-exact-match&amp;quot;: &amp;#039;Looks like the discussion &amp;quot;$1&amp;quot; has been archived. &amp;lt;b&amp;gt;&amp;lt;a href=&amp;quot;$2&amp;quot;&amp;gt;Click to see archived discussion&amp;lt;/a&amp;gt;&amp;lt;/b&amp;gt; &amp;lt;small&amp;gt;(&amp;lt;a href=&amp;quot;$3&amp;quot;&amp;gt;or search in archives&amp;lt;/a&amp;gt;)&amp;lt;/small&amp;gt;&amp;#039;,&lt;br /&gt;
	&amp;quot;fas-inexact-match&amp;quot;: &amp;#039;Looks like the discussion &amp;quot;$1&amp;quot; has been archived. &amp;lt;a href=&amp;quot;$2&amp;quot;&amp;gt;Click to search in archives&amp;lt;/a&amp;gt;.&amp;#039;,&lt;br /&gt;
	&amp;quot;fas-no-results&amp;quot;: &amp;#039;No search results found for section &amp;quot;$1&amp;quot; in archives. It may have been removed or renamed, or you may have followed a malformed link.&amp;#039;,&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
var config = {&lt;br /&gt;
	// Function to introduce arbitrary changes to prefix.&lt;br /&gt;
	// Used here as archive page names used for admin noticeboards on enwiki are unusual&lt;br /&gt;
	prefixNormaliser: function(prefix) {&lt;br /&gt;
		switch (prefix) {&lt;br /&gt;
			case &amp;quot;Wikipedia:Administrators&amp;#039; noticeboard/Incidents&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Administrators&amp;#039; noticeboard/IncidentArchive&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Administrators&amp;#039; noticeboard/Edit warring&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Administrators&amp;#039; noticeboard/3RRArchive&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Administrators&amp;#039; noticeboard&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Administrators&amp;#039; noticeboard/Archive&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk/Science&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives/Science&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk/Miscellaneous&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives/Miscellaneous&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk/Mathematics&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives/Mathematics&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk/Language&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives/Language&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk/Humanities&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives/Humanities&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk/Entertainment&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives/Entertainment&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk/Computing&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives/Computing&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Reference desk&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Reference desk/Archives&amp;quot;;&lt;br /&gt;
			case &amp;quot;Wikipedia:Teahouse&amp;quot;:&lt;br /&gt;
				return &amp;quot;Wikipedia:Teahouse/Questions&amp;quot;;&lt;br /&gt;
			default:&lt;br /&gt;
				return prefix;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
// STOP EDITING HERE FOR LOCALISATION&lt;br /&gt;
&lt;br /&gt;
$(function() {&lt;br /&gt;
&lt;br /&gt;
	var addsection = document.getElementById(&amp;#039;ca-addsection&amp;#039;);&lt;br /&gt;
	var correctNs = mw.config.get(&amp;#039;wgNamespaceNumber&amp;#039;) % 2 === 1 || mw.config.get(&amp;#039;wgNamespaceNumber&amp;#039;) === 4;&lt;br /&gt;
	var minerva = mw.config.get(&amp;#039;skin&amp;#039;) === &amp;#039;minerva&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	// Show only on discussion pages (pages with &amp;quot;add section&amp;quot; button)&lt;br /&gt;
	// On minerva skin (which doesn&amp;#039;t use the add section button) show on all talk &amp;amp; project space pages&lt;br /&gt;
	if (!addsection &amp;amp;&amp;amp; (!correctNs || !minerva)) {&lt;br /&gt;
		return;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	var sectionName = decodeURIComponent(&lt;br /&gt;
		window.location.hash.slice(1)  // to remove the leading #&lt;br /&gt;
			.replace(/_/g, &amp;#039; &amp;#039;)&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
	// For anchor-encoded (UTF-8 percent encoding but with % replaced by a period (.) ), try to undo the encoding.&lt;br /&gt;
	// For some strange reason, MediaWiki doesn&amp;#039;t encode . itself, because of this the encoding process isn&amp;#039;t&lt;br /&gt;
	// exactly reversible. But this should work for the vast majority of cases.&lt;br /&gt;
	var sectionNameDotDecoded = decodeURIComponent(sectionName.replace(/\.([0-9A-F]{2})/g, &amp;#039;%$1&amp;#039;));&lt;br /&gt;
&lt;br /&gt;
	if (!sectionName || // no section name in URL&lt;br /&gt;
		sectionName.indexOf(&amp;#039;/media/&amp;#039;) === 0 || // URLs used by MediaViewer&lt;br /&gt;
		/^c-/.test(sectionName) || //URLs used by DiscussionTools&lt;br /&gt;
		/^\d{12} /.test(sectionName) || // URLs used by convenientDiscussions&lt;br /&gt;
		/^noticeApplied-/.test(sectionName) || // URLs used by RedWarn&lt;br /&gt;
		document.getElementById(sectionName.replace(/ /g, &amp;#039;_&amp;#039;)) !== null) { // section exists on page&lt;br /&gt;
		return;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	var escapeQuotes = function(str) {&lt;br /&gt;
		return str.replace(/&amp;quot;/g, &amp;#039;\\&amp;quot;&amp;#039;);&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	$(&amp;#039;#mw-content-text&amp;#039;).before(&lt;br /&gt;
		$(&amp;#039;&amp;lt;div&amp;gt;&amp;#039;)&lt;br /&gt;
			.text(mw.msg(&amp;#039;fas-finding&amp;#039;, sectionName))&lt;br /&gt;
			.addClass(&amp;#039;archived-section-prompt&amp;#039;)&lt;br /&gt;
			.css({&lt;br /&gt;
				&amp;#039;font-size&amp;#039;: &amp;#039;90%&amp;#039;,&lt;br /&gt;
				&amp;#039;padding&amp;#039;: &amp;#039;0 0 10px 20px&amp;#039;&lt;br /&gt;
			})&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
	var prefix = mw.config.get(&amp;#039;wgPageName&amp;#039;).replace(/_/g, &amp;#039; &amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	// Apply normalisation for for admin noticeboards&lt;br /&gt;
	if (typeof config.prefixNormaliser === &amp;#039;function&amp;#039;) {&lt;br /&gt;
		prefix = config.prefixNormaliser(prefix);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	var searchQuery = sectionNameDotDecoded === sectionName ?&lt;br /&gt;
		&amp;#039;&amp;quot;&amp;#039; + escapeQuotes(sectionName) + &amp;#039;&amp;quot; prefix:&amp;quot;&amp;#039; + prefix + &amp;#039;&amp;quot;&amp;#039; :&lt;br /&gt;
		&amp;#039;&amp;quot;&amp;#039; + escapeQuotes(sectionName) + &amp;#039;&amp;quot; OR &amp;quot;&amp;#039; + escapeQuotes(sectionNameDotDecoded) + &amp;#039;&amp;quot; prefix:&amp;quot;&amp;#039; + prefix + &amp;#039;&amp;quot;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
	mw.loader.using([&amp;#039;mediawiki.util&amp;#039;, &amp;#039;mediawiki.api&amp;#039;]).then(function() {&lt;br /&gt;
&lt;br /&gt;
		return new mw.Api({&lt;br /&gt;
			ajax: { headers: { &amp;#039;Api-User-Agent&amp;#039;: &amp;#039;w:en:MediaWiki:Gadget-find-archived-section.js&amp;#039; } }&lt;br /&gt;
		}).get({&lt;br /&gt;
			action: &amp;#039;query&amp;#039;,&lt;br /&gt;
			list: &amp;#039;search&amp;#039;,&lt;br /&gt;
			srsearch: searchQuery,&lt;br /&gt;
			srprop: &amp;#039;sectiontitle&amp;#039;,&lt;br /&gt;
			srsort: &amp;#039;create_timestamp_desc&amp;#039;, // list more recent archives first&lt;br /&gt;
			srlimit: &amp;#039;20&amp;#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	}).then(function(json) {&lt;br /&gt;
		if (!json || !json.query || !json.query.search) {&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		var results = json.query.search;&lt;br /&gt;
		if (results.length === 0) {&lt;br /&gt;
			$(&amp;#039;.archived-section-prompt&amp;#039;).html(mw.msg(&amp;#039;fas-no-results&amp;#039;, mw.html.escape(sectionName)));&lt;br /&gt;
&lt;br /&gt;
		} else {&lt;br /&gt;
			var pageTitle,&lt;br /&gt;
				sectionNameFound; // will either be sectionName or sectionNameDotDecoded&lt;br /&gt;
&lt;br /&gt;
			// obtain the the first exact section title match (which would be from the most recent archive)&lt;br /&gt;
			// this loop iterates over just one item in the vast majority of cases&lt;br /&gt;
			for (var i in results) {&lt;br /&gt;
				var result = results[i];&lt;br /&gt;
				if (&lt;br /&gt;
					result.sectiontitle &amp;amp;&amp;amp;&lt;br /&gt;
					(result.sectiontitle === sectionName || result.sectiontitle === sectionNameDotDecoded)&lt;br /&gt;
				) {&lt;br /&gt;
					pageTitle = result.title;&lt;br /&gt;
					sectionNameFound = result.sectiontitle;&lt;br /&gt;
					break;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			var searchLink = mw.util.getUrl(&amp;#039;Special:Search&amp;#039;, {&lt;br /&gt;
				search: &amp;#039;~&amp;#039; + searchQuery, // ~ in the beginning forces a search even if a page of the same name exists, see [[H:FORCE]]&lt;br /&gt;
				prefix: prefix,&lt;br /&gt;
				sort: &amp;#039;create_timestamp_desc&amp;#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			var escapedSectionName = mw.html.escape(sectionNameFound || sectionName);&lt;br /&gt;
&lt;br /&gt;
			if (pageTitle) { // if a section with the same name was found&lt;br /&gt;
				var discussionLink = mw.util.getUrl(pageTitle) + &amp;#039;#&amp;#039; + mw.util.wikiUrlencode(sectionNameFound);&lt;br /&gt;
				$(&amp;#039;.archived-section-prompt&amp;#039;).html(mw.msg(&amp;#039;fas-exact-match&amp;#039;, escapedSectionName, discussionLink, searchLink));&lt;br /&gt;
			} else {&lt;br /&gt;
				$(&amp;#039;.archived-section-prompt&amp;#039;).html(mw.msg(&amp;#039;fas-inexact-match&amp;#039;, escapedSectionName, searchLink));&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	}).catch(function(err) {&lt;br /&gt;
		console.error(&amp;#039;[find-archived-section]: &amp;#039;, JSON.stringify(err));&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&lt;/div&gt;</summary>
		<author><name>en&gt;Xaosflux</name></author>
	</entry>
</feed>