Page MenuHomePhabricator

Provide a JavaScript variable for the "redirected from" page title
Closed, ResolvedPublic

Description

Author: a.d.bergi

Description:
This would make live (and coding) very much easier. When you got redirected, the only evidence for that is the html content of the contentSub element. Very ugly to detect by js in different skins and languages.

Another possibility would be to give the <a> element in the contentSub an id, but I think the first approach is cleaner.

Example where that could be needed? To hide Template:Redirect (and its interwiki equivalents) when you got *not* redirected.


Version: unspecified
Severity: enhancement

Details

Reference
bz32230

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:03 AM
bzimport set Reference to bz32230.
bzimport added a subscriber: Unknown Object (MLST).

sumanah wrote:

Thanks for the request, Bergi. I'm removing the 1.18 tarball release milestone because I think this is not *urgent* enough for us to aim to fix it, review the code for the fix, and roll it out within the next couple of weeks (which is when we're trying to get the 1.18 tarball release out). However, per discussion with Daniel Friesen on IRC, it seems reasonable to aim for the 1.19 tarball release, so I've added that milestone instead.

$wgMaxRedirects allows to follow more than one redirects. A new JavaScript variable should contain an array of the redirected titles. The Array should be empty when there is no redirect.

If $wgMaxRedirects is set to a value > 1 still only one redirect is actually followed. The rest of the redirect chain (up to $wgMaxRedirects redirects) is shown to the visitor, but not followed.

Created attachment 9567
patch against trunk

Puts the "redirected from" pagetitle in mw.config.get('wgRedirectedFrom').

Usage example:
if (window.mw.config.get('wgRedirectedFrom')) {

alert(window.mw.config.get('wgRedirectedFrom'));

}

attachment rd.patch ignored as obsolete

Created attachment 9570
Patch against trunk

Using getPrefixedDBKey() instead of getPrefixedText().

Attached:

roan.kattouw wrote:

I swear there's another bug for this where I updated someone else's patch, but MrBlueSky's patch on this bug is better.

roan.kattouw wrote:

*** Bug 11040 has been marked as a duplicate of this bug. ***

roan.kattouw wrote:

Patch committed in r104668.