Wikipedia:User scripts/Requests/Archive 9
![]() | This is an archive of past discussions on Wikipedia:User scripts/Requests. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current main page. |
Archive 5 | ← | Archive 7 | Archive 8 | Archive 9 |
Feedback on user script chatbot

I wrote a user script called WikiChatbot to assist editors. It can summarize, reformulate, copyedit, and provide suggestions on additional topics, images, and wikilinks as well as assess factual accuracy and bias. It is used by selecting text in an article and then clicking one of the buttons on the right to enquire about the selected text. The chatbot can also be used by typing specific questions about the selected text or the topic in general in the chat panel.
The script uses the AI model GPT 3.5. It requires an API key from OpenAI. New OpenAI accounts can use it freely for the first 3 months with certain limitations. The AI model was not designed to assess or improve encyclopedic articles. Editors should always question its responses and rely on their own judgment and reliable sources instead. For a more detailed description of all these issues and examples of how the script can be used, see the documentation at User:Phlsph7/WikiChatbot.
I was hoping to get some feedback on the script in general and how it may be improved. I'm not sure how difficult it is to follow the instructions so it would be great if someone could try to set up the script, use it, and explain which steps were confusing. My OpenAI account is already older than 3 months so I was not able to verify the claims about the free period and how severe the limitations are. If someone has a younger account or is willing to open a new account to try it, that would be helpful. Other feedback on the idea in general, its problems, new features to implement, or the documentation is also welcome. Phlsph7 (talk) 07:45, 16 July 2023 (UTC)
- @Phlsph7: You may want to ask for feedback at WP:VPM because I'm afraid this page isn't very heavily watched. —CX Zoom[he/him] (let's talk • {C•X}) 08:00, 19 July 2023 (UTC)
- Thanks for letting me know. I followed your suggestions, see Wikipedia:Village_pump_(miscellaneous)#Feedback_on_user_script_chatbot. Phlsph7 (talk) 09:08, 19 July 2023 (UTC)
byte filter on contributions page
I found this from 2008 while searching for a script for this: Wikipedia:User scripts/Requests/Archive 2#Watchlist filter for + and - bytes ?
Is there a script to make same thing on Special:Contributions page? Tehonk (talk) 10:03, 22 July 2023 (UTC)
- @Tehonk Never felt the need to do/have something like that, but one could use pl:User:Nux/LongTableFilters.js as a base for that.
- The `prepareTable` would need to be changed (especially `itemProperty` and selector in `init`).
- `itemToText` is overcomplicated there. It could simply return number of edits there.
- I guess I should publish ViewFilter to npm... Somedaytm ;). Nux (talk) 11:01, 22 July 2023 (UTC)
Calculation bot for editors contributions to an article for credits
This came up in a discussion at ITN on the idea of crediting updaters. I'd say top 3 or all above 20% but it might help to first find a broader consensus who is to be credited. Paradise Chronicle (talk) 05:44, 25 July 2023 (UTC)
- @Paradise Chronicle: This page is for requesting scripts only. You should try asking in Wikipedia:Bot requests. – MaterialWorks 10:35, 25 July 2023 (UTC)
- Uhh, thanks Paradise Chronicle (talk) 10:48, 25 July 2023 (UTC)
PROD review tool
Reviewing proposed deletions comes with a lot of secondary tasks, and it would be great to have a userscript to help automate the process. I am suggesting something like User:Jackmcbarn/editProtectedHelper, where the script activates whenever a page has an active PROD, and provides the reviewer with buttons for the actions they can take, such as seconding the PROD or contesting the PROD.
If you second the PROD, the script should add {{prod 2}} to the page and update the {{old prod}} on the talk page accordingly. If you contest the PROD, it should remove the PROD template from the article, notify the nominator on their Talk page with {{Deprod}}, and again update the {{old prod}} on the talk page accordingly.
It doesn't need to cover the PROD nomination process since that can already be automated through Twinkle. ––FormalDude (talk) 01:16, 3 August 2023 (UTC)
- One other small point, contesting should remove {{prod}} and any {{prod 2}} instances (zero or more of these may exist) from the article. ~Kvng (talk) 02:07, 3 August 2023 (UTC)
external css for a user script?
Is that possible?
This question comes from User talk:Trappist the monk/HarvErrors § Color style cannot be overridden in common.css. It is possible to override the styling applied by that script but to do so requires the !important
keyword. Is it possible to get a .js to read an external stylesheet?
If yes, how is that done? My .js skills are rudimentary at best so a detailed answer would be much appreciated. Extending this just a bit, would it be possible to use a .css TemplateStyles page so that the .css could be shared by a lua module?
—Trappist the monk (talk) 23:21, 20 August 2023 (UTC)
- In my less-than-rudimentary js, what if we had two classes on the error message line, with the first class defined in a <style> block inserted onto the page by the script (right before
</head>
?) and defining the default color, leaving the second class undefined and available for override at common.css, is that doable in js so that an external sheet wouldn't be needed? Mathglot (talk) 00:02, 21 August 2023 (UTC) - You can use
mw.loader.load('/w/index.php?title=...&action=raw&ctype=text/css', 'text/css')
. But that means loading an extra resource after the script is loaded, so I for one prefer just embedding the CSS within the script withmw.loader.addStyleTag()
. Nardog (talk) 02:50, 21 August 2023 (UTC)- Doc pages: mw.loader load method, mw.loader Methods, and mw.loader addStyleTag method. Mathglot (talk) 03:12, 21 August 2023 (UTC)
mw.loader.addStyleTag()
was the easier so I did that; see lines 5–8. Seems to work except that to override the default color in user css the!important
keyword is still required. Any way around that?- —Trappist the monk (talk) 15:18, 21 August 2023 (UTC)
- See my message of 00:02: I believe if you change your style tags in the new code to blah_blah_dflt, and change line 32:
mw.loader.addStyleTag ('.ttm_harv_err_dflt {color:DarkOrange}'); // no target error message default color . . . $(elem.parentNode).append(" ", $("<span class=\"ttm_harv_err_dflt ttm_harv_err\">Harv error: link from " + href + " doesn't point to any citation.</span>")); //start with dflt, allow user override
- it should work without
!important
; i.e., this should be sufficient in common.js:.ttm_harv_err {color:darkseagreen}
- Naturally, the other defaults and error lines to be done similarly. Mathglot (talk) 17:35, 21 August 2023 (UTC)
- Trying it in html, and didn't work as expected; trying something else... Mathglot (talk) 17:52, 21 August 2023 (UTC)
- Ported your script to User:Mathglot/HarvErrors.js and tried a couple of things there; failed in the same way (that is, it doesn't work without
!important
, but your original version already did that). Still thinking, but so far at least, I don't see a way to work around the style priority cascade *without*!important
. Mathglot (talk) 22:08, 21 August 2023 (UTC)
- Take addStyleTag() outside the callback to
mw.hook( 'wikipage.content' ).add()
. Otherwise it would be adding the tags every time the hook is fired (e.g. previewing). You also don't need it for each declaration, it should be just one tag. Nardog (talk) 00:33, 22 August 2023 (UTC)- Thanks for that tip. Done.
- —Trappist the monk (talk) 01:06, 22 August 2023 (UTC)
- The reason you can't just override the styles is that the script adds them after user CSS. I guess you could make it not take precedence by passing e.g. whatever is the first
<style>
in the document as the second argument to addStyleTag(), but that seems overkill; instructing those who want to override the default styles to use higher specificity (e.g.body .ttm_harv_err {...}
) strikes me as the obvious solution, as that's the usual way of overriding CSS so it's applicable in most other situations. Nardog (talk) 00:49, 22 August 2023 (UTC)- More specificity works without
!important
:body .ttm_harv_err {color:black; background-color:cornsilk}
- Could make it even more specific, right? Something like this:
.mw-parser-output .ttm_harv_err {color:black; background-color:cornsilk}
- That is be more in keeping with cs1|2 overrides (Help:CS1 errors § Error and maintenance messages).
- Thank you.
- —Trappist the monk (talk) 01:06, 22 August 2023 (UTC)
.mw-parser-output .ttm_harv_err
is in fact less specific thanbody .ttm_harv_err
because.mw-parser-output
is subordinate tobody
, but as long as it's more specific than whatever the script inserts, it works. Nardog (talk) 01:12, 22 August 2023 (UTC)
- I was starting to look at adding two lines to load two css files, one the default, living with the script, and the other, a user file (if it exists) something like this:
loadcssfile("HarvErrors.css", "css") //dynamically load the default .css file loadcssfile("Special:MyPage/HarvErrors.css", "css") //dynamically load user's .css file (if exists)
- where loadcssfile would be a function adapted mostly from lines 7–14 here, so that the default css defined in the script userspace is loaded first, followed by the user css (if it exists) at [[Special:MyPage]]/HarvErrors.css. Is this still worth pursuing at all, or is the approach that you (@Nardog and Trappist the monk:) are developing close to bearing fruit (or already there)? Btw, I don't know how to interpret [[Special:MyPage]] in js, do I just add brackets around it, as usual? Escape them? Mathglot (talk) 01:34, 22 August 2023 (UTC)
- Not worth it. Querying the server if a page exists and then loading an external resource on top of the script itself would be unnecessarily slow and traffic-wasting. Nardog (talk) 01:39, 22 August 2023 (UTC)
- Thank you. Mathglot (talk) 01:46, 22 August 2023 (UTC)
- Not worth it. Querying the server if a page exists and then loading an external resource on top of the script itself would be unnecessarily slow and traffic-wasting. Nardog (talk) 01:39, 22 August 2023 (UTC)
- More specificity works without
Script similar to Green Redirects but for piped links
Green Redirects makes redirects green. Please write a similar script for piped links (making piped links green). Thanks. --Mann Mann (talk) 07:51, 16 January 2023 (UTC)
- @Mann Mann: Hi. Try User:Jeeputer/highlightPiped. You can use This page for testing. If you have GreenRedirects installed, or have Preferences → Gadgets →
Display links to disambiguation pages in orange enabled, piped links to redirect and/or disambiguation pages will appear like "|Link" and "|Link" respectively. Note that links like
[[Ship]]s
are also considered as piped links as there's no way for the script to distinguish them from piped links. Let me know if you have any suggestions or encountered any problems. Jeeputer Talk 06:25, 24 August 2023 (UTC)
- Hi. Thank you very much. Cheers! --Mann Mann (talk) 12:44, 24 August 2023 (UTC)
- @Mann Mann: You're very welcome. :) I also added custom color. See User:Jeeputer/highlightPiped#Custom color. Jeeputer Talk 01:12, 25 August 2023 (UTC)
- Hi. Thank you very much. Cheers! --Mann Mann (talk) 12:44, 24 August 2023 (UTC)
Reforder
Hi! I was wondering if we could have a script that automatically changed the refs in an article to be in numerical order. So [6][41][1] becomes [1][6][41] etc Lee Vilenski (talk • contribs) 15:02, 23 August 2023 (UTC)
- Is that something recommended by PAG? As both a reader and editor I prefer and expect clusters of refs to be ordered according to the relevance to the statement being supported or to the order in which the cited pieces of information appear in the statement, not to the order in which the refs appear in the whole article. Nardog (talk) 15:11, 23 August 2023 (UTC)
- I think almost every FAC I've been involved in suggests doing so. There is a (large) discussion about this being an automated process before - see WP:REFORDER, however, a tool that you can run to make this happen, rather than something to attach a large amount of articles is helpful.
- I've never found the argument that the first ref should be the one that is most relevant to be misguided, because if the second ref isn't as helpful, it shouldn't be there, or, it should be moved to only cite parts that it actually covers. Lee Vilenski (talk • contribs) 15:16, 23 August 2023 (UTC)
- You cite multiple sources not necessarily because not all information appears in the first but usually because they demonstrate the statement together.
- Besides, the numbers constantly change as named refs are removed in certain parts but not from the page altogether and as paragraphs are shuffled around. Strikes me as a pointless endeavor. Nardog (talk) 15:25, 23 August 2023 (UTC)
- You shouldn't really use references to show information as a combination of the information between them (see WP:SYNTH). Maybe this needs a wider discussion, but it's very common for this to be requested upon review. Lee Vilenski (talk • contribs) 15:39, 23 August 2023 (UTC)
- As a reader and as an editor, I prefer
She was born in New York City in 1991.[8][3]
overShe was born in New York City[8] in 1991.[3]
, and I would hate if the place of birth was in the second ref and the year in the first. Nardog (talk) 15:45, 23 August 2023 (UTC)
- As a reader and as an editor, I prefer
- You shouldn't really use references to show information as a combination of the information between them (see WP:SYNTH). Maybe this needs a wider discussion, but it's very common for this to be requested upon review. Lee Vilenski (talk • contribs) 15:39, 23 August 2023 (UTC)
- If fixing the citation order is the norm at FAC, then that seems like sufficient consensus to me to make this user script. Just need to find a programmer with enough time. –Novem Linguae (talk) 09:22, 25 August 2023 (UTC)
- That's my impression too. I've had it asked repeatedly to be done, and it's not something particularly simple to do without a script. Lee Vilenski (talk • contribs) 12:33, 27 August 2023 (UTC)
- If it matters, as a common FAC/FLC reviewer, I prefer the refs to be in numerical order- think there's definitely value in this idea. MyCatIsAChonk (talk) (not me) (also not me) (still no) 12:34, 27 August 2023 (UTC)
- Reviewers shouldn't be imposing what they "prefer". If you think the order should be in a particular way, you should seek consensus to make it part of our MoS. Nardog (talk) 12:40, 27 August 2023 (UTC)
- I fail to see where it says in our MOS that we put citations in "relevance" order either. I'm happy to start up a formal discussion on the subject, as I had always thought that the continual requests to put this into numerical order was standard. Lee Vilenski (talk • contribs) 12:44, 27 August 2023 (UTC)
- False equivalence. I never demanded others follow my preference. Nardog (talk) 12:47, 27 August 2023 (UTC)
- I've started up a conversation at Wikipedia talk:Citing sources#Reference order for wider input. I'm happy to not change the references, but we also need a discussion to point to that shows that is the community view. Lee Vilenski (talk • contribs) 12:52, 27 August 2023 (UTC)
- False equivalence. I never demanded others follow my preference. Nardog (talk) 12:47, 27 August 2023 (UTC)
- I fail to see where it says in our MOS that we put citations in "relevance" order either. I'm happy to start up a formal discussion on the subject, as I had always thought that the continual requests to put this into numerical order was standard. Lee Vilenski (talk • contribs) 12:44, 27 August 2023 (UTC)
- Reviewers shouldn't be imposing what they "prefer". If you think the order should be in a particular way, you should seek consensus to make it part of our MoS. Nardog (talk) 12:40, 27 August 2023 (UTC)
Mass patrol new pages by a user
Admins assign editors autopatrolled based on a WP:PERM request or because they show up in automated reports. As part of that process, we review their creations as a whole and decide that they don't need to be manually patrolled. It would therefore make sense to be able to mark all their prior unreviewed creations as patrolled, rather than either tediously clicking through them all, or leaving another NPPer to do a now-pointless second review.
It would also be useful for non-admin NPPers for e.g. runs of noncontroversial stubs by the same trusted user.
Alternatively, there could be a tool which patrols all pages in a user's filtered Special:NewPagesFeed (which can be filtered by user). But I think that could be quite dangerous if you mess up your filters... – Joe (talk) 13:58, 12 September 2023 (UTC)
- Algorithm: You'd want to do an API query such as Special:ApiSandbox#action=pagetriagelist&format=json&showunreviewed=1&username=Skysmith&formatversion=2, then loop over the results and do an API query such as action=pagetriageaction&pageid=123&reviewed=1&token=123.
- I feel like a patch to User:MusikAnimal/userRightsManager.js to do this automatically when granting autopatrol might be better than creating a new script. If needed, it could be controlled by a checkbox that the user ticks. Pinging @MusikAnimal –Novem Linguae (talk) 14:17, 12 September 2023 (UTC)
- Sounds like a great idea! I might be able to work on this soon, but by all means if you want to code it @Novem Linguae then please do (create a fork and I'll help test). While we're at it, maybe it's time we gadgetize userRightsManager and move the code to https://github.com/wikimedia-gadgets/. Enough people use it that I feel it should be in the community's hands and not solely my own. — MusikAnimal talk 16:29, 12 September 2023 (UTC)
- Thanks for the quick reply. Finding time is the tricky part! Will add it to my list of possible future hacking projects. –Novem Linguae (talk) 14:24, 13 September 2023 (UTC)
- Sounds like a great idea! I might be able to work on this soon, but by all means if you want to code it @Novem Linguae then please do (create a fork and I'll help test). While we're at it, maybe it's time we gadgetize userRightsManager and move the code to https://github.com/wikimedia-gadgets/. Enough people use it that I feel it should be in the community's hands and not solely my own. — MusikAnimal talk 16:29, 12 September 2023 (UTC)
See what is adding a category to a page
Is there a way to see what exactly is adding a certain category to a page?
There are cases where you want to remove a category from a page but you quickly understand that it is being added by a template and not a manual category. Problem is that they may be countless of templates in the said page, each with different intricacies and transclusions. Is there a way or a script to see where categories are being added from? - Klein Muçi (talk) 12:50, 22 September 2023 (UTC)
- Special:ExpandTemplates should help you. Doing this accurately would require substing the templates one by one so I doubt there's an efficient way. Nardog (talk) 16:25, 22 September 2023 (UTC)
- Nardog, would your suggestion help in solving this case if it wasn't solved? :P — Klein Muçi (talk) 19:51, 22 September 2023 (UTC)
- I can't tell because it's been fixed. But if you had pasted the source of the article onto sq:Special:ExpandTemplates (be sure to fill in the context title) the category would have showed up near the cause of the error. Nardog (talk) 05:11, 23 September 2023 (UTC)
- Nardog, I see. Maybe in the future we can have that as tool that does that all the time for all categories at a click of a button beside them in pages. Assuming other people may encounter it as a problem. For me, this is enough as this is only the second time ever in 10 years I encounter such problem. Thank you!
— Klein Muçi (talk) 10:28, 23 September 2023 (UTC)
- Nardog, I see. Maybe in the future we can have that as tool that does that all the time for all categories at a click of a button beside them in pages. Assuming other people may encounter it as a problem. For me, this is enough as this is only the second time ever in 10 years I encounter such problem. Thank you!
- I can't tell because it's been fixed. But if you had pasted the source of the article onto sq:Special:ExpandTemplates (be sure to fill in the context title) the category would have showed up near the cause of the error. Nardog (talk) 05:11, 23 September 2023 (UTC)
- Nardog, would your suggestion help in solving this case if it wasn't solved? :P — Klein Muçi (talk) 19:51, 22 September 2023 (UTC)
Script to convert numeric ref names created by VE into standard names
Please write a script to alter numeric ref names created by the WP:Visual Editor into reasonable reference names, such as Lastname-YYYY. For example, operating on the article Male gaze, it would change (among others), the reference
<ref name=":62">{{Cite book|last1=Christiansen|first1=Keith|title=Orazio and Artemesia Gentileschi|last2=Mann|first2=Judith|publisher=Metropolitan Museum of Art|year=2001}}</ref>
into
<ref name="Christiansen-2001">. . .</ref>
Two additional options would be very welcome:
- a throttle (perhaps,
|max=N
), in order to keep the total number of changes down to a configurable number per edit; this is because as the number gets higher, diffs become increasingly difficult to read and interpret. - numeric (or named) parameters which could be used to override the automatic use of Lastname-YYYY, for a given numeric refname value. This would be useful, in cases where a named reference doesn't use one of the {{citation}} templates (such as, ref ":1" at Male gaze), or where the last name or year is not available (such as ref ":1" at Charles de Gaulle). In the latter case, including the parameter
|1=Election-1958
would result in the code
<ref name=":1">{{cite web |title=Assemblée nationale. . .</ref>
at Charles de Gaulle, being converted to
<ref name="Election-1958">{{cite web |title=Assemblée nationale. . .</ref>
regardless if a different name and year were found, or if none were found. However, the basic functionality of just repairing numeric ref names without any other bells and whistles would be very welcome. See WP:VE/NAMEDREFS for phab tickets about this, and other related info. Mathglot (talk) 07:03, 19 December 2022 (UTC)
- While I can't contribute to this at all, this would be fantastic! I know the VE ref names have been a persistent problem. ThadeusOfNazereth(he/him)Talk to Me! 19:17, 19 December 2022 (UTC)
- @Mathglot and ThadeusOfNazereth: User:Nardog/RefRenamer. Feel like I may have gone overboard with options but you may try it out (at your own risk, as always). Nardog (talk) 16:37, 7 February 2023 (UTC)
- This seems to be working great - I used it on a page w/100+ references and there were zero issues! ThadeusOfNazereth(he/him)Talk to Me! 17:03, 7 February 2023 (UTC)
- Wow. A very impressive piece of software. Great job Nardog. –Novem Linguae (talk) 18:42, 7 February 2023 (UTC)
- "Wow" is right; truly amazing. Thank you so much for this; it is going to be incredibly useful and helpful, a huge timesaver, and big improvement for the project. It went beyond what I imagined, and worked great at Male gaze and Charles de Gaulle. Don't worry about going overboard with options, they are wonderful. That said, I had to stare at the panel a bit to try to understand all the features, and for a couple of things it wasn't entirely clear right away. I've added a section at the script talk page with some § Questions/suggestions for you. But if you've had enough for now, don't worry; it's great as is! Thanks again, Mathglot (talk) 03:10, 9 February 2023 (UTC)
I've been attempting to put a naming protocol in place. I built it into a function in my Sources script whereby names for bare refs can be generated. Perhaps we could work together to create a coherent set of rules to give names to bare or VE-named ref tags7.-- Ohc revolution of our times 20:50, 23 September 2023 (UTC)
- @Ohconfucius:, good idea. Also, while you're thinking about it, please have a look at User talk:Nardog/RefRenamer#Optional alpha uniqueness suffix, and feel free to comment there or here or whatever makes most sense. Thanks, Mathglot (talk) 00:23, 24 September 2023 (UTC)
Infobox reformatting
I generally want large templates to have the source "block" formatted – one parameter per line and generally with some whitespace. I often encounter infoboxen that have been created all-in-one-line. Is there, or could there be, a userscript to help with this reformatting? (Also asked at WP:VPT) — GhostInTheMachine talk to me 15:16, 8 November 2023 (UTC)
- It's a hack, but have you tried editing the lead section of the article in question using the Visual Editor? Add
&veaction=edit
to the edit page link. If the infobox's TemplateData is correctly set to "block", VE might do the formatting for you. – Jonesey95 (talk) 15:55, 8 November 2023 (UTC)- It does work, but the process is tedious – change config to use VE, dummy edit in the text of the infobox, reset config, fix the dummy edit, then do what I wanted to do. The script below is so much better — GhostInTheMachine talk to me 19:44, 8 November 2023 (UTC)
- User:Taavi/Aligner works. Nardog (talk) 17:34, 8 November 2023 (UTC)
- It does!! Thank you! This is the script I was looking for. The script is simply awesome and awesomely simple to use. Sometimes it gets a bit befuddled about a mix of spaces and not-spaces after a bar, but generally a second run solves that — GhostInTheMachine talk to me 19:44, 8 November 2023 (UTC)
Script for highlighting redirects with possibilities
I'd like a user script that highlights links in articles that go to redirects tagged with {{R with possibilities}}, indicating that they have been identified as candidates for new articles. Such a script, if adopted widely, might help encourage the creation of such articles (or, if tagged incorrectly, the removal of the possibilities tag).
Given that such articles are technically blue links but in spirit red links, I'd propose a red dashed border, as in Example, as the visual design. But someone more graphically capable than me might be able to come up with something better.
Cheers, {{u|Sdkb}} talk 05:05, 8 December 2023 (UTC)
- If you use Anomie's link classifier, you can add custom category-based highlighting very easily. Headbomb {t · c · p · b} 21:46, 8 December 2023 (UTC)
- @Headbomb, thanks for pointing me to that! It looks like it should work, given that (nearly) all redirects with possibilities are in Category:Redirects with possibilities. But the documentation is unfortunately not good enough for me to figure out how to use it. The hook
to adjust the list of categories
is I think what I want, but it's not clear what is a core part of the script versus something I need to customize, and I'm not sure where to plug in the<span style="border: 1.5px dashed #d33; padding: 3px;">[[Example]]</span>
. Would you be able to help? {{u|Sdkb}} talk 17:31, 9 December 2023 (UTC)- As shown in the doc, add something like this in your common.js before calling
importScript()
:No need to modify the script itself at all. Then in your common.css you can add a rule like this to style it:mw.hook( 'LinkClassifier' ).add( function ( linkClassifier ) { linkClassifier.cats['redirect-with-possibilities'] = [ 'Category:Redirects with possibilities' ].sort(); } );
HTH. Anomie⚔ 17:56, 9 December 2023 (UTC)a.redirect-with-possibilities { border: 1.5px dashed #d33; padding: 3px; }
- Thanks; looks like it works! {{u|Sdkb}} talk 05:22, 11 December 2023 (UTC)
- As shown in the doc, add something like this in your common.js before calling
- @Headbomb, thanks for pointing me to that! It looks like it should work, given that (nearly) all redirects with possibilities are in Category:Redirects with possibilities. But the documentation is unfortunately not good enough for me to figure out how to use it. The hook
Auto-expand V22 floating TOC subsections when the subsection's parent section is active
Something like the demo at mw:Skin:Vector/2022/Design documentation § 2) Why are sub-sections collapsed by default?. Aaron Liu (talk) 00:26, 20 December 2023 (UTC)
Auto-NOPIPE
Would it be possible to create a script that would identify unnecessary piped links and simplify them?
The advice given at WP:NOPIPE and MOS:NOPIPE is that piped links are to be avoided when a redirect exists that fits well into the context of the displayed text.
[[Wolfgang Amadeus Mozart|Mozart]]

[[Mozart]]
What I'd like is a script that will scan an article for links of the first type and replace them with links of the second type: that is, where a link of the form [[A|B]]
can be replaced with a link of the form [[B]]
, where [[B]]
is a valid pre-existing redirect to [[A]]
, or where both [[A]]
and [[B]]
redirect to some other page [[C]]
.
Jean-de-Nivelle (talk) 11:48, 26 December 2023 (UTC)
- User:Nardog/Unpipe.js. It's kind of a proof of concept and it might be overeager at replacing links. Nardog (talk) 05:00, 2 January 2024 (UTC)
Sortkeys in lists
I recently went through an article that has a list of organizations and added sortkeys so that all the ones with "the" in their name didn't sort alphabetically by T. It wasn't quite a long enough list to be worth composing a RegEx find and replace to do the whole thing automatically, but it strikes me as a common enough situation that it might be helpful to have a script that can do it. {{u|Sdkb}} talk 15:40, 12 January 2024 (UTC)
- Could you provide the RegEx? That’s sort of what Wikipedia:AutoEd does: regex find and replaces. We could write an AutoEd module with it. Aaron Liu (talk) 17:01, 12 January 2024 (UTC)
- The RegEx query for the find part would be something like
\| The \[\[(\w*)
, and the replace part would be something like\| data-sort-value="$1" \| The \[\[$1
. There would be another find-and-replace for instances in which thethe
is within the link:\| \[\[The (\w*)
→\| data-sort-value="$1" \| \[\[The $1
. Cheers, {{u|Sdkb}} talk 23:42, 12 January 2024 (UTC)- @Sdkb User:Aaron Liu/SortKeyDeThe.js now does this, though it won't do things if the relevant entry isn't at the start of its line to eliminate some false positives.Also, I seem to have misread you, sorry. I thought you said that you already had a regex :p Aaron Liu (talk) 02:52, 14 January 2024 (UTC)
- The RegEx query for the find part would be something like
- Maybe a
data-sort-type="..."
could be created for this form of alphabetical sorting? See: - Help:Sortable tables#Forcing a column to have a particular data type
data-sort-type=text
- alphabetical sort of a table column.data-sort-type=the
- alphabetical sort of a table column. Along with ignoring "the" in front.- I guess it would be a feature request at Phabricator.
- --Timeshifter (talk) 18:01, 12 January 2024 (UTC)
Wikilink suggestions on a given page
Hello, I was suggested by @Tamzin on the discord to post this here, basically the inverse to User:Edward/Find_link, where instead of finding pages that could be linked to a given page, it instead finds pages that could be linked with the current text on the article. There are two different methods i can think of achieving this, either by basically making a permutation set/concordance of the article's text against title search, or just taking the categories/wikiprojects that a page belongs to and checking the articles titles on those categories/wikiprojects to see if they match text on the given page. there's pros and cons to both methods and the best would be able to implement both and automatically use one method or another given on whatever is considered less expensive computationally, or at least letting the user decide which method they'd like to use for a given search. Akaibu (talk) 14:37, 12 February 2024 (UTC)
- In my opinion, this isn't a very good idea. Linking should be done when something isn't very understandable by most people, which is an easy enough criteria for people to manually do drive-by links. Aaron Liu (talk) 22:32, 27 February 2024 (UTC)
Increased Watchlist size
I watch many (currently 3,044 articles), meaning the 1,000 changes, 30 day limit can be annoying sometimes. Could there be a script created to allow for an increase? Thanks. Kew Gardens 613 (talk) 07:27, 16 February 2024 (UTC)
- You can't change this with a user script. I just tested https://en.wikipedia.org/w/index.php?hidemyself=1&hidebots=1&hidecategorization=1&hideWikibase=1&limit=2000&days=30&enhanced=1&title=Special:Watchlist&urlversion=2 (note the limit=2000), and the MediaWiki software silently changes it back to 1000. There's a hard-coded limit in MediaWiki somewhere. You will probably want to subscribe to and post in phab:T151165. –Novem Linguae (talk) 07:46, 16 February 2024 (UTC)
- That links does show 2,000 changes if you use the non-JavaScript interface. Nardog (talk) 23:54, 27 February 2024 (UTC)
Script to show move-protection lock?
I couldn't find anything from a search through the list, and I've tried to engineer one myself but I'm not exactly sure where to start, but essentially I want to display the move-protection lock icon on my side when I view pages with move protection (but no edit protection). The icon itself was removed from displaying on most reader-visible pages since it means nothing to a reader, but I still find myself wanting to quickly be able to glance at the top and see that a page is protected in some way. EggRoll97 (talk) 20:20, 4 March 2024 (UTC)
- I've made User:Aaron Liu/MoveTop.js, though it currently disregards whether the page is protected from editing and adds the padlock regardless, which would display alongside the other padlock. Aaron Liu (talk) 03:34, 5 March 2024 (UTC)
- Thanks, that's amazing! EggRoll97 (talk) 06:07, 5 March 2024 (UTC)
Unknown parameters
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)
- 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)
- @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)
WikiDefcon User Script
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)
- @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)
- Hi, Template:Vandalism information would fit most consistently with other WikiDefcon templates. Thanks,NeuropolTalk 16:17, 2 April 2024 (UTC)
- @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)
- Works great. Thank you so much! Thanks,NeuropolTalk 22:17, 2 April 2024 (UTC)
- @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)
- Hi, Template:Vandalism information would fit most consistently with other WikiDefcon templates. Thanks,NeuropolTalk 16:17, 2 April 2024 (UTC)
Auto-Link Once
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)
- 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)
- @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)
- 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)- 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)
- 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)
- 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)
- 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.
- @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)
Collapsible parentheses in body text
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)
- 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)
- 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)
- Would be easy to only detect them with a preceding space. Aaron Liu (talk) 12:54, 7 June 2024 (UTC)
Fork of Enterprisey's revdel script
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)
- 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)
- 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)
- @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)
- @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)
- 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)
- @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)
- @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)
Sentence/title case
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 (talk • contribs) 12:43, 7 June 2024 (UTC)
- 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)
- 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)
- Yeah, but it sounds it'll also convert stuff that isn't all-caps. Aaron Liu (talk) 17:29, 8 June 2024 (UTC)
- @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)
- A link provided there satisfies my question. It's outlined under MOS:CONFORM. Aaron Liu (talk) 18:36, 8 June 2024 (UTC)
- Thanks for that, sounds like ZKang was well ahead of me. :) Lee Vilenski (talk • contribs) 18:50, 8 June 2024 (UTC)
- A link provided there satisfies my question. It's outlined under MOS:CONFORM. Aaron Liu (talk) 18:36, 8 June 2024 (UTC)
- @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)
- Yeah, but it sounds it'll also convert stuff that isn't all-caps. Aaron Liu (talk) 17:29, 8 June 2024 (UTC)
- 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)
DYK Reviewer tool
Following this discussion, can someone please write a DYK reviewer tool. dxneo (talk) 13:39, 13 June 2024 (UTC)
- Got a link to the steps? –Novem Linguae (talk) 13:51, 13 June 2024 (UTC)
- @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)
Show only blocked users
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)
- @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)
- @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)
- What skin are you using? –Novem Linguae (talk) 13:12, 26 June 2024 (UTC)
- Vector legacy.--Bbb23 (talk) 13:15, 26 June 2024 (UTC)
- 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)- 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)
- 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
- Vector legacy.--Bbb23 (talk) 13:15, 26 June 2024 (UTC)
- @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)
- @Ponor: I don't see a "prompt".--Bbb23 (talk) 13:23, 26 June 2024 (UTC)
- @Bbb23 browser console, section "#Browser Console command line". Ponor (talk) 13:25, 26 June 2024 (UTC)
- 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)
- @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)
- 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)
- @Bbb23 browser console, section "#Browser Console command line". Ponor (talk) 13:25, 26 June 2024 (UTC)
- @Ponor: I don't see a "prompt".--Bbb23 (talk) 13:23, 26 June 2024 (UTC)
- What skin are you using? –Novem Linguae (talk) 13:12, 26 June 2024 (UTC)
- @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)
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)
- @Ponor: Thanks for your persistence. Novem Linguae, your script is perfect! --Bbb23 (talk) 14:52, 26 June 2024 (UTC)
Get the rename history of a page
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)
- ...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)
Mobile edit preview
(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:
Pinging Brooke Vibber for comments. Aymatth2 (talk) 13:19, 3 July 2024 (UTC)