User script requests

Post your user script-related request or idea for a new user script (or gadget) as a new section below. Discussion in each section is encouraged. Note that most gadgets started out as mere user scripts. This page is intended for new user scripts, which affect the appearance of the site and may add additional functionality. Fully automated bots should be requested at Wikipedia:Bot requests instead.

All user script-related requests are welcome, whether they be for assistance writing an existing user script, desire for a new user script that does what you want, etc. Ideas for new user scripts are welcome too!

Before you request a script, please make sure it does not already exist. For a list of user scripts, see this list.

If you have been helped, please let us know, so that we may archive the request.


Unknown parameters

edit

Hi. Is there a gadget to detect unknown parameters in templates? Kind of like WP:WPCleaner does by parsing parameters in Template:Format TemplateData. GryffindorD (talk) 13:50, 21 July 2023 (UTC)Reply

Not a gadget, but Module:Check for unknown parameters is used in thousands of templates. It puts pages in a tracking category when they have unsupported parameters. – Jonesey95 (talk) 14:28, 22 July 2023 (UTC)Reply
@GryffindorD: I made a tool that sorts articles by use of template parameters. Among others it lists unknown parameters. I recently expanded it to work on other wikis too. You can access it by visiting this page. Lmk if you encounter any bugs. Ivi104 (talk) 01:52, 22 March 2024 (UTC)Reply
edit

Would it be possible to create a script that would delink repeated links, as well as one that would be able to find the first mention of a phrase matching the title of a link further in the article, linking that and delinking all subsequent links to that title? ‑‑Neveselbert (talk · contribs · email) 20:17, 8 March 2024 (UTC)Reply

That would be very hard. Just highlighting duplinks (or using my fork of it) would be enough. Aaron Liu (talk) 23:26, 8 March 2024 (UTC)Reply
@Aaron Liu: yes, I've been using that, it just takes a lot of time, especially in cases where the first mention of a phrase isn't linked but a later one has been. I'd have thought it possible to create a script to make a note of all links duplicated (by virtue of your script), and search the article for all exact matches of linked article titles, linking the first mention, then delinking those subsequent. @Nardog: do you think this could work? Thanks all, ‑‑Neveselbert (talk · contribs · email) 15:10, 9 March 2024 (UTC)Reply
It is possible, but I think that'd result in too many false positives. Often a phrase isn't stated exactly the same as the article title, so the actual first mention would be delinked.
Just the automatic delinking part would be possible, though it'd be much more complicated if we needed to follow redirects. Aaron Liu (talk) 16:08, 9 March 2024 (UTC)Reply
Yes, I thought about that, though I know that I would double-check the edit to make sure there were no false positives. I think following a redirect could be considered eventually, but for the moment, I think the script should just focus on exact matches to avoid any of these false positives, so if the phrase matches the title exactly, it's delinked. ‑‑Neveselbert (talk · contribs · email) 16:10, 9 March 2024 (UTC)Reply
WP:LINKFIRST permits repeated links where helpful, and writing a script that determines whether something is helpful seems like an AI-hard problem. That said, I've seen articles that are absurdly overlinked, linking the same word repeatedly in a single sentence. Fixing was tedious; I think I've removed the lot with find/replace and then manually inserted a sane number of links, at least once.
Duplinks already ignores some links on the basis of placement. Using different colours to highlight, say the first and subsequent repeats of each link per major section, and say, links in lists, captions or tables where they duplicate the body text, would be doable. Would that help winnow down to the links that are most likely to be unhelpful? Then maybe one could look at the patterns, and decide, say, to remove all orange-highlighted links in the article automatically. Making this work for colourblind users might require a bit of extra effort. HLHJ (talk) 14:59, 24 May 2024 (UTC)Reply

WikiDefcon User Script

edit

I'm requesting a user script that adds a WikiDefcon marker to the top bar for Vector 2022, ideally placed next to the notifications/alerts tabs using Template:Vandalism information. This would assist greatly in counter-vandalism tasks. Possibly, it could use these images, similar to the relevant topicon.       Thanks,NeuropolTalk 15:37, 2 April 2024 (UTC)Reply

@Neuropol: Hi. I'm working on it. Can you please choose a target page for when we click on the icon? Thanks. Jeeputer Talk 16:15, 2 April 2024 (UTC)Reply
Hi, Template:Vandalism information would fit most consistently with other WikiDefcon templates. Thanks,NeuropolTalk 16:17, 2 April 2024 (UTC)Reply
@Neuropol: Ok it's done and ready to use: User:Jeeputer/defconIndicator.js. If you click on the icon, it will update the image used to show the current level of vandalism. the script itself updates the icon every 2 minutes. I can change the interval if it's too fast. Jeeputer Talk 19:30, 2 April 2024 (UTC)Reply
Works great. Thank you so much! Thanks,NeuropolTalk 22:17, 2 April 2024 (UTC)Reply
edit

I'm not sure how possible this is, but it would be really nice to have a user script which adds a new icon to the top toolbar (where one's username is, notifications, watchlist, etc.) which could be customized using custom images a custom link which it leads to. Thanks,NeuropolTalk 12:48, 10 May 2024 (UTC)Reply

This sounds feasible as it's just a portlet, but you may have to specify the link to the image yourself. Also, I'm assuming you don't want it to sticky. Aaron Liu (talk) 12:59, 10 May 2024 (UTC)Reply
Sounds reasonable. Forgive my coding illiteracy, but what does it mean to be "sticky"? Thanks,NeuropolTalk 13:00, 10 May 2024 (UTC)Reply
In V22, a different top bar becomes sticky and stays at the top while you scroll down. Aaron Liu (talk) 13:18, 10 May 2024 (UTC)Reply
Yeah, not sticky then please. Thanks,NeuropolTalk 13:19, 10 May 2024 (UTC)Reply
You can add a link that takes you to a page of your choice. See the "Add links at top for Tools page" section of User:Jonesey95/vector-2022.js. This makes a "Tools" link appear between "Sandbox" and "Preferences" for me. It's not an icon, but it is there any time I need it, on every page (after making the top bar sticky on all pages, of course). – Jonesey95 (talk) 20:36, 11 May 2024 (UTC)Reply
@Neuropol I've just noticed User:BrandonXLF/PortletLinks. Would that work? Aaron Liu (talk) 14:23, 4 August 2024 (UTC)Reply

