Topic on Project:Support desk

Summary by Tinker Bell

JS Gadget doesn't work if type=styles is present on MediaWiki:Gadgets-definition.

Tinker Bell (talkcontribs)

Hi. I wrote a gadget here, but the script does nothing, not even adding the main object to mw. The code works if I paste directly on the browser console, and I also removed all deprecated functions listed on ResourceLoader/Migration guide (users), so I don't know what another thing can I do. I'm using MediaWiki 1.29.2. Thanks for the help.

Malyacko (talkcontribs)

On an unrelated note, 1.29.x is an old version unsupported since middle of 2018, so that website (and data of its users) is insecure.

You could add some debugging and use your web browser's developer tools.

Tinker Bell (talkcontribs)

I know 1.29 is already obsolete, I don't have access to the server. The developer tools' console doesn't show any error, so I don't know what's wrong.

Ciencia Al Poder (talkcontribs)

Does any error show in the error console? You can also try with debug=true in the URL.

Also, there's a missing semicolon (try pasting the code to https://jshint.com/ ), that may be an issue when the code is minimized

Tinker Bell (talkcontribs)

I wrote the missing semicolon, and I checked the code on that page. The console simply doesn't show any error, even with debug=true. The same code works if I put it in MediaWiki:Common.js, so I'm sure it isn't a syntax problem.

Ciencia Al Poder (talkcontribs)
Tinker Bell (talkcontribs)

Mmm, I didn't realized of that. Now it works. Thanks.