Wikiwand AI

MediaWiki talk:Gadget-markblocked.js

From Wikipedia, the free encyclopedia

Interface-protected edit request on 27 October 2025

Please put the CSS for partial blocks before that of temp/indef blocks. The current order makes it so if a user is both indef-blocked and partial-blocked, the indef CSS (which is more important) is partially overridden, i.e. there's no strikethrough.

The code currently reads:

mw.util.addCSS( '\
						.markblocked-loading a.userlink {opacity:' + ( window.mbLoadingOpacity || 0.85 ) + '}\
						a.user-blocked-temp {' + ( window.mbTempStyle || 'opacity: 0.7; text-decoration: line-through' ) + '}\
						a.user-blocked-indef {' + ( window.mbIndefStyle || 'opacity: 0.4; font-style: italic; text-decoration: line-through' ) + '}\
						a.user-blocked-partial {' + ( window.mbPartialStyle || 'text-decoration: underline; text-decoration-style: dotted' ) + '}\
						.user-blocked-tipbox {' + ( window.mbTipBoxStyle || 'font-size:smaller; background:#FFFFF0; border:1px solid #FEA; padding:0 0.3em; color:#AAA' ) + '}\
					' );

I want it to be changed to:

mw.util.addCSS( '\
						.markblocked-loading a.userlink {opacity:' + ( window.mbLoadingOpacity || 0.85 ) + '}\
						a.user-blocked-partial {' + ( window.mbPartialStyle || 'text-decoration: underline; text-decoration-style: dotted' ) + '}\
						a.user-blocked-temp {' + ( window.mbTempStyle || 'opacity: 0.7; text-decoration: line-through' ) + '}\
						a.user-blocked-indef {' + ( window.mbIndefStyle || 'opacity: 0.4; font-style: italic; text-decoration: line-through' ) + '}\
						.user-blocked-tipbox {' + ( window.mbTipBoxStyle || 'font-size:smaller; background:#FFFFF0; border:1px solid #FEA; padding:0 0.3em; color:#AAA' ) + '}\
					' );

—pythoncoder (talk | contribs) 16:41, 27 October 2025 (UTC)

As this is a non-critical adjustment, please follow the instructions in the first few lines of the gadget to propose amendments. Izno (talk) 17:22, 27 October 2025 (UTC)
I'm not sure how I feel about repo-izing a gadget that only has 1 file, 0 CI, 0 pull requests, etc. This adds a layer of complexity, bureaucracy, extra steps, and extra approvals that may not be necessary. For example I do not use GitLab so I would be unlikely to create a PR. And I can't speak for Pythoncoder, but I suspect that talk page edit requests would also be easier for them than GitLab PRs. @SD0001, am I missing something? –Novem Linguae (talk) 20:06, 27 October 2025 (UTC)
Hmm, looks like I've objected to this before, over at #Is switching to GitLab / SDZeroBot a good idea?. cc Dragoniez as they appear to be one of the supporters of repo-izing this gadget and appear to be an author. –Novem Linguae (talk) 20:10, 27 October 2025 (UTC)
The sync config is not currently active. I have removed the warning header. – SD0001 (talk) 08:33, 30 October 2025 (UTC)
In that case,  Done Writ Keeper ⚇♔ 12:43, 30 October 2025 (UTC)
FWIW I tried to follow the GitLab links but they were only taking me to the script file as plain text, and I couldn't find a link that would let me fork/make a pull request. —pythoncoder (talk | contribs) 11:02, 2 November 2025 (UTC)
You probably need to log in, then visit https://gitlab.wikimedia.org/repos/gadgets/markblocked, then click "fork" in the top right, then visit the new repo, then edit the file on a new branch, then file a "merge request" to the old repo. However, no need to do that anymore since this code has moved back to enwiki. Hope that helps. –Novem Linguae (talk) 20:07, 2 November 2025 (UTC)

Interface-protected edit request on 2 March 2026

Currently, certain partial blocks (namely, those where a user is blocked only from account creation and/or sending email) are misclassified as full site blocks, see Special:Contributions/Varunsinha03 for an example. To correct this, please change user|by|timestamp|expiry|reason|restrictions to user|by|timestamp|expiry|reason|flags|restrictions (the comment below it should likewise be adjusted) and partial = block.restrictions && !Array.isArray( block.restrictions ) to partial = 'partial' in block — chrs || talk 21:02, 2 March 2026 (UTC)

 Done * Pppery * it has begun... 02:57, 5 March 2026 (UTC)

Partial block restrictions

This script does not currently show the actual restrictions in effect for partially blocked users. I've added implemented this on User:Chrs/markBlocked.js (diff) and would appreciate any feedback (this is what led me to discover the issue in the above edit request). — chrs || talk 22:09, 2 March 2026 (UTC)

Interface-protected edit request on 24 March 2026