Script to quickly answer {{Help me}}

edit

Can be fully based on edit request user scripts, like this one. Thoughts? Cocobb8 (💬 talk • ✏️ contribs) 22:55, 29 May 2024 (UTC)Reply

Finally, my chance! Cocobb8, I could probably do that. Any preferences you would like me to know? — thetechie@enwiki: ~/talk/ $ 23:56, 29 May 2024 (UTC)Reply
@TheTechie Thanks so much! By preferences, do you mean settings or what I would prefer? Cocobb8 (💬 talk • ✏️ contribs) 01:15, 30 May 2024 (UTC)Reply
Cocobb8, the latter, if anything. — thetechie@enwiki: ~/talk/ $ 01:21, 30 May 2024 (UTC)Reply
@TheTechie Just a simple "respond" button with then additional buttons to select the template to change it to is all I would like to have :). Thanks so much for taking this one so quickly!! Cocobb8 (💬 talk • ✏️ contribs) 01:24, 30 May 2024 (UTC)Reply
@TheTechie I don't mean to rush things at all, but I was just wondering what would be an estimated date for you to complete this script? Thanks so much! Cocobb8 (💬 talk • ✏️ contribs) 13:12, 6 June 2024 (UTC)Reply
Not sure, kind of busy whilst trying to figure out an issue with the script and if it is possible (I'm trying to change the respond button to work for "help me" but the script has no comments, so some things are kind of obfuscated, per se). @Cocobb8 thetechie@enwiki: ~/talk/ $ 14:17, 6 June 2024 (UTC)Reply
Hey @TheTechie, I was wondering if you had tested the script in Vector 2022? I use that as my skin and I can't see the button. Cheers! Cocobb8 (💬 talk • ✏️ contribs) 21:46, 25 July 2024 (UTC)Reply
Hello,
No, I haven't had the chance to test it on testwiki due to CORS restrictions. It should target all "helpme"s, let me know if it doesn't. thetechie@enwiki: ~/talk/ $ 01:16, 29 July 2024 (UTC)Reply
I put one up at User talk:Aaron Liu/sandbox#Introduction to contentious topics and it didn't seem to do anything at all. Aaron Liu (talk) 03:11, 1 August 2024 (UTC)Reply

Collapsible parentheses in body text

edit

Hi, not sure where this is going or how feasable but :

  • I've always been startled at how readable software editors make sources look in comparison to regular text.
  • I love the peek feature on wiki's internal links.
  • Tough subjects might use a lot of optional brackets to refine composed sentences (actually it could be just bad use of brackets too).

So here are my dirty ideas :

  • plan A : Make brackets and their contained text coloured in a randomized dark-grey-color-tinted scheme (sane idea right?).
  • plan B : Make brackets collapsable.
  • plan Z : Go way beyond and rock every non-software english enthusiast by forcing natural english syntax colouring down their throat.

Plan Z though, is not on topic, plan A and B are. Good friends, what does that inspire you? Is it a good thing to pursue?

Much appreciation. Toto4040 (talk) 09:25, 4 June 2024 (UTC)Reply

I wonder if that syntax highlighter is Open-source software. If it were suitably licensed and happened to be written in Javascript, you could run it as a Wikipedia:User scripts in your own account. WhatamIdoing (talk) 16:50, 4 June 2024 (UTC)Reply
Just something to consider: Some brackets aren't expressing a standalone idea, so coloring them differently might be confusing (for instance, "Janet(s)" or SO(3)). RunningTiger123 (talk) 01:10, 6 June 2024 (UTC)Reply
Would be easy to only detect them with a preceding space. Aaron Liu (talk) 12:54, 7 June 2024 (UTC)Reply

Fork of Enterprisey's revdel script

edit

Hey all! Would anyone be willing to fork Enterprisey's copyvio-revdel user script? There is an issue with it on Vector 2022, where the "Range?" checkbox does not show. Cheers! Cocobb8 (💬 talk • ✏️ contribs) 22:33, 6 June 2024 (UTC)Reply

Works for me. I'd agree that it has kinda bad UI design I dunno how to fix though. You have to click the blue button to add the range. Aaron Liu (talk) 23:06, 6 June 2024 (UTC)Reply
The checkbox appears for me on Vector 2022. Is there a specific page or revision range this is an issue on? Chlod (say hi!) 01:53, 7 June 2024 (UTC)Reply
@Chlod, @Aaron Liu Here's what I see: https://pasteboard.co/ALyP3BB2B8TH.png. Am I missing anything? Cocobb8 (💬 talk • ✏️ contribs) 12:58, 7 June 2024 (UTC)Reply
@Cocobb8: You first have to add a range of diffs before that table gets populated. See the first paragraph of User:Enterprisey/cv-revdel § Usage for more details. Chlod (say hi!) 13:05, 7 June 2024 (UTC)Reply
Got it. So sorry about that, I hadn't bothered to see if that would do anything. Thanks so much! Cocobb8 (💬 talk • ✏️ contribs) 13:10, 7 June 2024 (UTC)Reply

Sentence/title case

edit

Hi! Do you think a script could be made that looks for |title= within references, and then changes everything inside it to either title case or sentence case? Lee Vilenski (talkcontribs) 12:43, 7 June 2024 (UTC)Reply

It would be possible, but I thought titles of sources were supposed to be capitalized as the source capitalizes it. Aaron Liu (talk) 12:50, 7 June 2024 (UTC)Reply
For all-capital titles, MOS:ALLCAPS would apply (I'm guessing this is what the script is meant to fix). More limited capitalization may be different. RunningTiger123 (talk) 02:41, 8 June 2024 (UTC)Reply
Yeah, but it sounds it'll also convert stuff that isn't all-caps. Aaron Liu (talk) 17:29, 8 June 2024 (UTC)Reply
@ZKang123 made User:ZKang123/Titlecaseconverter.js the other day. You run it by going to edit source, then clicking a link in the tools menu, then clicking "Show changes". –Novem Linguae (talk) 17:52, 8 June 2024 (UTC)Reply
A link provided there satisfies my question. It's outlined under MOS:CONFORM. Aaron Liu (talk) 18:36, 8 June 2024 (UTC)Reply
Thanks for that, sounds like ZKang was well ahead of me. :) Lee Vilenski (talkcontribs) 18:50, 8 June 2024 (UTC)Reply

DYK Reviewer tool

edit

Following this discussion, can someone please write a DYK reviewer tool. dxneo (talk) 13:39, 13 June 2024 (UTC)Reply

Got a link to the steps? –Novem Linguae (talk) 13:51, 13 June 2024 (UTC)Reply
@Novem Linguae: Hi. User:Nightdevil has a script for this purpose on fawiki (fa:User:Nightdevil/amikCloser.js). Maybe it can help writing a script for enwiki. I don't know if the procedure for DYK reviewing on this wiki is the same. Jeeputer Talk 13:23, 14 June 2024 (UTC)Reply

Show only blocked users

edit

See User talk:Novem Linguae/Scripts/UserHighlighterSimple#Toggle. As I stated to Novem Linguae, I'd like "to look at the contribution history of a page and see only the edits of blocked users. I've wished this for a while as it would help sometimes when I'm investigating a possible new sock." I didn't know this page existed until they recommended I come here. Thanks.--Bbb23 (talk) 15:14, 23 June 2024 (UTC)Reply

@Bbb23, if you have the Strike out usernames that have been blocked gadget enabled, this could be as easy as running
$("li[data-mw-revid]").hide().has("a.user-blocked-indef, a.user-blocked-partial, a.user-blocked-temp").show()
from your browser console (in Firefox: right click anywhere on article history page > inspect > console tab).
The code simply hides the unblocked user contributions, so it will only show blocked users that were originally on the history page (a fraction of the last 500 edits should suffice, I assume). Ponor (talk) 08:28, 26 June 2024 (UTC)Reply
@Ponor: I get to console tab and paste in your code to the box called "Filter output". Nothing changes in the contribution history. I'm using Bapaiya as it has a lot of blocked users. What am I doing wrong? --Bbb23 (talk) 13:10, 26 June 2024 (UTC)Reply
What skin are you using? –Novem Linguae (talk) 13:12, 26 June 2024 (UTC)Reply
Vector legacy.--Bbb23 (talk) 13:15, 26 June 2024 (UTC)Reply
Link to your test page: https://en.wikipedia.org/w/index.php?title=Bahuchara_Mata&action=history&useskin=vector. It works for me, with one caveat: if the edit summary includes a wikilink that mentions a blocked user, then that edit summary will also be included, even if the user is not blocked. For example, JalenFolf is not blocked, but he reverted an edit by blocked user Harihar Rawal, so that edit is included. Ponor could probably fix this by adding .history-user somewhere in the code above. –Novem Linguae (talk) 13:42, 26 June 2024 (UTC)Reply
Oh, yes. Thanks, didn't have that case on the pages where I tested. So it's:
$("li[data-mw-revid]").hide().has(".history-user > a.user-blocked-partial, .history-user > a.user-blocked-indef, .history-user > a.user-blocked-temp").show() Ponor (talk) 14:02, 26 June 2024 (UTC)Reply
@Bbb23, it's not the "Filter output" field. There should be a prompt at the bottom of that window, i.e. console tab, where you can execute any code. This should be skin independent.
I've checked here [1] and it worked. Ponor (talk) 13:20, 26 June 2024 (UTC)Reply
@Ponor: I don't see a "prompt".--Bbb23 (talk) 13:23, 26 June 2024 (UTC)Reply
@Bbb23 browser console, section "#Browser Console command line". Ponor (talk) 13:25, 26 June 2024 (UTC)Reply
All of these things you're recommending are for FF developers, which I am not. I went a little deeper based on your link above, but I had to change developer settings, which I believe I did, and I still couldn't make the thing work. I'll wait for someone to come up with a simpler Wikipedia-based solution. If not, I'll live. Thanks for trying to help.--Bbb23 (talk) 13:45, 26 June 2024 (UTC)Reply
@Bbb23. Try this: User:Novem Linguae/Scripts/BlockedUserHistory.js. To activate, go to more menu -> "Show only blocked users". With thanks to Ponor for the above JQuery code. –Novem Linguae (talk) 14:14, 26 June 2024 (UTC)Reply

I was gonna ask you to add

var node = mw.util.addPortletLink('p-tb', '', 'Show only blocked');
$( node ).on( 'click', function ( e ) {
    $("li[data-mw-revid]").hide().has(".history-user > a.user-blocked-partial, .history-user > a.user-blocked-indef, .history-user > a.user-blocked-temp").show();
    e.preventDefault();
} );

to your Special:MyPage/common.js, but Novem Linguae was faster and his script targets only history pages, unlike mine. Ponor (talk) 14:23, 26 June 2024 (UTC)Reply

@Ponor: Thanks for your persistence. Novem Linguae, your script is perfect! --Bbb23 (talk) 14:52, 26 June 2024 (UTC)Reply

Get the rename history of a page

edit

There is one workflow that is absolutely not automated on Wikimedia sites: getting the rename history of a page. Digging through page logs looking for renaming records, especially when an article was renamed multiple times, often in a back and forth way, is terrible. A tool for that would be very helpful. Let's say, just a timeline with rename dates and new names.

Not necessarily should be a user script. Jack who built the house (talk) 22:12, 2 July 2024 (UTC)Reply

...Turns out I wasn't searching hard enough, there is User:Nardog/MoveHistory! Jack who built the house (talk) 00:17, 3 July 2024 (UTC)Reply

Mobile edit preview

edit

(See Wikipedia:Village pump (idea lab)#Formatting for mobile phones)

75% of Wikipedia traffic is from mobile devices. Editors using a desktop device should be able to see how their version of a page will look on a mobile device before saving it. This is to request a version of the Mobile sidebar preview widget that will show how the contents of the current edit window will look on a mobile device. Or, if this is simpler, for the existing Mobile sidebar preview widget to be enhanced so it works in edit mode, where it will display a mobile preview of the contents of the edit window. At some point, once fully tested and stable, it could be launched from the edit menu:

Publish changes
Mobile preview
Desktop preview
Show changes
Cancel
Editing help

Pinging Brooke Vibber for comments. Aymatth2 (talk) 13:19, 3 July 2024 (UTC)Reply

Script to show non-printing characters in edit fields

edit

Is there a script that can show non-printing characters in edit fields? For example, Notepad can display many of these characters as black boxes with an abbreviation of the character's name (see e.g. File:Keylogger-software-logfile-example.jpg, which shows the BS character). In my quick testing, it appears that the C0 control codes do not survive a round-trip through the MediaWiki parser, but other non-printing characters do, and these characters show up surprisingly commonly in wikitext (the biggest offenders I've noticed are left-to-right marks and right-to-left marks, though I've come across a variety of them). Bonus points if the script can somehow distinguish various whitespace characters. ディノ千?!☎ Dinoguy1000 12:58, 4 July 2024 (UTC)Reply

The default syntax highlighter appears to show them. Nardog (talk) 04:15, 7 July 2024 (UTC)Reply

Script to set template parameter aliases

edit

Many wikis are using templates originally created on English Wikipedia. On my home wiki, we set Persian aliases for templates' parameters, but it's a long and time-consuming process for large templates like most of the infoboxes. I can really use any help for creating a script to easily set aliases for existing parameters. I've tried to start wriiting it here but got stuck as I am not a Javascript expert. Any help is really appreciated. Jeeputer Talk 22:46, 6 July 2024 (UTC)Reply

I sacrificed my sleep for the noble act of creating User:Aaron Liu/AliasPam.js with AutoEd's framework. Tell me if you find any bugs. Aaron Liu (talk) 05:21, 9 July 2024 (UTC)Reply
@Aaron Liu: Thank you, I really appreciate your work! I will test it on fawiki and will give feedback. Jeeputer Talk 05:33, 9 July 2024 (UTC)Reply
@Aaron Liu: Can we use mw.loader.load() instead of importScript to load AutoEd? importScript tries to load "Wikipedia:AutoEd/core.js" from fawiki, which does not exist there, so... I get an error in my console when loading the script from enwiki. Jeeputer Talk 05:49, 9 July 2024 (UTC)Reply
@Jeeputer   Done Aaron Liu (talk) 12:38, 9 July 2024 (UTC)Reply
@Aaron LiuThanks again. It works fine now. Jeeputer Talk 14:20, 9 July 2024 (UTC)Reply

Bit of help with seeing all edit filters

edit

I don't think this exists as a script currently, but I was trying to view all edit filters using a user script to add a portlet to p-views. I've sort of started on it at User:EggRoll97/ExpandFilterView.js, and I've got a portlet to actually appear, but the problem I'm running into is that when I click the portlet, it goes to the desired link, but changes the link. Instead of going to Special:AbuseFilter/?deletedfilters=show&querypattern=&limit=5000 the portlet link goes to Special:AbuseFilter/?deletedfilters=show&querypattern=&limit=5000, which causes the page to only show the default amount of filters, instead of all 5000. Does anyone possibly have suggestions on what I might be missing? I've checked the guide, but I'm not seeing anything that might explain it. The other question I had was if it's possible to only have this portlet appear on Special:AbuseFilter, and to hide itself on other pages. EggRoll97 (talk) 07:35, 20 July 2024 (UTC)Reply

mw.util.getUrl( 'Special:AbuseFilter/', { deletedfilters: 'show', querypattern: '', limit: '5000' } ). Or you can just write '/w/index.php?title=Special:AbuseFilter/&deletedfilters=show&querypattern=&limit=5000' in place of getUrl(). Nardog (talk) 08:27, 20 July 2024 (UTC)Reply
@EggRoll97: In response to your second question, use if (mw.config.get('wgPageName') !== 'Special:AbuseFilter') return. see doc. Jeeputer Talk 15:03, 20 July 2024 (UTC)Reply
@Nardog and Jeeputer: Thanks! That does seem to fix the link problem, though I've tried the solution to the second question and it doesn't seem to be appearing on any page. I commented it out for now, but I'm not sure if I'm putting it in wrong. EggRoll97 (talk) 20:02, 20 July 2024 (UTC)Reply
Uncomment it, remove return and change !== to ===. return doesn't work because imported scripts execute in the global scope. Nardog (talk) 05:54, 21 July 2024 (UTC)Reply
So, use this:
if (mw.config.get('wgPageName') === 'Special:AbuseFilter') {
    mw.util.addPortletLink ( 'p-views', mw.util.getUrl( 'Special:AbuseFilter/', { deletedfilters: 'show', querypattern: '', limit: '5000' } ), 'Edit Filters', 'pt-expandedfilters', 'View all filters');
}
Jeeputer Talk 19:05, 21 July 2024 (UTC)Reply
This worked! Thanks to both! EggRoll97 (talk) 00:09, 22 July 2024 (UTC)Reply

Fill sfn-ref page numbers

edit

A script that allows you to click on sfn-refs and add/change page numbers — something like User:Ingenuity/ReferenceEditor.js, @DaxServer, FYI. TrangaBellam (talk) 10:12, 7 August 2024 (UTC)Reply

User:UncleDouggie/smart_watchlist.js

edit

Hello, the editor of this script has been retired for a long time. The script has an issue. While it includes a clear settings button, it lacks a confirmation box . Many times, I’ve accidentally clicked the clear settings button and lost my settings. Could someone please edit the script to add a confirmation box ? — Saqib (talk I contribs) 16:57, 15 August 2024 (UTC)Reply

Precedent is to not edit userscripts unless they have a bug even if the user's been inactive. Thankfully, the script exposes every function globally. That means you can append the following to your common.js (probably after the part that loads the smart watchlist script) to work your magic:
SmartWatchlist.clearSettings = function () {
	if ( confirm( "Clear all of your settings?" ) ) {
		clearSettings.apply(this, arguments);
	}
};
Also, why not use the new JS interface? Aaron Liu (talk) 23:48, 15 August 2024 (UTC)Reply
Aaron Liu, Thanks for your prompt help. Could you please check this if I’ve done it right, or let me know if I need to add it at line # 269 before I proceed with testing? And what is new JS interface?Saqib (talk I contribs) 08:09, 16 August 2024 (UTC)Reply
Erm, you're supposed to install scripts with importScript() (which will always fetch the latest versions) instead of copy-pasting it. But yeah, it should work.
Nevermind my comment about the JS interface. I personally couldn't get the script to work even without the changes unless I selected "use non-JS interface". Aaron Liu (talk) 12:36, 16 August 2024 (UTC)Reply
Aaron Liu, You’re right. But If I had installed this with importScript, I wouldn’t be able to make the above changes to it, correct?Saqib (talk I contribs) 13:17, 16 August 2024 (UTC)Reply
Yes you would. Like I said, the script exposes some functions so we could simply place the part I made after the importScript and it’ll work. Aaron Liu (talk) 14:29, 16 August 2024 (UTC)Reply
This seems flawed in two ways: it would result in a ReferenceError because the global SmartWatchlist doesn't exist until the external script is loaded, which is asynchronous; and clearSettings is not a global so another ReferenceError when the new function actually runs. So you'd have to do something like:
mw.loader.getScript('/w/index.php?title=User:UncleDouggie/smart_watchlist.js&action=raw&ctype=text/javascript').then(function () {
	var clearSettings = SmartWatchlist.clearSettings;
	SmartWatchlist.clearSettings = function () {
		if ( confirm( "Clear all of your settings?" ) ) {
			clearSettings.apply(this, arguments);
		}
	};
});
Nardog (talk) 01:34, 17 August 2024 (UTC)Reply
Fair. It works on my machine though :) Aaron Liu (talk) 01:47, 17 August 2024 (UTC)Reply

Unclutter script broken

edit

The signature minimisation feature is broken in this script due to updates by Krinkle to MediaWiki this year and I am unable to contact the author due to their four year inactivity and the MW dev is unresponsive. 1989 (talk) 15:11, 18 August 2024 (UTC)Reply

@1989 Which update? And, how does the breakage manifest in this script? Krinkle (talk) 18:47, 18 August 2024 (UTC)Reply
My guess is the linking of timestamps, which stops the script from detecting signatures. Aaron Liu (talk) 20:26, 18 August 2024 (UTC)Reply
That seems to be what is the cause. I ran into a page where the timestamp link doesn’t work, and the user script is able to work. @Krinkle: Is there a script that can optionally disable that? 1989 (talk) 21:53, 18 August 2024 (UTC)Reply
It's never a good idea to use something that's not going to be updated much. Like I said, I'd recommend Convenient Discussions (the JWBTH/CD link below). Aaron Liu (talk) 22:24, 18 August 2024 (UTC)Reply
What you’ve suggested is unfortunately not a solution for me. 1989 (talk) 23:31, 18 August 2024 (UTC)Reply
@1989 Which "updates to MediaWiki" is this about? Krinkle (talk) 21:38, 6 September 2024 (UTC)Reply
Did your reply script lag for 19 days? Aaron Liu (talk) 01:38, 7 September 2024 (UTC)Reply
I would recommend c:User:JWBTH/CD in the toggleable Flow-like interface combined with WP:POPUPS. Aaron Liu (talk) 20:27, 18 August 2024 (UTC)Reply

Auto-open Wikidata item

edit

I work on Category:Articles missing coordinates with coordinates on Wikidata in bulk occasionally, and a tool that would speed up the process a lot is a script similar to User:SD0001/UnassessedArticleLinks.js, which opens pages of a certain category in a new tab and automatically opens Rater. The script I'm envisioning would automatically open the linked Wikidata item for the article in a new tab and the edit page for the article when clicking on an article in Category:Articles missing coordinates with coordinates on Wikidata.

For example, as I'm writing this the current top article alphabetically in that category is ¡Cu-Cut! incident. With this script, when clicking on the link to that article within the articles missing coordinates category listing, it would open two new tabs: one with https://en.wikipedia.org/w/index.php?title=¡Cu-Cut!_incident&action=edit open, and one with wikidata:Q14521476 open. Hopefully that makes sense? Suntooooth, it/he (talk/contribs) 23:03, 20 August 2024 (UTC)Reply

I think it would be possible to auto-generate and insert the coord template with the Wikidata API. Anyone interested in this can check out Special:Diff/1238811453 and wikidata:Wikidata:REST API. Aaron Liu (talk) 01:00, 21 August 2024 (UTC)Reply
That would be very cool - I already have my own external program for generating the coords template that copies it to clipboard, but I'd be interested in seeing an automatic on-wiki version :] Suntooooth, it/he (talk/contribs) 15:03, 21 August 2024 (UTC)Reply
  • The code below extracts coordinates from Wikidata and prepares the wikitext for the coord template.
var qid = mw.config.get('wgWikibaseItemId')
$.get('https://www.wikidata.org/w/rest.php/wikibase/v0/entities/items/'   qid).then(function(data) {
    if (!data.statements.P625) {
        alert('No coordinates on wikidata')
        return
    }
    var value = data.statements.P625[0].value.content;
    var latitude = value.latitude;
    var longitude = value.longitude;
    var template = '{{coord|'   latitude   '|N|'   longitude   '|W|display=inline,title}}';
    console.log(template)
})

The problem is that I'm not much familiar with coordinates on Wikipedia and not sure if the values are correct and can be used on articles. For example, on Bidkhun-e Morghak this code outputs {{coord|29.11694444|N|57.88777778|W|display=inline,title}} which is a bit different from what is shown in the infobox and not sure if we should round (down/up?) those latitude and longitude values to N decimal places. I need some guidance on what the expected output looks like, then i will work on the rest of the script which includes inserting the output into the edit box. Thanks. Jeeputer Talk 00:25, 2 September 2024 (UTC)Reply

With a quick search I found out that the coordinate location (P625) only supports World Geodetic System 1984 (aka WGS84), and per WP:OPCOORD, the value from Wikidata (which uses WGS84) is not always appropriate to be inserted into articles. Asking Suntooooth for help. Thanks. Jeeputer Talk 00:35, 2 September 2024 (UTC)Reply
I'm not sure why you say that WGS84 isn't always appropriate - Wikipedia:WikiProject Geographical coordinates#Geodetic system says "All coordinates specified through {{coord}} must be referenced to WGS84, or an equivalent datum." For a generic script, I feel like truncating to either 0.1′′ or 0.00001 precision should be fine, since those are the most precise but useful coordinates (someone can always make it less precise very easily if it's referring to, say, a town, but it's more work to make it more precise after the fact).
Also, does the Wikidata API always automatically output in dd.ddddd format, or is it sometimes in degrees-minutes-seconds? When I open the Wikidata page for the article you linked, it shows the coordinates in degrees-minutes-seconds for me. This would explain why the template on that article is formatted differently, since that's also in DMS.
And one last thing - I'm not sure why you've hard-baked N and W into the template output considering that's not a given. Either the coordinate numbers will have positive and negative possibilities (in which case the direction doesn't need to be specified) or they will have only positive possibilities and N/S and E/W have to be specified. Look at the documentation for {{coord}} for more info. Suntooooth, it/he (talk/contribs) 00:54, 2 September 2024 (UTC)Reply
Looking at the documentation for {{coord}} is advised anyway, since that'll describe your expected output. Suntooooth, it/he (talk/contribs) 00:56, 2 September 2024 (UTC)Reply
@Suntooooth: Not being familiar with coordinates is the answer, I'm a complete newbie in this context. :)
The property itself (P625, linked above) says that "only WGS84 coordinating system is supported at the moment". I think DMS is only the way it is parsed and shown there (hence the value itself is entered in DMS system). If you use the code above in your browser's console, the result is always in WGS83 system, giving lat and long values instead of degrees-minutes-seconds.
I read the documentation and I think something like {{coord|29.11694|57.88777|display=inline,title}} looks fine for a start. What do you think? Jeeputer Talk 20:35, 2 September 2024 (UTC)Reply
That looks good, yeah! Check with some other articles to make sure specifying N/S and E/W isn't required (for example, check a location in South America - if specifying isn't required, both latitude and longitude will be negative, but if specifying is required they'll be positive). Suntooooth, it/he (talk/contribs) 20:47, 2 September 2024 (UTC)Reply
@Suntooooth: I tested the code on Contando a féria and both latitude and longitude are negative. Looks good. I will continue writing the script and will let you know of the result. By the way I will round numbers to 5 decimal places. Jeeputer Talk 20:56, 2 September 2024 (UTC)Reply
WP:AutoEd's core script is an example of how to manipulate the edit field. Godspeed! Aaron Liu (talk) 00:20, 3 September 2024 (UTC)Reply
@Suntooooth: Coord Inserter is almost ready to use. There's an issue with copying the template to clipboard if |coord= not found. I will try to fix the issue tomorrow. But the script works fine with articles having the parameter (example edit).
@Aaron Liu: Thanks for your advice. it took me about an hour to find out how to insert the template into the text area. Btw can you help me with the problem I mentioned? I know that document.execCommand('copy') is deprecated, but there's a weird problem i can't understand. I can explain if you can help. Thanks. Jeeputer Talk 01:35, 3 September 2024 (UTC)Reply
I ran the stuff in the console and got this:

