<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://meta.wikioasis.org/wiki/User:DarkMatterMan4500/mark-global-blocked.js?action=history&amp;feed=atom</id>
	<title>User:DarkMatterMan4500/mark-global-blocked.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://meta.wikioasis.org/wiki/User:DarkMatterMan4500/mark-global-blocked.js?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://meta.wikioasis.org/wiki/User:DarkMatterMan4500/mark-global-blocked.js?action=history"/>
	<updated>2026-05-24T13:55:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://meta.wikioasis.org/wiki/User:DarkMatterMan4500/mark-global-blocked.js?diff=4446&amp;oldid=prev</id>
		<title>DarkMatterMan4500: Created page with &quot;// &lt;nowiki&gt; // @ts-check // BETA! // Companion to markblocked and marklocked - asynchronously marks gblocked IPs // Derived from User:GeneralNotability/mark-locked.js; // Chunks borrowed from User:Krinkle/Scripts/CVNSimpleOverlay_wiki.js, // User:GeneralNotability/ip-ext-info.js, and MediaWiki:Gadget-markblocked.js  /**  * Get all userlinks on the page  *  * @param {JQuery} $content page contents  * @return {Map} list of unique users on the page and their...&quot;</title>
		<link rel="alternate" type="text/html" href="https://meta.wikioasis.org/wiki/User:DarkMatterMan4500/mark-global-blocked.js?diff=4446&amp;oldid=prev"/>
		<updated>2026-05-03T12:38:02Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;// &amp;lt;nowiki&amp;gt; // @ts-check // BETA! // Companion to markblocked and marklocked - asynchronously marks gblocked IPs // Derived from &lt;a href=&quot;/wiki/User:GeneralNotability/mark-locked.js?action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:GeneralNotability/mark-locked.js (page does not exist)&quot;&gt;User:GeneralNotability/mark-locked.js&lt;/a&gt;; // Chunks borrowed from &lt;a href=&quot;/wiki/User:Krinkle/Scripts/CVNSimpleOverlay_wiki.js?action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:Krinkle/Scripts/CVNSimpleOverlay wiki.js (page does not exist)&quot;&gt;User:Krinkle/Scripts/CVNSimpleOverlay_wiki.js&lt;/a&gt;, // &lt;a href=&quot;/wiki/User:GeneralNotability/ip-ext-info.js?action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:GeneralNotability/ip-ext-info.js (page does not exist)&quot;&gt;User:GeneralNotability/ip-ext-info.js&lt;/a&gt;, and &lt;a href=&quot;/wiki/MediaWiki:Gadget-markblocked.js?action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;MediaWiki:Gadget-markblocked.js (page does not exist)&quot;&gt;MediaWiki:Gadget-markblocked.js&lt;/a&gt;  /**  * Get all userlinks on the page  *  * @param {JQuery} $content page contents  * @return {Map} list of unique users on the page and their...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;// &amp;lt;nowiki&amp;gt;&lt;br /&gt;
// @ts-check&lt;br /&gt;
// BETA!&lt;br /&gt;
// Companion to markblocked and marklocked - asynchronously marks gblocked IPs&lt;br /&gt;
// Derived from [[User:GeneralNotability/mark-locked.js]];&lt;br /&gt;
// Chunks borrowed from [[User:Krinkle/Scripts/CVNSimpleOverlay_wiki.js]],&lt;br /&gt;
// [[User:GeneralNotability/ip-ext-info.js]], and [[MediaWiki:Gadget-markblocked.js]]&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Get all userlinks on the page&lt;br /&gt;
 *&lt;br /&gt;
 * @param {JQuery} $content page contents&lt;br /&gt;
 * @return {Map} list of unique users on the page and their corresponding links&lt;br /&gt;
 */&lt;br /&gt;
