Topic on User talk:Jdlrobson

Jump to navigation Jump to search
Nirmos (talkcontribs)

Hi! At Swedish Wikipedia (sv.wikipedia) we have a gadget whose JavaScript looks like this:

$( function() {
	'use strict';
	$( '.mw-ui-icon-random' ).after( '<a href="" title="Exkludera robotskapade sidor" id="ExkluderaRobotskapadeSidor">(−bot)</a>' );
} );

and whose gadget definition looks like this: *ExkluderaRobotskapadeSidorMobil[default|ResourceLoader|targets=mobile]|ExkluderaRobotskapadeSidorMobil.js|ExkluderaRobotskapadeSidorMobil.css

There seems to be some kind of race condition going on here, because it sometimes works and sometimes it doesn't. Can you tell just by looking at this what's wrong? If not, could you point me to a page where the modules that can be loaded as dependencies are described, so that I can try on my own?

Jdlrobson (talkcontribs)

Hi! I'm not surprised this isn't working. The menu is rendered via JavaScript so you'd be better of altering MW.config.get( ' wgMFMenuData' ) to control the rendering of the menu.

There's a longstanding bug around configuring the main menu which would make this a lot easier for you. Sadly it's not a top priority right now but here it is:

Reply to "mobile gadget race condition"