document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler.

Searching it up and following a link from stackoverflow, the deprecated thing can only be used inside an event handler, such as a click listener. So we have a few options to go from here:
  1. Use the new asynchronous clipboard API.
  2. Attach a click handler to the mw.notify that copies the thing.
<aside>The script you copied from seems really crufty. It creates an additional element for seemingly new reason and uses .setAttribute('value', new_url); instead of .value = new_url;.</aside> Aaron Liu (talk) 01:59, 3 September 2024 (UTC)Reply
@Aaron Liu: The weird thing is that when I manually open the edit form of the page and then run the code there, the copy command works. I don't know how to use the clipboard API. Actually, I tried using the API, but as it asks for user's permission to read/write the clipboard, I think it's not the best solution. Attaching an event handler to mw.notify looks fine to me, I will test it. Thank you. Jeeputer Talk 10:54, 4 September 2024 (UTC)Reply
And it's done, problem solved. The template syntax now gets inserted into the clipboard by clicking on the notification. Thank you. Jeeputer Talk 17:02, 4 September 2024 (UTC)Reply
Thanks for your hard work on this script! :] Suntooooth, it/he (talk/contribs) 19:06, 4 September 2024 (UTC)Reply
@Suntooooth: Nevermind. :) I really enjoy it. Let me know if you had any ideas to improve the script, or found any issues. Thanks. Jeeputer Talk 19:14, 4 September 2024 (UTC)Reply
It doesn't seem to be working for me, for some reason - the edit link shows up fine on Category:Articles missing coordinates with coordinates on Wikidata, but when the edit page pops up nothing has changed in the article. I tested it on ¡Cu-Cut! incident and Ahsham-e Sartal. I'm on original Vector rather than Vector 2022, which might be the issue? I'm not sure. Suntooooth, it/he (talk/contribs) 19:36, 4 September 2024 (UTC)Reply
Pinged you on the script's talk page. Jeeputer Talk 20:27, 4 September 2024 (UTC)Reply
Looks like Suntooooth also does Javascript. So maybe he can help too. Jeeputer Talk 01:43, 3 September 2024 (UTC)Reply
Oh, I really don't :P The scripts I've made have entirely been simple portlet links by following tutorials - I do computer science, but Javascript isn't one of the languages I know. Suntooooth, it/he (talk/contribs) 01:48, 3 September 2024 (UTC)Reply