function gblockedIPs_getIPs($content) {&lt;br /&gt;
	const userLinks = new Map();&lt;br /&gt;
&lt;br /&gt;
	// Get all aliases for user: &amp;amp; user_talk: (taken from markblocked)&lt;br /&gt;
	const userNS = [];&lt;br /&gt;
	for ( const ns in mw.config.get( &amp;#039;wgNamespaceIds&amp;#039; ) ) {&lt;br /&gt;
		if ( mw.config.get( &amp;#039;wgNamespaceIds&amp;#039; )[ns] === 2 || mw.config.get( &amp;#039;wgNamespaceIds&amp;#039; )[ns] === 3 ) {&lt;br /&gt;
			userNS.push( mw.util.escapeRegExp(ns.replace( /_/g, &amp;#039; &amp;#039; )) + &amp;#039;:&amp;#039; );&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// RegExp for all titles that are  User:| User_talk: | Special:Contributions/ | Special:Contribs/ | Special:CentralAuth/ | Special:GlobalBlockList/&lt;br /&gt;
	const userTitleRX = new RegExp(&amp;#039;^(&amp;#039; + userNS.join(&amp;#039;|&amp;#039;) + &amp;#039;|Special:Contrib(?:ution)?s\\/|Special:CentralAuth\\/|Special:GlobalBlockList\\/)+([^#]+)$&amp;#039;, &amp;#039;i&amp;#039;);	$(&amp;#039;a&amp;#039;, $content).each(function () {&lt;br /&gt;
	const articleRX = new RegExp(mw.config.get(&amp;#039;wgArticlePath&amp;#039;).replace(&amp;#039;$1&amp;#039;, &amp;#039;&amp;#039;) + &amp;#039;([^#]+)&amp;#039;);&lt;br /&gt;
	const redlinkRX = new RegExp(&amp;#039;/w/index.php?title=([^#&amp;amp;]+)&amp;#039;);&lt;br /&gt;
		if (!$(this).attr(&amp;#039;href&amp;#039;)) {&lt;br /&gt;
			// Ignore if the &amp;lt;a&amp;gt; doesn&amp;#039;t have a href&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		let articleTitleReMatch = articleRX.exec($(this).attr(&amp;#039;href&amp;#039;).toString());&lt;br /&gt;
		if (!articleTitleReMatch) {&lt;br /&gt;
			// Try the redlink check&lt;br /&gt;
			articleTitleReMatch = redlinkRX.exec($(this).attr(&amp;#039;href&amp;#039;).toString());&lt;br /&gt;
			if (!articleTitleReMatch) {&lt;br /&gt;
				return;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		const pgTitle = decodeURIComponent(articleTitleReMatch[1]).replace(/_/g, &amp;#039; &amp;#039;);&lt;br /&gt;
		const userTitleReMatch = userTitleRX.exec(pgTitle);&lt;br /&gt;
		if (!userTitleReMatch) {&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		const username = userTitleReMatch[2];&lt;br /&gt;
		if (mw.util.isIPAddress(username, true)) {&lt;br /&gt;
			if (!userLinks.get(username)) {&lt;br /&gt;
				userLinks.set(username, []);&lt;br /&gt;
			}&lt;br /&gt;
			userLinks.get(username).push($(this));&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
	return userLinks;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether an IP is globally blocked&lt;br /&gt;
 *&lt;br /&gt;
 * @param {string} IP to check&lt;br /&gt;
 *&lt;br /&gt;
 * @return {Promise&amp;lt;boolean&amp;gt;} Whether the IP in question is gblocked&lt;br /&gt;
 */&lt;br /&gt;
async function gblockedUsers_isGBlocked(input) {&lt;br /&gt;
	const api = new mw.Api();&lt;br /&gt;
	try {&lt;br /&gt;
		const response = await api.get({&lt;br /&gt;
			action: &amp;#039;query&amp;#039;,&lt;br /&gt;
			list: &amp;#039;globalblocks&amp;#039;,&lt;br /&gt;
			bglimit: &amp;#039;1&amp;#039;,&lt;br /&gt;
			bgip: input,&lt;br /&gt;
			bgprop: &amp;#039;address&amp;#039;&lt;br /&gt;
		});&lt;br /&gt;
		if (response.query.globalblocks.length === 0) {&lt;br /&gt;
			// If the length is 0, then no block&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		// If there is a length, then the IP is gblocked&lt;br /&gt;
		return true;&lt;br /&gt;
	} catch (error) {&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// On window load, get all the users on the page and check if they&amp;#039;re blocked&lt;br /&gt;
$.when( $.ready, mw.loader.using( &amp;#039;mediawiki.util&amp;#039; ) ).then( function () {&lt;br /&gt;
	mw.hook(&amp;#039;wikipage.content&amp;#039;).add(function ($content) {&lt;br /&gt;
		const usersOnPage = gblockedIPs_getIPs($content);&lt;br /&gt;
		usersOnPage.forEach(async (val, key, _) =&amp;gt; {&lt;br /&gt;
			const userGBlocked = await gblockedUsers_isGBlocked(key);&lt;br /&gt;
			if (userGBlocked) {&lt;br /&gt;
				val.forEach(($link) =&amp;gt; {&lt;br /&gt;
					$link.css({ opacity: 0.4, &amp;#039;border-bottom-size&amp;#039;: &amp;#039;thick&amp;#039;, &amp;#039;border-bottom-style&amp;#039;: &amp;#039;dashed&amp;#039;, &amp;#039;border-bottom-color&amp;#039;: &amp;#039;red&amp;#039; });&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
// &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>DarkMatterMan4500</name></author>
	</entry>
</feed>