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)