Undo any of your changes by double-clicking them in the preview window

edit

Would it be possible to implement a feature similar to the one in AutoWikiBrowser, where you can preview your changes and then easily undo any of them by double-clicking in the preview window? I didn't see this feature available as a userscript. It would be very helpful, especially when using tools like Wikipedia:AutoEd for semi-automated editing, where multiple changes are made to a page and you sometimes need to quickly undo specific edits without having to scroll back and forth to the editing box. 2001:14BA:9C40:0:B1BC:5F0A:4848:2904 (talk) 22:27, 1 September 2024 (UTC)Reply

1, this would be very useful. Suntooooth, it/he (talk/contribs) 00:55, 2 September 2024 (UTC)Reply
User:Nardog/DiffUndo. Kind of experimental, let me know if it works. Nardog (talk) 04:46, 7 September 2024 (UTC)Reply
Looking great! I wonder if you're aware of the Latin word wikt:diffundo, also known as a Harry Potter spell that cuts things? Aaron Liu (talk) 15:31, 7 September 2024 (UTC)Reply
Thank you very much! It has worked very well in my home wiki so far. (OP) 2001:14BA:9C40:0:21F1:9332:6D2D:A0BA (talk) 20:41, 20 September 2024 (UTC)Reply
Now that I think about it, I also really like another similar feature in AWB, where you can click (once) a change in the preview window, and it will automatically scroll to the corresponding line in the editing box, i.e., places your cursor at that line... :D (OP) 2001:14BA:9C40:0:21F1:9332:6D2D:A0BA (talk) 21:00, 20 September 2024 (UTC)Reply
Similar request at m:Community Wishlist/Wishes/Partial revert undo; it's for already published changes though. Ponor (talk) 14:59, 20 September 2024 (UTC)Reply

