Last modified: 2014-09-24 01:32:49 UTC
If the page is the target of redirect (user sees "redirected from Foo" message), it would be handy to have variables * wgRedirPageName * wgRedirTitle * wgRedirCanonicalNamespace * wgRedirNamespaceNumber as complements to existing appropriate variables.
Would it add something that you cannot get from document.getElementById('contentSub').getElementsByTagName('a')[0] (and then maybe some API calls)?
Created attachment 4216 [details] Four simple functions that make redirected page information available in Skin.php as JavaScript variables
Created attachment 4217 [details] Add four new JavaScript variables to makeVariablesScript()
*** Bug 16028 has been marked as a duplicate of this bug. ***
@AlexSm: I think many of the "wg-" JS variables don't give informations that we cannot get by using DOM or API (wgServer, wgUserName, wgUserLanguage, wgVersion...). But it's more simple and "elegant" to use generated JS variables, isn't it?
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Adding the "need-review" keyword for patches that need review by developers. Joshua, thank you for your patches, and sorry it's taken so long for a response on this!
Created attachment 9501 [details] Revised patch Attaching a revised patch. Changes relative to the original patch: * Applies to MW as it is now rather than as it was four years ago :) * Introduces only one Article getter and one variable. JS only needs the full title text, we've got mw.Title to figure out the rest (namespace number etc) on the JS side if you need it Not committing this because it uses $wgArticle, which is very much deprecated and not used in trunk. However, RequestContext doesn't have an Article, so I'm not sure how to proceed here. Should the redirected from stuff be moved into OutputPage or something? Thoughts?
CC Chad in the hope he'll advise re comment 8.
Maybe something along the lines of a $out->setRedirectedFrom. Perhaps that can also set the subtitle implicitly. Then Article can call the OutputPage function where needed.
(In reply to comment #10) > Maybe something along the lines of a $out->setRedirectedFrom. Perhaps that can > also set the subtitle implicitly. Then Article can call the OutputPage function > where needed. Yeah, I was thinking refactoring in that direction would probably be best.
(In reply to comment #11) > (In reply to comment #10) > > Maybe something along the lines of a $out->setRedirectedFrom. Perhaps that can > > also set the subtitle implicitly. Then Article can call the OutputPage function > > where needed. > Yeah, I was thinking refactoring in that direction would probably be best. Turns out someone has already done this on bug 32230. Duping up because the patch on that bug is better. *** This bug has been marked as a duplicate of bug 32230 ***