Forum:Import script for navigation popups only works in certain positions

Here is the link to our sitewide js page:http://religion.wikia.com/wiki/MediaWiki:Wikia.js

It consisted of a few js functions used for some buttons that are on a few pages

then some variables are defined for the statcounter

then the statcounter is imported

then navigation popups is imported.

navigation popups will not work if its import line is placed above the functions

nor will it work if its import line is placed below the statcounter import line

Can anyone shed any light on this behavior.

Granpa (talk) 13:48, August 26, 2012 (UTC)


 * Best I can figure out is that the popups script isn't designed to work on anything other than Wikimedia projects. It contains broken references to variables which don't exist on Wikia; as soon as it hits that point, everything stops due to the error. Try adding:


 * before the  for the popup script. See if that helps. It's hard to tell as everything seems to work right now, if it was still broken I could investigate more deeply. Lunarity 14:49, August 26, 2012 (UTC)


 * It was working earlier but it has mysteriously stopped working now.
 * I added the code above but it had no effect.
 * Granpa (talk) 15:14, August 26, 2012 (UTC)


 * I reverted to an earlier revision that I know was working earlier but it still doesnt work.
 * I have no idea whats going on.
 * Granpa (talk) 15:26, August 26, 2012 (UTC)


 * Its working in chrome but not in firefox.
 * Granpa (talk) 15:28, August 26, 2012 (UTC)


 * control f5 and its working in firefox.
 * I've been using shift reload but maybe that doesnt work anymore
 * Granpa (talk) 15:29, August 26, 2012 (UTC)

OK, everything is back exactly where it was when I first started this thread and popups are working Granpa (talk) 15:35, August 26, 2012 (UTC)
 * and now it has mysteriously stopped again even though I didnt do anything.
 * Granpa (talk) 15:54, August 26, 2012 (UTC)
 * and this is quite typical.
 * this sort of thing happens all the time
 * it works then I change one unrelated thing and it stops
 * then I change it back to exactly where it was before and it still wont work.
 * its totally flaky
 * Granpa (talk) 15:56, August 26, 2012 (UTC)


 * I tried loading this version: manually and it came up correctly without any errors for me. The statement I gave you won't have an overt effect, it just prevents the script from crashing; that   statement needs to be before the popup script is loaded, as long as you keep those 2 together in the same order than it should work. Make sure you're refreshing your cache correctly as well, otherwise the changes you make won't take effect until some time afterwards. Lunarity 16:31, August 26, 2012 (UTC)


 * I added your line. Popups arent working for me but maybe they will for you.
 * Granpa (talk) 17:26, August 26, 2012 (UTC)

Staff originally told me to add
 * importScriptURI( 'http://help.wikia.com/index.php?title=MediaWiki:Gadget-popups.js&action=raw&ctype=text/javascript' );
 * importStylesheetURI( 'http://help.wikia.com/index.php?title=MediaWiki:Gadget-navpop.css&action=raw&ctype=text/javascript' );
 * Granpa (talk) 17:42, August 26, 2012 (UTC)
 * Navigation popups are still working over at help wiki http://help.wikia.com/wiki/Special:Random
 * You have to enable them in preferences under gadgets.
 * Granpa (talk) 17:46, August 26, 2012 (UTC)


 * The popups are working fine for me. Maybe there's something else entirely that prevents them from working for you... Please use Chrome and open the developer console while you load one of the page where they should work. Then post any error messages you get here. Alternatively you can use Firefox but then you'd have to install Firebug first. —This (wall • contribs) . Please sign your posts with


 * Firefox has a developer console including DOM Inspector, JavaScript console and error log. It has had it for some time now; you only need Firebug if you are going to debug JavaScript by setting breakpoints, inspecting variables and such, Firefox can't do that on its own yet [I just open Chrome instead for that]. Lunarity 18:52, August 26, 2012 (UTC)

I opened tools then developer something then errors. I loaded a very small page at http://religion.wikia.com/wiki/Eternal_life and got this screenshot:

The text is copied below

I'm running firefox 14. Its bound to have something similar. Granpa (talk) 18:47, August 26, 2012 (UTC)

Okay, I looked more closely and the bug I was seeing earlier is actually in Common.js, not Wikia.js. The WikiAtlas thing is the one that's bugged. In any case, you should use the  statements you were given by the staff, those will import the scripts from the Help Wiki which have been modified specifically for Wikia so should work properly. You can also go w:c:Help:MediaWiki:Gadget-popups.js and w:c:Help:MediaWiki:Gadget-popups.css to copy the code directly onto your Wiki if you want.

Anyway, in w:c:religion:MediaWiki:Common.js, there are these lines: That should be: which will actually fix that bug I saw earlier. Lunarity 18:52, August 26, 2012 (UTC)


 * What you have there in that screenshot looks like an epic amount of fail. No wonder lots of JavaScript doesn't work anymore. You should report this to Special:Contact/bug. There's little - if anything - Lunarity or I can do to fix that. The bug is somewhere in the ad code or the cacheing server code or both...


 * @Lunarity: All of your suggestions sound sensible, but until Staff fixes all those errors in the code that loads long before the Wikiminiatlas and the Navigation Popups, there's not much point in going on now, I think.

I turned off adblock and reload. I also switched to javascript console. I got this:

I completely blanked our sitewide js page then reloaded and got this: