Wikipedia:User scripts/Requests/Archive 5
![]() | 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 1 | ← | Archive 3 | Archive 4 | Archive 5 | Archive 6 | Archive 7 | → | Archive 9 |
Eswatini vs. Swaziland sortkeys
Hello!
The country of Swaziland changed its name to Eswatini in 2018. Nearly all Wikipedia articles and categories that needed renaming have been moved to the new name, see e.g. Wikipedia:Categories for discussion/Log/2018 November 5 § Swaziland.
However, I noticed that this renaming may have left sortkeys that need correction. E.g. I found Category:Wealth in Eswatini in Category:Wealth by country and Category:Wealth in Africa with sortkey Swaziland
, which left Eswatini in sequence between Sri Lanka and Sweden. I corrected them manually to Eswatini
.
Is there a way to find all such sortkeys and have them corrected by a bot? That's how I would do it:
- Look for every article or category that has
Eswatini
as part of its name - Look for category sortkey (found by
[[Category:<whatever>|<sortkey>]]
, sometimes small-casecategory
) or defaultsort ({{DEFAULTSORT:<sortkey>}}
):- If exactly
Swaziland
or a prefix (such asSw
orSwaz
, except just the letterS
), replace byEswatini
exactly - If a longer sortkey includes
Swaziland
, not necessarily in the beginning (such asSwaziland, Economy of
orEconomy of Swaziland
) - For sortkeys that are exactly the letter
S
(and we know that such sortkeys are found quite often), create a list of such occurrences for later manual treatment.
- If exactly
I think it's pretty safe to replace all the cases I have listed because we limit ourselves to titles that have been renamed to a name explicitly including Eswatini, so we would not affect content such as Category:Treaties extended to Swaziland (protectorate), for which Eswatini is anachronical, or Times of Swaziland, which is a proper noun. I think other namespaces (such as Template:) may be better left out for manual action.
Is there any bot master able to fulfill this request? Place Clichy (talk) 10:32, 29 May 2020 (UTC)
- Place Clichy, I made a little script to do them, they should all be fixed now. – BrandonXLF (talk) 06:49, 3 June 2020 (UTC)
- @BrandonXLF: thanks, this looks very good! Were you by any chance able to look up partial prefix matches (such as
|Swazi
), even just to build a list that I could manually take care of later? Place Clichy (talk) 08:26, 3 June 2020 (UTC)- @BrandonXLF: Do you see any reason why e.g. Category:Immigrants to Eswatini was missed? Place Clichy (talk) 00:56, 14 June 2020 (UTC)
- Place Clichy, because it's a category, I didn't have the namespace selected to search, my bad. There seems to be at least 382 categories that need fixing, see [1] and [2]. – BrandonXLF (talk) 02:48, 14 June 2020 (UTC)
- @BrandonXLF: Do you see any reason why e.g. Category:Immigrants to Eswatini was missed? Place Clichy (talk) 00:56, 14 June 2020 (UTC)
- @BrandonXLF: thanks, this looks very good! Were you by any chance able to look up partial prefix matches (such as
Introduction helper
Following up on discussion with Sdkb for a sandbox option. Currently they are using a link such as this one. I'm looking at ditching the random number part - but would want the button to have a link with a script (from ?withJS=) that will:
- Wait for the page to load in editing mode
- Clear the entire editing box
- Populate the editing box with some text (a template subst)
- Add an edit summary
- Possibly submit the edit as well; understand that the script would need to be in mediawiki ns. Example of another button that include a script: Wikipedia:Dispute resolution noticeboard/request.
— xaosflux Talk 16:19, 27 June 2020 (UTC)
- Should be doable - will work on this in the next few days if no one beats me to it DannyS712 (talk) 21:02, 27 June 2020 (UTC)
- So I took a crack at it, and the existence of codemirror and wikieditor make it a lot harder than I thought, sorry DannyS712 (talk) 06:15, 28 June 2020 (UTC)
- @DannyS712: will ditching the publish/submit help? Would be fine to have a dif script for vedit/srcedit. — xaosflux Talk 12:32, 28 June 2020 (UTC)
- The issue is trying to select and manipulate the content of the textbox - preload only works for new pages / new sections, unfortunately. That being said, if it would always be a specific page I have an idea - can you provide an example page and the content that should be on it? DannyS712 (talk) 12:36, 28 June 2020 (UTC)
- @DannyS712: the destination would be fixed, and so would the content - so "preload" can be ditched. Preferably the page could be specified with a link, to be an arbitrary page, so to make the requirements a bit simpler:
- Be able to follow a edit or vedit links such as these:
- After the page loads, in the respective edit mode:
- Clear the entire page
- Drop some static text (hard coded in script) in to the edit summary
- Drop some static text (hard coded in script) in to the editor
- Optional if needed: For the visual editor mode, if it has to start in traditional editor, do the work, then use JS to switch to vedit that could be OK.
- — xaosflux Talk 15:31, 28 June 2020 (UTC)
- I meant can you link to a specific revision with the text you want? Because then you can have the user edit that permalink, and the text will already be set DannyS712 (talk) 15:34, 28 June 2020 (UTC)
- Hmm, that may work too - scriptless at least. — xaosflux Talk 16:18, 28 June 2020 (UTC)
- @Sdkb: going on that, if you just want an "empty" sandbox - or even one with some content that can be edited, would revision edit links solve your use case as well? example source edit link that could be used. — xaosflux Talk 16:20, 28 June 2020 (UTC)
- Hmm, that may work too - scriptless at least. — xaosflux Talk 16:18, 28 June 2020 (UTC)
- I meant can you link to a specific revision with the text you want? Because then you can have the user edit that permalink, and the text will already be set DannyS712 (talk) 15:34, 28 June 2020 (UTC)
- @DannyS712: the destination would be fixed, and so would the content - so "preload" can be ditched. Preferably the page could be specified with a link, to be an arbitrary page, so to make the requirements a bit simpler:
- The issue is trying to select and manipulate the content of the textbox - preload only works for new pages / new sections, unfortunately. That being said, if it would always be a specific page I have an idea - can you provide an example page and the content that should be on it? DannyS712 (talk) 12:36, 28 June 2020 (UTC)
- @DannyS712: will ditching the publish/submit help? Would be fine to have a dif script for vedit/srcedit. — xaosflux Talk 12:32, 28 June 2020 (UTC)
- So I took a crack at it, and the existence of codemirror and wikieditor make it a lot harder than I thought, sorry DannyS712 (talk) 06:15, 28 June 2020 (UTC)
Live reload
Is there a user script that uses AJAX to refresh a history/contributions/log page/watchlist/etc at regular intervals? Ideally it would also put the number of new events since the last visit in the browser tab title. I am aware of scripts that do this for just the watchlist, but they don't do the other things I mentioned. Enterprisey (talk!) 21:11, 30 April 2020 (UTC)
Request for a source-finder
Can someone possibly make a script that adds {{Find sources mainspace}} (The template itself is "Find sources: "Archive 5" – news · newspapers · books · scholar · JSTOR") on each page when editing? Or is there already a script for this? Please keep me updated! "> dibbydib 💬/✏ 06:26, 12 December 2019 (UTC)
- Dibbydib, does User:BrandonXLF/FindSources.js work? – BrandonXLF (talk) 21:56, 13 December 2019 (UTC
- User:Enterprisey/quick-before might also be useful for this. Enterprisey (talk!) 06:51, 4 July 2020 (UTC)
Request for "Gender display" gadget
At CaptainEek's RfA there are quite some grievances about misidentifying a user's gender as male. There has been issues of this all over the place, (perhaps) the most recent was less than a week ago (Wikipedia:Administrators'_noticeboard/IncidentArchive1035#Misgendering_by_Flyer22_Frozen). I believe it would be a good idea to show a small "he/she/they" text after each username. Eumat114 formerly TLOM (Message) 02:11, 12 May 2020 (UTC)
- WP:POPUPS does show gender on its preview of a username. Galobtter (pingó mió) 03:28, 12 May 2020 (UTC)
- Galobtter, that script shows way too much extra info, and also requires hovering. Could a script that displays it right next to the username/signature be used (e.g. "Eumat114 formerly TLOM (Message) 04:06, 12 May 2020 (UTC) [he]")? Cheers, Eumat114 formerly TLOM (Message) 04:06, 12 May 2020 (UTC)
- Hmm, I could see a script working technically similar to MediaWiki:Gadget-markblocked.js in that it collects all the users on the page and uses a query to mw:API:Users to collect the gender information. Galobtter (pingó mió) 04:51, 12 May 2020 (UTC)
- Galobtter, that script shows way too much extra info, and also requires hovering. Could a script that displays it right next to the username/signature be used (e.g. "Eumat114 formerly TLOM (Message) 04:06, 12 May 2020 (UTC) [he]")? Cheers, Eumat114 formerly TLOM (Message) 04:06, 12 May 2020 (UTC)
Why not always write "they"? Users' gender is irrelevant. Apokrif (talk) 13:03, 17 July 2020 (UTC)
Section sub-headings "outdent"
I'd like to have a tool to help with removing levels of sub-sections. For example, to delete a second-level heading, and have all the headings underneath it be automatically promoted or "outdented" one level. All the third-level headings would become second-level, fourth become third, and so on.
(The reverse might also be helpful, though I don't have a need for it myself, but if you add a second-level heading, then selected headings below it could be automatically indented. This would be more complicated, because you'd need a mechanism to select the ones to indent. So I'm not actually requesting this part...) --IamNotU (talk) 21:51, 20 July 2020 (UTC)
Script for desktop view
Hi, Can such a script be created which removes word m from mobile site and loads (changes) mobile site into desktop site. For example https://en.m.wikipedia.org to https://en.wikipedia.org and also load page as in desktop site. Thank you. Empire AS Talk! 11:39, 31 July 2020 (UTC)
- (User appears to have found the NeverUseMobileVersion script and configured it correctly now. I do think a Phabricator ticket should be opened to have this functionality available in Preferences) – Thjarkur (talk) 13:47, 31 July 2020 (UTC)
Script to display the current time in the upper right corner
There's a gadget that does this but it's only for UTC, I'd like one for the actual current time. I searched, couldn't find one. Thanks. Doug Weller talk 10:19, 6 June 2020 (UTC)
- Wouldn't your phone/desktop/etc... already show this information? Headbomb {t · c · p · b} 13:51, 6 June 2020 (UTC)
- @Headbomb: well yes, I only thought of suggesting this because of the gadget in preferences - which I presume some people find useful. It's much bigger than the tiny time on my desktop which I find hard to read. But I guess not worth writing. I can also check the time on my phone, watch, and when it decides to allow me to see its screen, my Fitbit Charge 3 - but none of them while I'm typing! Never mind though, I was really hoping someone would say it exists and that I'd missed it while searching for one. Doug Weller talk 17:50, 6 June 2020 (UTC)
- Wikipedia:Code review/UTCLiveClock is under development. – Jonesey95 (talk) 18:38, 6 June 2020 (UTC)
- @Doug Weller: Now done at mw:MediaWiki:Gadget-UTCLiveClock.js. To use, enable the gadget, then add
window.LiveClockTimeZone = 'America/Los_Angeles';
, replacing "America/Los_Angeles" with the appropriate tz database name from this table. Cheers, --Mdaniels5757 (talk) 22:12, 2 August 2020 (UTC)- @Mdaniels5757: brilliant, just what I wanted! Thanks. Doug Weller talk 15:04, 3 August 2020 (UTC)
- @Doug Weller: Now done at mw:MediaWiki:Gadget-UTCLiveClock.js. To use, enable the gadget, then add
- Wikipedia:Code review/UTCLiveClock is under development. – Jonesey95 (talk) 18:38, 6 June 2020 (UTC)
- @Headbomb: well yes, I only thought of suggesting this because of the gadget in preferences - which I presume some people find useful. It's much bigger than the tiny time on my desktop which I find hard to read. But I guess not worth writing. I can also check the time on my phone, watch, and when it decides to allow me to see its screen, my Fitbit Charge 3 - but none of them while I'm typing! Never mind though, I was really hoping someone would say it exists and that I'd missed it while searching for one. Doug Weller talk 17:50, 6 June 2020 (UTC)
merger helper
it'd be great if there were a script capable of:
- tagging the current article with the merge from template
- tagging the other article with the merge to template
- creating a talk page section starting the discussion
thanks fgnievinski (talk) 18:57, 21 February 2021 (UTC)
- just found out that Twinkle already does that. fgnievinski (talk) 20:50, 21 February 2021 (UTC)
Removing a template and its associated parameters
I would like to have a script that can be used to remove the usage of Persondata. I know that it has been removed from enwiki, but I need to remove the same from mlwiki. Adithyak1997 (talk) 17:13, 15 August 2020 (UTC)
Show SD script
I would like to propose a script that would place a button on all category pages labeled Show SD. If pressed, the category page would be replaced by a single column listing that included each article's short description, if it has one, next to the article name.
While short descriptions are primarily intended for the mobile version of Wikipedia, having a script like this would make them valuable in the desktop version as well. The script would be useful for editors who are maintaining short descriptions as it would allow them to easily review pages in categories to check for inconsistency, missing descriptions and possible vandalism. For general users, the script would be valuable when viewing categories whose article names tell little about content of the article. Examples include categories of industrial standards, mathematical theorems (which are typically named after mathematicians), military equipment, and other similarly opaque categories.
The script would only have to encapsulate article names in the … – Triple-dot punctuation mark template. I have created examples of what such a page might look like in my sandbox at:
- User:ArnoldReinhold/Category-IEEE standards SD test
- User:ArnoldReinhold/Category-Theorems in Number Theory SD test
The single index letters are easily detected and output as: * ’’’X’’’
As a first cut, the Subcategories section would be shown unmodified, as categories themselves do not currently have useful short descriptions. An extra credit feature, perhaps for a second version, might be checking if a category name matches an article space name and if so, showing the article space short description. Another extra credit feature would be flagging short descriptions that are longer than 90 characters (the suggested maximum size), perhaps by showing the length next to the short description. Any help appreciated.--agr (talk) 18:41, 19 August 2020 (UTC)
- ArnoldReinhold, this is an interesting idea. You might want to specify whether the script should show the Wikidata short description, and under what conditions. For example, should it show only a local description if it exists, and otherwise display to the Wikidata description? Should it show both descriptions? – Jonesey95 (talk) 19:17, 19 August 2020 (UTC)
- Jonesey95 Good question. I'm inclined to stick with what the annotated link template shows, which is just the local description (bases on my experiments). As I understand it, per Wikipedia:Short description#History, the way things happened was that the Wikimedia Foundation decided to use the WikiData short descriptions in the mobile app and the Wikipedia community was concerned about content being displayed under the Wikipedia brand that was not subject to our quality checks. As a result, local short descriptions were added that are part of the normal Wikipedia edit process. So I think the conservative thing for now is to stick with the local description. I would, however, add a hatnote to category pages with Show SD enabled that reads something like: "To view and edit the short descriptions on individual articles in the desktop edition, you should enable the Shortdesc helper under Gadgets in your Wikipedia Preferences." Then complying readers who see a listed article is missing a short description can click on that article and they will see the Wikidata SD if it exists and import or edit it if they wish. I don't think creating an editing mechanism within the category page itself would be wise and the possibility of updating Wikidata to reflect local SD is way beyond my pay grade.--agr (talk) 19:21, 20 August 2020 (UTC)
Doing... SD0001 (talk) 15:51, 21 August 2020 (UTC)
Done see User:SD0001/cat-all-shortdescs.js. Colour code is: local shortdescs in black, wikidata descs in pink and red colour if neither is present. SD0001 (talk) 16:42, 21 August 2020 (UTC)
Automatically watch every visited page
Thanks. Apokrif (talk) 00:44, 9 May 2020 (UTC)
- @Apokrif: Are you sure? You'd very soon end up with a massive watchlist if you tend to visit a lot of pages. If you really want to do this, add this line to your common.js page:
mw.loader.using('mediawiki.api').then(function() { new mw.Api().watch(mw.config.get('wgPageName')); });
- SD0001 (talk) 17:50, 21 August 2020 (UTC)
Ordering script
I think there must be a script that would arrange the top templates of lead section of an article according to MOS:ORDER. Because I see there are lot of articles that don't have the right arrangement. And many users don't know what should be the order. So such a script would help them to make the order right according to WP:ORDER. Thank you. Empire AS Talk! 07:09, 29 August 2020 (UTC)
- I believe AWB does this when an edit is being made to the page anyway. Having a script that by itself does nothing but reorder templates is pretty WP:COSMETICBOT territory. SD0001 (talk) 09:51, 29 August 2020 (UTC)
Hotkey
I used this (simple) User:GregU/hotkeys.js script but it stopped working (long time ago). It assigned a few ctrl-X to some special symbols or text. Any idea why its broken? (the script creator has been inactive for 8 years 7 months ago) Christian75 (talk) 08:45, 14 September 2020 (UTC)
- The method it was using for firing on page load was no longer supported, here is an updated version. – Thjarkur (talk) 21:15, 17 September 2020 (UTC)