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. |
|
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:
|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.|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)
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)
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)
[[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. 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)
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)
</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)mw.loader.load('/?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 with mw.loader.addStyleTag()
.
Nardog (
talk) 02:50, 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?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
!important
; i.e., this should be sufficient in common.js:
.ttm_harv_err {color:darkseagreen}
!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)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)
<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)
!important
:
body .ttm_harv_err {color:black; background-color:cornsilk}
.mw-parser-output .ttm_harv_err {color:black; background-color:cornsilk}
loadcssfile("HarvErrors.css", "css") //dynamically load the default .css file loadcssfile("Special:MyPage/HarvErrors.css", "css") //dynamically load user's .css file (if exists)
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)
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)
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)
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)
&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)
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)
to adjust the list of categoriesis 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)
importScript()
:mw.hook( 'LinkClassifier' ).add( function ( linkClassifier ) {
linkClassifier.cats'redirect-with-possibilities' = 'Category:Redirects with possibilities' ].sort();
} );
a.redirect-with-possibilities {
border: 1.5px dashed #d33;
padding: 3px;
}
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)
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)
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)
\| 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 the the
is within the link: \| \[\[The (\w*)
→ \| data-sort-value="$1" \| \[\[The $1
. Cheers, {{u|
Sdkb}}
talk 23:42, 12 January 2024 (UTC)
data-sort-type="..."
could be created for this form of alphabetical sorting? See: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.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)
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)
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)
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)
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, Neuropol Talk 15:37, 2 April 2024 (UTC)
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. |
|
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:
|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.|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)
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)
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)
[[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. 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)
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)
</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)mw.loader.load('/?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 with mw.loader.addStyleTag()
.
Nardog (
talk) 02:50, 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?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
!important
; i.e., this should be sufficient in common.js:
.ttm_harv_err {color:darkseagreen}
!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)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)
<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)
!important
:
body .ttm_harv_err {color:black; background-color:cornsilk}
.mw-parser-output .ttm_harv_err {color:black; background-color:cornsilk}
loadcssfile("HarvErrors.css", "css") //dynamically load the default .css file loadcssfile("Special:MyPage/HarvErrors.css", "css") //dynamically load user's .css file (if exists)
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)
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)
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)
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)
&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)
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)
to adjust the list of categoriesis 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)
importScript()
:mw.hook( 'LinkClassifier' ).add( function ( linkClassifier ) {
linkClassifier.cats'redirect-with-possibilities' = 'Category:Redirects with possibilities' ].sort();
} );
a.redirect-with-possibilities {
border: 1.5px dashed #d33;
padding: 3px;
}
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)
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)
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)
\| 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 the the
is within the link: \| \[\[The (\w*)
→ \| data-sort-value="$1" \| \[\[The $1
. Cheers, {{u|
Sdkb}}
talk 23:42, 12 January 2024 (UTC)
data-sort-type="..."
could be created for this form of alphabetical sorting? See: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.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)
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)
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)
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)
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, Neuropol Talk 15:37, 2 April 2024 (UTC)