User:Dragoniez/ToollinkTweaks

Sample toollinks

ToollinkTweaks is a global script that adds a functionality to extend toollinks attached to user links, to the script user's liking.

For instance:

  • Normal toollinks
2023-09-09T15:48:28 Dragoniez (talk | contribs) created page User:Dragoniez/ToollinkTweaks.js (v1.0.0)
  • Extended toollinks (configurable)
2023-09-09T15:48:28 Dragoniez (talk | contribs | CA | ST | GUC) created page User:Dragoniez/ToollinkTweaks.js (v1.0.0)

Installation

edit

Add the following to Special:MyPage/global.js for global use, or to Special:MyPage/common.js for use on meta, or to your common.js on your local project. (source code)

mw.loader.load("//meta.wikimedia.org/w/index.php?title=User:Dragoniez/ToollinkTweaks.js&action=raw&ctype=text/javascript");

Configurations

edit

Config page

edit

You can configure your toollinks by visiting Special:ToollinkTweaksConfig (or Special:TTC). Find a portlet link to the config page in the toolbox, or type in the page name in the address bar. It is a non-existing special page, but the script will create the config interface when you visit the page, if you have installed the script.

Config options

edit
 
How the config looks (v1.2.1)

The ToollinkTweaks config currently has 9 fields for each toollink.

Option What to specify Notes
Label (required) The label of the toollink
URL (required) The URL of the toollink Available variables:
  • $1: The username associated with the toollink
  • $2: Article path (usually /wiki/)
  • $3: Script path (usually /w/index.php)
  • $4: API path (usually /w/api.php)
Target Types of user links to which we add toollinks User, IP, and/or CIDR (a.k.a. IP range)
Tab The tab to open the toollink on The current tab or A new tab
Special pages (incl.) The canonical names of special pages on which we add the toollink

Use * to opt in for all special pages
Specify canonical special page names (e.g. CentralAuth instead of CA, which is an alias)

Special pages (excl.) The canonical names of special pages on which we don't add the toollink

Use * to opt out for all special pages (although we usually don't use it)
Specify canonical special page names (e.g. CentralAuth instead of CA, which is an alias)
This option overrides the inclusion settings

Global Whether to make the toollink global

If this option is checked, the toollink is generated on all projects
(Relevant only when you install the script in global.js or on multiple projects)

Local exception Whether to set a local exception and disable the toollink

Visible only when Global is checked
Check this option to opt out for the globalized toollink on the local project

Enable Whether to enable the toollink
Notes on canonical special page names

Note that some of the canonical special page names are "disabled" and/or "reinterpreted".

In the list below, disabled means that the special page name is gotten rid of from the autocomplete candidates for the relevant toollink options (which is mostly because the special page is redirected to another and unreachable). For instance, Special:Mycontributions is redirected to Special:Contributions/User, and you can never reach Special:Mycontributions itself. This means that specifying Mycontributions never does anything for your toollinks. You can still type in these disabled special page names into the relevant fields, but that won't have any influence on the generation of your toollinks.

On the other hand, reinterpreted means that the script reinterprets your location as a given special page. For example, Special:EditPage/Meta:Sandbox redirects you to /w/index.php?action=edit&title=Meta:Sandbox, but the redirected page is not interpreted as a special page. In such a case, the script reinterprets your location as Special:EditPage when you're on action=edit, which means that if you specify EditPage in the exclusion field for instance, you can opt out for toollink generation on action=edit.

Name State Reason Notes
AllMyUploads disabled Redirected to Special:Listfiles/USER Use Listfiles.
ApiHelp disabled Redirected to api.php?action=help&modules=main
BannerLoader disabled Page not working
BannerRandom disabled Page not working
BetaFeatures disabled Redirected to Special:Preferences#mw-prefsection-betafeatures Use Preferences.
ChangePassword disabled Redirected to Special:ChangeCredentials/MediaWiki\\Auth\\PasswordAuthenticationRequest Use ChangeCredentials.
DeletePage reinterpreted Redirected to action=delete
Diff reinterpreted Redirected to (action=view +) diff=NNNNN or diff=prev/next&oldid=NNNNN
EditPage reinterpreted Redirected to action=edit
Listadmins disabled Redirected to Special:Listusers/sysop Use Listusers.
Listbots disabled Redirected to Special:Listusers/bot Use Listusers.
MobileLanguages disabled Redirected to various pages
MyLanguage disabled Redirected to various pages
Mycontributions disabled Redirected to Special:Contributions/USER Use Contributions.
Mylog disabled Redirected to Special:Log/USER Use Log.
Mypage disabled Redirected to a non-special page
Mytalk disabled Redirected to a non-special page
Myuploads disabled Redirected to Special:Listfiles/USER Use Listfiles.
NewSection disabled/reinterpreted Redirected to action=edit&section=new Use EditPage.
PageHistory reinterpreted Redirected to action=history
PageInfo reinterpreted Redirected to action=info
PermanentLink reinterpreted Redirected to (action=view +) oldid=NNNNN
Preview reinterpreted Fabricated for action=submit The MediaWiki software doesn't have Special:Preview.
ProtectPage reinterpreted Redirected to action=protect
Purge reinterpreted Redirected to action=purge
Revisiondelete reinterpreted Redirected to action=revisiondelete
Uploads disabled Redirected to Special:Listfiles Use Listfiles.

Showcase

edit
Option Value Notes
Label ST
URL https://meta3.toolforge.org/stalktoy/$1 Recognized as https://meta3.toolforge.org/stalktoy/Dragoniez
Target User, IP, CIDR Stalk Toy is compatible with all of these
Tab The current tab
Special pages (incl.) *
Special pages (excl.)
Global Unchecked
Local exception N/A
Enable Checked

(Below is an example to generate the toollink except on Special:AbuseLog.)

Option Value Notes
Label CA
URL $2Special:CentralAuth/$1

Recognized as /wiki/Special:CentralAuth/Dragoniez
Use a partial URL to create a project-internal link

Target User CA is incompatible with IPs
Tab The current tab
Special pages (incl.) *
Special pages (excl.) AbuseLog
Global Checked

The partial URL specification will be important when this option is checked
Suppose that we specify //meta.wikimedia.org/wiki/Special:CentralAuth/$1 in the URL field
In this case, the toollink will be linked to meta on all projects (not domain-dynamic)

Local exception N/A
Enable Checked

(Below is an example to generate the toollink only on Special:Log and action=history.)

Option Value Notes
Label GUC
URL https://xtools.wmflabs.org/globalcontribs/ipr-$1 Recognized as https://xtools.wmflabs.org/globalcontribs/ipr-Dragoniez
Target User, IP, CIDR
Tab The current tab
Special pages (incl.) Log, PageHistory
Special pages (excl.)
Global Unchecked
Local exception N/A
Enable Checked