Easily add row headers to tables

edit

For accessibility purposes (see WP:DTT), all tables should have "row headers". It is annoying to copy/paste ! scope="row" | ad nauseam and a script to quickly add these to a selected column would be much appreciated. Thanks, Charlotte (Queen of Heartstalk) 18:48, 11 September 2024 (UTC)Reply

Warn the user about unattributed translations

edit

Algorithm:

  1. Run only in mainspace and draftspace
  2. Check the oldest 10 edit summaries of the article for the word "translat" (i.e. translation, translated, etc.), case insensitive.
  3. If 2 is present, check the wikicode of the talk page for the word "translat", case insensitive.
  4. If 2 is present and 3 is not present, display a warning at the top of the page that says "Warning: This article is likely an unattributed translation. Please consider adding {{Translated from}} to the talk page." If you'd like an example of how I usually display page warnings in my user scripts, see User:Novem Linguae/Scripts/DetectG4G5.js, which displays a red bar at the top.

Would do myself but I'm a bit busy this month. Thanks in advance for any help. –Novem Linguae (talk) 08:32, 17 September 2024 (UTC)Reply

User:Vanderwaalforces/checkTranslationAttribution.jsNovem Linguae (talk) 10:33, 17 September 2024 (UTC)Reply

Generating pings from past discussions