This script does not show partial block restrictions in the tooltip, which can be useful to see at a glance. This implements support for including these in the tooltip (feature is configurable using mbHidePartialBlockRestrictions). — chrs [talk] 00:02, 25 March 2026 (UTC)

 Done * Pppery * it has begun... 16:07, 26 March 2026 (UTC)

Interface-protected edit request on 27 April 2026

−
$container = $container.find( '.diff-title' );
+
$container = $container.find( '.diff-title' ).add( $container.find( '.ambox' ) );

This changes the script so that rather than excluding all article content, it will exclude all article content except content within an {{ambox}}. The specific use case here is for {{db-g5}}, which usually contains a link to the sockmaster. — chrs [talk] 04:58, 27 April 2026 (UTC)

I don't think this is a good change. It is useful for me to know that the user has in fact been blocked when the user is listed in a G5 request. Izno (talk) 05:34, 27 April 2026 (UTC)
@Izno: The current behavior of the script is to not mark links to users when those links appear in the content of an article in mainspace. This would change that behavior so that it does mark links within amboxes (which it currently does not). — chrs [talk] 18:56, 27 April 2026 (UTC)
Ah. Izno (talk) 18:59, 27 April 2026 (UTC)
 Done Sohom (talk) 17:18, 30 April 2026 (UTC)

Show years for old blocks

I was looking through some old talk page archives and found tooltips like "789d ago" less than useful, so I implemented something to instead show something like "2y 59d ago". I didn't bother with months, because calender math is hard. See this diff. I also fixed a few ESlint suggestions, feel free to take those into account or not. --rchard2scout (talk) 15:06, 7 May 2026 (UTC)

Calendar math is indeed hard, but that doesn't just extend to months; not all years are 365 days long, so your math doesn't quite work out. ;) Writ Keeper ⚇♔ 15:09, 7 May 2026 (UTC)
Fair enough, I could change it to 365.2425 days so that it'll be correct on average, or we could do some math to count how many leap days there have been and take them into account. But that sounds like it gets complicated real fast... I'll think about it some more. Or if anyone happens to have some code lying around already, feel free to share ;). --rchard2scout (talk) 15:18, 7 May 2026 (UTC)
Temporal.Duration looks like it would be quite helpful in this case, though it doesn't look like support for it is universal across browsers yet. Writ Keeper ⚇♔ 15:28, 7 May 2026 (UTC)
Cancelled. I looked into it for a bit, but couldn't find a nice clean way to implement it. And I won't have time to work on this for at least a week, so I'm cancelling this request for now. --rchard2scout (talk) 12:15, 12 May 2026 (UTC)

Bug regarding crossing out other linked wiki accounts

Bug regarding crossing out other linked wiki accounts; see Phabricator report T429726 (moved to here) .n (happy ptide month and in solidarity) 14:26, 21 June 2026 (UTC) .n (happy ptide month and in solidarity) 14:26, 21 June 2026 (UTC)

I would be all right with excluding Special:CentralAuth from this script entirely, especially since it already as a column to indicate which accounts are blocked. Otherwise, this one page would require some specific special case handling that I don't know is really worth it. Writ Keeper ⚇♔ 13:20, 22 June 2026 (UTC)
I've removed the edit request template for now. The edit request template is for when you have code written and ready to go. This looks like a bug report or feature request, and I don't think this has code yet. –Novem Linguae (talk) 15:51, 22 June 2026 (UTC)

Partial blocks

I like that this works for editors with partial blocks from certain namespaces, but I think it's worth excluding partial blocks from individual articles as it sort of works like a badge of shame for what's a relatively minor sanction. If it worked for TBANs then I think including page-blocks would make sense, but I'm sure that's much too difficult/impossible (unless someone can work some magic with WP:AEDR and WP:AEL) Kowal2701 (talk, contribs) 15:06, 5 July 2026 (UTC)

I think I would oppose this. I don't see a need to carve out a certain type of partial block. –Novem Linguae (talk) 20:08, 5 July 2026 (UTC)
Tbh, what prompted this was Randy Kryn appealing that his pageblock be converted to a tban only because of this. IIRC I've seen someone else complain about this as well, but can't remember who, and tbh I've always felt uneasy seeing it, like there's a fair bit of stigma around this type of thing Kowal2701 (talk, contribs) 15:01, 9 July 2026 (UTC)

Edit JS adding check for global blocks

Hi. I added some changes, please apply to current code. Already tested my fork.

