Page MenuHomePhabricator

Resource loader doesn't define $j as an alias for jQuery
Closed, ResolvedPublic

Description

Seen on TWN, for example at http://translatewiki.net/w/i.php?title=MediaWiki:Config-invalid-ts2schema/ru&curid=1615639&diff=2317155&oldid=2316770

Context:

addOnloadHook(createNavigationBarToggleButton);$j(document).ready(function(){$j(".mw-usertoollinks").each(function(){var tools=$j(this);var expander=$j("<a/>").text("+").attr("href","#");tools.hide();expander.click(function(){tools.show();$j(this).hide();});tools.before(expander);});});$j(document).ready(function(){if(wgUserGroups.indexOf('translator')!==-1)$j('#n-bw-sidebar-intro').hide();});function addLiLink(tabs,url,name,id,title,key){var na=document.createElement('a');na.href=url;na.appendChild(document.createTextNode(name));var li=document.createElement('li');if(id){li.id=id;}


Version: 1.17.x
Severity: normal

Details

Reference
bz25150

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:18 PM
bzimport set Reference to bz25150.

Fixed in r72918 by adding an alias at the end of wikibits.js. Note: this is only to get site/user scripts that were using $j to work. Use of $j should be phased out in favor of $. If you are writing a library that's intended for re-use, please wrap it in a closure that passes jQuery as $ such as "( function( $ ) { /* code here */ } )( jQuery );" so that people using alternative short names for jQuery can use the code unmodified.