edit

  You are invited to join the discussion at User talk:Awesome Aasim § Generating pings from past discussions. Sdkbtalk 02:03, 20 September 2024 (UTC)Reply

Merger wizard

edit

Is there a user script which allows people to easily propose and finish merges. The current process is prone to error and takes a long time to be finished. If there is one like it, that would be great in combating the backlog. Tavantius (talk) 21:24, 24 September 2024 (UTC)Reply

What kind of features are you looking for? Copy paste the old article into the bottom of the new article in a new section, then WP:BLAR the old article? –Novem Linguae (talk) 22:47, 24 September 2024 (UTC)Reply
Huh, if a script did that and added all the copied tags and old id's etc., that would be genuinely great. CMD (talk) 02:37, 25 September 2024 (UTC)Reply
Basically I want it to help create a merging discussion and if the discussion closes as merge, it'll help you copy-paste parts of the old article into the new article and do all the tagging as well. Tavantius (talk) 12:20, 26 September 2024 (UTC)Reply
There is Easy-Merge that does some of what you're requesting. ~Kvng (talk) 17:08, 21 October 2024 (UTC)Reply

"Was" in TV articles

edit

I'm still finding TV show articles that follow the form "Name of show was" despite MOS:TV having long established "Name of show is" as a standard. Could a bot be made to find cases of articles still using "was"? Maybe search for that word in the first sentence? Ten Pound Hammer(What did I screw up now?) 19:11, 28 September 2024 (UTC)Reply

