JavaScript gadget – explain target of redirect links and replace redirect page on source editing.
Please note that there are cases where it is better to keep the current link pointing to a redirect page since that target might be replaced by an advanced page in the future, or the final target might be updated.
Usage edit
- If your project has registered this as a gadget, just activate on your Preferences page.
- Otherwise include the following line into your common.js, global.js etc.:
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/redirectResolver/r.js&action=raw&maxage=86400&ctype=text/javascript" );
Functionality edit
On a rendered wikitext page, MediaWiki will equip with class mw-redirect
all internal links pointing to a redirect page. Within rendered content ↪ will be appended to such links.
It is a button, opening a tiny popup.
To close that popup, click this button again, or click another similar button, or click X within the popup.
Popup edit
- Wikipedia:SC
- Wikipedia:Shortcut
- ↯
- 1.3
- X
- Wikipedia:SC
- Link target in effect on rendered page.
- Pointing here to redirect page without automatic forwarding (
redirect=no
). - Will be opened in a new browser tab/window.
- Wikipedia:Shortcut
- Target of redirect.
- Might appear after short delay, since MediaWiki server could need time to answer.
X | Close |
1.3 | Version number
|
↯ | Exchange this link in source text |
... | Exchanging … |
3 | Number of successful changes, if any |
0 | No successful change |
Exchanging edit
On source text editing, exchanging will be done on regular wikitext in double brackets [[
(may be titled with pipe |
) and most usual syntax.
Templates, comments and any <>
will prevent this particular link from changing.
Exchanging is in effect for syntax disabled by <!-- -->
comments or <nowiki>
<pre>
<syntaxhighlight>
elements.
Opening but not closed [[
might hide a clickable link within.
Template parameter values cannot be identified as page names of a redirect page, nor results of template transclusion.
Please check via diff page whether result is matching your expectations.
Individual Configuration edit
CSS edit
All relevant elements have selectors prefixed by gadget-redirectresolver
and may be subject to personal adaptions.
The following definition for class mw-redirect
will give a pink background to all redirect links and this tool.
.mw-redirect {
background-color: #FFC0CB ! important;
}
One common specification for redirect links only is this one:
a.mw-redirect {
background-color: #F0E68C;
}
Internationalization edit
A translation of this page may be offered.
Codes edit
Source code |
|
ResourceLoader |
|
Namespaces | all |
Actions | all |
mw.libs
|
redirectResolver (reserved, but currently unused)
|
mw.hook
|
|
MediaWiki | MW 1.22 |
JavaScript | 1.5 (2000)
|