Last modified: 2014-08-29 02:04:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T54797, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 52797 - Give site JS a chance (maybe in another NS_MEDIAWIKI page) to load at position=top
Give site JS a chance (maybe in another NS_MEDIAWIKI page) to load at positio...
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.22.0
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-13 13:23 UTC by Liangent
Modified: 2014-08-29 02:04 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Liangent 2013-08-13 13:23:23 UTC
We want to do some simple checks and redirect users in some cases (by setting window.location), but doing it in site JS creates a flash of the original page currently.
Comment 1 Andre Klapper 2013-08-13 14:18:52 UTC
(In reply to comment #0)
> We want to do some simple checks and redirect users in some cases

Could you elaborate on that?
Comment 2 Liangent 2013-08-13 14:33:13 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > We want to do some simple checks and redirect users in some cases
> 
> Could you elaborate on that?

From [[zh:MediaWiki:Common.js]]:

mw.loader.using(['mediawiki.Uri'], function() {
    /* Search Engine variant hack */
    var ref, loc;
    try {
        ref = new mw.Uri( document.referrer );
        loc = new mw.Uri( location.href );
    } catch ( e ) {
        return;
    }
    if (/\.google\./.test(ref.host) && /\/zh(-[^/]+)?\//.test(loc.path)) {
        loc.path = loc.path.replace(/\/zh(-[^/]+)?\//, "/wiki/");
        location = loc.toString();
    }
} );
Comment 3 Bartosz Dziewoński 2013-08-13 14:35:41 UTC
You can do this with a gadget now using the 'top' option, see e.g. on [[pl:MediaWiki:Gadgets-definition]]; see bug 27488. (Also, I think this is a dupe of that bug.)

Not sure if we really want this in core.
Comment 4 Bartosz Dziewoński 2013-08-13 14:36:10 UTC
(Relevant line is "
main-page [ResourceLoader | top | default] | main-page.js | main-page.css".)
Comment 5 Chad H. 2013-10-09 18:08:44 UTC
Shouldn't we just fix the search behavior with variants rather than using site JS here anyway?
Comment 6 Krinkle 2014-08-29 02:04:55 UTC
Common.js is feature-locked as far as I'm concerned. It loads at the bottom and in the global scope. For anything else, use Gadgets.

You can create a gadget with position=top.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links