WP:QUARRY might be more suited for this. Nardog (talk) 02:19, 7 October 2024 (UTC)Reply
I don't think so – Quarry does not have access to page content, so queries which require checking wikitext cannot be answered with Quarry. jlwoodwa (talk) 00:24, 14 October 2024 (UTC)Reply
I would have thought that at least the lead was available since it's cached for Page Previews. Nardog (talk) 07:22, 14 October 2024 (UTC)Reply
Check out {{search link}} ~Kvng (talk) 17:13, 21 October 2024 (UTC)Reply

wikispecies:User:Rillke/createRedirects.js no longer working

edit

Hello,

On Wikispecies, there is a user script created by Rillke, wikispecies:User:Rillke/createRedirects.js, which has not been functional for several months: wikispecies:Wikispecies:Village Pump/Archive 68#The script common.js.

The script is used to create redirects to a given page. See for example wikispecies:Epipactis helleborine subsp. helleborine. When using the script, a first click on a toolbar link labeled "Create Redirects" highlights all potential redirects to be created; in this case, all the names in italics listed under the heading "Synonyms" are highlighted (e.g., Serapias helleborine var. latifolia, Cymbidium latifolium, etc.). It is possible to deselect some of them by clicking on the highlighted names. A second click on the link will then create the redirects to wikispecies:Epipactis helleborine subsp. helleborine.

Rillke was contacted, but they said they were "currently out of capacity" (see commons:User talk:Rillke/Discuss/2019#common.js).

When using the script, it no longer highlights potential redirects. Could someone help us understand why this script is no longer working? Thanks in advance, Korg (talk) 11:41, 3 October 2024 (UTC)Reply

Seems like it's due to mw:Heading HTML changes. I've forked and patched it at species:User:Nardog/createRedirects.js. Nardog (talk) 02:15, 7 October 2024 (UTC)Reply
Many thanks Nardog for the explanation and for patching the script! All the best, Korg (talk) 10:53, 8 October 2024 (UTC)Reply

See further discussion at wikispecies:User talk:Nardog#createRedirects.js. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 15:32, 7 October 2024 (UTC)Reply

User:Bellezzasolo/Scripts/arb

edit

Hi. Is it possible for someone to take this over? Bellezzasolo hasn't edited for five months, and it looks like his script stopped working when ARBDS changed to CTOPs (see FormalDude's note on its talk and my illustation). But it's phenomonally useful; any thoughts? SerialNumber54129 14:30, 10 October 2024 (UTC)Reply

Serial Number 54129: I've applied an update to this script, and fixed a couple of things along the way. There are still duplicate entries in the dropdown; that's more or less unavoidable since the duplicates are there in the original list itself. Let me know if you run into any issues. Writ Keeper  15:54, 10 October 2024 (UTC)Reply
Wow, thanks Writ_Keeper! It works great—thanks very much! Wish I'd asked a few months ago now  :) SerialNumber54129 16:04, 10 October 2024 (UTC)Reply
@Serial Number 54129. I use User:TheresNoTime/Scripts/CT-Helper.js nowadays. –Novem Linguae (talk) 10:50, 21 November 2024 (UTC)Reply
Thanks Novem Linguae! Tight faded male arse. Decadence and anarchy. A certain style. Smile. 12:11, 21 November 2024 (UTC)Reply

