Topic on Project:Support desk

[Resolved] (i think) Issues loading JS - MW 1.28

4
Cristal01 (talkcontribs)

Hi,

I'm having some issues loading javascripts on my wiki.

Basically, whenever I open a page, the 1st javascript from the Common.js will give me the following error:

Exception in module-execute in module site:
TypeError: $(...).msDropDown is not a function TypeError: $(...).msDropDown is not a function
    at eval (eval at <anonymous> (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:4), <anonymous>:1:68)
    at eval (<anonymous>)
    at load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:4
    at Function.globalEval (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:4)
    at Object.<anonymous> (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:161)
    at fire (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:45)
    at Object.add [as done] (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:45)
    at Object.always (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:46)
    at runScript (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:161)
    at checkCssHandles (load.php?debug=false&lang=en-gb&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=11b9z…:162)

The thing is, this doesn't always happen and by changing the language (I have the language selector extension), it seems to always fix itself but only for that one page. Moving to a different page may or may not result in another "not a function" error.

For example, I go to the main page. I get the " is not a function" error. I switch the language to german. Everything loads.

link to my wiki https://aionpowerbook.com/pb/index.php?title=Main_Page

Firefox seems to not have this issue, don't know why :x

Mediawiki 1.28, php 7.0

Cristal01 (talkcontribs)

Moving everything from common.js to a new .js file and loading it along all the other javascripts by the extension seems to have worked.

Ciencia Al Poder (talkcontribs)

That was probably because the JavaScript that provides the msDropDown function hasn't been loaded yet, you need to put the code using it inside a function that's run after the page ends loading, or if the script is a ResourceLoader module, inside a function called in mw.loader.using()

Guido.esser (talkcontribs)
Reply to "[Resolved] (i think) Issues loading JS - MW 1.28"