For a list of changes see: https://en.wikipedia.org/w/index.php?title=User:Nux/markblocked.js&action=history

  1. linter (including a scope fix for pbDetails)
  2. rewritten to use the Fetch API and async/await (wanted to rewrite it to use mw.Api, but mw doesn't seem to allow retrieving the headers required to get serverTime)
  3. added a check for global blocks (currently this works for temporary accounts; it should work for other accounts after phab:T431203)

For a comparison of files see: https://en.wikipedia.org/wiki/Special:ComparePages?page1=MediaWiki%3AGadget-markblocked.js&rev1=&page2=User%3ANux%2Fmarkblocked.js&rev2=&action=&unhide=

You can test on: https://en.wikipedia.org/wiki/Special:Contributions/~2026-35665-09 (username links should be struck through) Nux (talk) 16:31, 5 July 2026 (UTC)

[non-blocking] Are you sure phab:T431203 is the right ticket? That is a ticket to update a description, rather than an actual algorithm change. –Novem Linguae (talk) 20:09, 5 July 2026 (UTC)
Nux - Just checking in. It looks like Novem Linguae has a question about your request above. Cheers - ~Oshwah~(talk) (contribs) 00:38, 10 July 2026 (UTC)
@Novem Linguae @Oshwah Yes, that was the right ticket, but it was modified. Apparently, in the long list of names I used for testing, only temporary accounts were globally blocked, while normal accounts were globally locked. Locks have a different API so they would required another call and a different parsing procedure. Since there is already a different gadget for checking locks, I think checking only for global blocks is enough.
TL;DR: My changes check for all global blocks, and my version should already work. Please merge it. Nux (talk) 09:07, 10 July 2026 (UTC)
Nux -  Done. ~Oshwah~(talk) (contribs) 16:36, 10 July 2026 (UTC)

Globally blocked users with enwiki set as an exclusion still show with a strikethrough

Following my post at Wikipedia:Help_desk#Apparently_blocked_user_-_who_isn't_blocked It has been suggested I post this here. To precis that string:-
Having users whose names are struck, still making edits, causes confusion. I assume it is because the users Whitewashing report states "exempt global block on homewiki". I would like usernames who are blocked on en.wikipedia, to be struck, but usernames who are not blocked on en.wikipedia, not to be struck, even if they are blocked elsewhere. - Arjayay (talk) 15:53, 25 July 2026 (UTC)

@Oshwah, @Arjayay, @Nux I agree with Arjayay, the current state is very confusing. David10244 (talk) 16:29, 25 July 2026 (UTC)
Handy testcase: User:ZDRX (whitelisted at Special:GlobalBlockList/ZDRX). —Cryptic 16:55, 25 July 2026 (UTC)
Nux - Should the code changes be reverted pending a fix, or are you able to provide a diff that I can update this code with? I'll also admit that I've seen a few changes that I saw that confused me as well. Signatures on the blocked user's talk page were being marked that I don't believe were marked before, is one example. ~Oshwah~(talk) (contribs) 19:34, 25 July 2026 (UTC)
That is unfortunate. There doesn't seem to be any information about exemptions in the API . Unless we can find an existing API for exemptions, there doesn't seem to be a good solution. Would have to file a phab ticket for that. Nux (talk) 22:13, 25 July 2026 (UTC)
A phab ticket to improve the api sounds like a good idea. –Novem Linguae (talk) 09:51, 28 July 2026 (UTC)
I ran across this issue today (Globally blocked users with enwiki set as an exclusion still show with a strikethrough), so I have filed phab:T436972 (GlobalBlocking API should handle exemptions) to help this process along. –Novem Linguae (talk) 18:21, 3 September 2026 (UTC)
I think the current state is preferable to a revert. We can document it in the meantime. Izno (talk) 17:13, 27 July 2026 (UTC)
Perhaps set a different style for global blocks than local ones? —Cryptic 20:20, 27 July 2026 (UTC)
Id lean towards reverting. In my opinion, false negatives are better than false positives. –Novem Linguae (talk) 09:52, 28 July 2026 (UTC)
Our Global block log only shows 108 "disabled the global block" and 14 "re-enabled the global block". Maybe the script could include a list of exemptions, at least here at enwiki. There are only four enwiki accounts: ZDRX, ReLink, Michaelshea04, Xaosflux ep. PrimeHunter (talk) 12:14, 28 July 2026 (UTC)
The only user still globally blocked and whitelisted here is ZDRX. There's also eleven IP ranges (ten IPv4, one IPv6). Current status in a more (human-)readable form at quarry:query/107763. —Cryptic 17:42, 28 July 2026 (UTC)

Per DreamRimmer's comment on VPT, please change

const articleRegex = new RegExp( mw.config.get( 'wgArticlePath' ).replace( '$1', '' ) + '([^#]+)' );

to

const articleRegex = new RegExp( mw.config.get( 'wgArticlePath' ).replace( '$1', '' ) + '([^#?]+)' );

This fixes detection of usernames in redlinks generated by Parsoid, which have the form <a href="https://en.wikipedia.org/wiki/User:Edittttor?action=edit&redlink=1">, instead of <a href="/w/index.php?title=User:Edittttor&action=edit&redlink=1"> --rchard2scout (talk) 13:13, 4 August 2026 (UTC)

By the way, I've tested this change in my personal copy of the gadget (User:Rchard2scout/Gadget-markblocked.js), and it works. --rchard2scout (talk) 13:16, 4 August 2026 (UTC)
 Done — xaosflux Talk 12:47, 6 August 2026 (UTC)

Related Articles

Timelines

Top Qs

Fact Checks