User:Enterprisey/unblock-review

edit

Would someone be interested in adopting this? Right now, there are only about 50 of us using it, but that's because it has a couple of unreliability issues.

  1. Sometimes it just fails harmlessly, with no message to the user -- it just doesn't do anything at all.
  2. Sometimes (pretty often) it fails slightly harmfully, putting the desired text in the wrong place (usually in a block notice where the example unblock request is presented).
  3. It automatically submits the changed page, with no chance to preview.

I'm thinking that the second problem has to do with a check for "tlx|unblock" failing -- a regex issue? something to do with "chunkFiftyCharactersWide" being a wrong "chunk"? The first problem just needs an informative popup, but it would be nice to actually fix that problem. The third, I imagine, is where the "postWithToken" occurs; both the "accept" and "decline" should do the same thing "Show preview" does, i.e., show a preview.

I could study debugging scripting and all that, but I'd just as soon someone who already knows how do these (apparently) little things. --jpgordon𝄢𝄆𝄐𝄇 18:19, 29 October 2024 (UTC)Reply

I've worked on this user script before. If you can make me a list of bugs (oldid and description for each bug), I can probably find some time to take a look at it. The last time I worked on this I reorganized the code into a wikicode in -> wikicode out function and set up unit tests, so this shouldn't be terribly hard to work on. –Novem Linguae (talk) 22:28, 29 October 2024 (UTC)Reply
Assume I'm ignorant. (And it's amazing what skills can vanish after 20 years of retirement from the profession.) I just listed the bugs/deficiencies above; oldid of what? --jpgordon𝄢𝄆𝄐𝄇 22:46, 29 October 2024 (UTC)Reply
Pardon my lack of clarity. By oldid I mean a link to the revision of the page that failed. I need to go grab the wikitext so I can reproduce the error. Here's an example. Notice how the URL had &oldid= in it :) –Novem Linguae (talk) 03:07, 30 October 2024 (UTC)Reply
I've been here two decades, I know exactly what an oldid is; you didn't specify the oldid of what. Try this one: [2]. It will fail as described in #2 above. --jpgordon𝄢𝄆𝄐𝄇 15:14, 30 October 2024 (UTC)Reply
What I was trying to say is the most useful format for me would be a list like this...
  • Bug1: oldid, description
  • Bug2: oldid, description
  • Bug3: oldid, description
Will take a look at the above diff when I get time. Stay tuned. –Novem Linguae (talk) 21:52, 30 October 2024 (UTC)Reply
  • 1: [3]. Fails silently.
  • 2: [4]. Result ends up in wrong place
  • 3: All instances, feature change: it needs to let us review rather than simply publishing.

Thanks for your help. --jpgordon𝄢𝄆𝄐𝄇 01:28, 31 October 2024 (UTC)Reply

4: [5]. Result overwrites the section above it. –Novem Linguae (talk) 03:40, 31 October 2024 (UTC)Reply
I forked the user script tonight and started refactoring the code to make it more readable, and kind of just refreshed my memory about how this user script works. You can install it at User:Novem Linguae/Scripts/UnblockReview.js if you want. Don't forget to turn off the old user script in your common.js so that the two don't clash. No bug fixes yet, but will work on this again soon. –Novem Linguae (talk) 05:14, 31 October 2024 (UTC)Reply
Cool. I'll start using it. --jpgordon𝄢𝄆𝄐𝄇 05:31, 31 October 2024 (UTC)Reply
User:Novem Linguae/Scripts/UnblockReview.js is now ready for wider use, if anyone would like to try it out. –Novem Linguae (talk) 10:48, 21 November 2024 (UTC)Reply
I highly recommend it; it works much better than Enterprisey's version. --jpgordon𝄢𝄆𝄐𝄇 15:46, 21 November 2024 (UTC)Reply
edit
Potential color for Featured article icon
Potential color for Good article icon

Currently, there are two standard wikilink color options: blue if there is an article, and red if there is not. For those who wish to add this script, including myself, I would love to have a script that displays green wikilinks to denote Good Articles, and gold wikilinks to denote Featured Articles. The main purpose of this script would be to help users tell at a glance if an article has achieved one of these high status', without having to visit/click on the article. If not just for personal interest, this could be used to tell how close a topic is to becoming a Good or Featured Topic, and likewise to tell if a Good or Featured Topic should be delisted if a link suddenly loses its color.

The logistics and formatting for what this script could potentially look like can be found on metawiki:Community Wishlist/Wishes/Add preference option for green and yellow wikilinks to denote Good and Featured Articles. While this is still an active wishlist item, I was recommended on the proposals talk page to ask for this to become a script first. This is my first time doing this, but I'd love to see the creation of this by anyone willing to take up the project. Cheers! Johnson524 21:50, 18 November 2024 (UTC)Reply

  Doing... JJPMaster (she/they) 04:40, 24 November 2024 (UTC)Reply
@Johnson524: I had gone through a lot of trial and error to attempt to create this script, but then I discovered that User:Anomie/linkclassifier.js did the same thing and more. You can install that, and you'll get your desired effect by adding the following to your common.css:
.featured-content { color: #a07e60 !important; }
.good-content { color: #006622 !important; }
I apologize for the inconvenience. JJPMaster (she/they) 07:11, 24 November 2024 (UTC)Reply
@JJPMaster: Thank you so much for your work! I really appreciate you finding this, cheers from North Carolina 🙂 Johnson524 07:28, 24 November 2024 (UTC)Reply
@JJPMaster: Actually, I'm sorry to be a bother, but I put the code above on my page User:Johnson524/common.css, and Anomie's code on User:Johnson524/monobook.js, and I still don't see any changes, could you help me with what I'm doing wrong? Thanks! Johnson524 07:39, 24 November 2024 (UTC)Reply
@Johnson524: Oh, that advice to add it to monobook.js is actually out of date—add it to Special:MyPage/common.js instead. JJPMaster (she/they) 14:15, 24 November 2024 (UTC)Reply
This is really good. I really like it. I already had green as my redirect colour, going to have to figure out where I set it to change it to something else. Lee Vilenski (talkcontribs) 14:28, 24 November 2024 (UTC)Reply