Topic on Project:Support desk/Flow

Editing toolbar not appearing in Catalan Wikinews

13
George Ho (talkcontribs)
AKlapper (WMF) (talkcontribs)

Going to https://ca.wikinews.org/w/index.php?title=Viquinot%C3%ADcies:La_cantina&action=edit&debug=true (note the debug=true) and opening the web browser's developer tools you see the line "ReferenceError: getElementsByClassName is not defined". That is the line "var icones = getElementsByClassName( "icona_de_titol", document, "div" );" in the file https://ca.wikinews.org/wiki/MediaWiki:Common.js. Please try adding a "document." prefix to that function call. Also see https://phabricator.wikimedia.org/T163540

or more information.f

AKlapper (WMF) (talkcontribs)

To make it clear: "var icones = getElementsByClassName( "icona_de_titol", document, "div" );" must become "var icones = document.getElementsByClassName( "icona_de_titol", document, "div" );"

Syum90 (talkcontribs)

We need someone with enough technical skills to fix our js page.

AKlapper (WMF) (talkcontribs)

Please start with the recommendation I already gave. If you get specific other errors, please list them here. See above for using "debug=true" and the browser's developer tools. If you have any specific questions about specific errors, please ask them - happy to help!

Syum90 (talkcontribs)

Hi, I've implemented the change proposed by you, but unfortunately we have a lot of problems at ca.wikinews with almost all our gadgets and scripts since two weeks ago. Per example at the main page I see:


JavaScript parse error: Parse error: Unterminated string literal in file 'MediaWiki:Common.js' on line 1005

and

TypeError: mw.util.$content is null


Thank you very much for your help.

AKlapper (WMF) (talkcontribs)

The first error is because "("Look what I found on Wikinews:mw.config.get('wgArticleId'))" is missing a " (quotation marks) to close that string.

For the second one, please mention the line and the file (or steps to reproduce the problem).

Syum90 (talkcontribs)

Hi, I'm added the quotation marks as you said, thanks.

Now when I go to the main page I find these errors:

ReferenceError: addLoadEvent is not defined load.php:978:2 <anónimo> https://ca.wikinews.org/w/load.php:978:2

and

TypeError: mw.util.$content is null index.php:87:7 main https://meta.wikimedia.org/w/index.php:87:7 init https://meta.wikimedia.org/w/index.php:316:4 fire https://ca.wikinews.org/w/load.php:3148:10 fireWith https://ca.wikinews.org/w/load.php:3260:7 ready https://ca.wikinews.org/w/load.php:3472:3 completed https://ca.wikinews.org/w/load.php:3503:3

One gadget that is not working since two weeks ago is our ticker. When I look for errors on that page I can see:

ReferenceError: addLoadEvent is not defined load.php:978:2 <anónimo> https://ca.wikinews.org/w/load.php:978:2

and

TypeError: mw.util.$content is null index.php:87:7 main https://meta.wikimedia.org/w/index.php:87:7 init https://meta.wikimedia.org/w/index.php:316:4 fire https://ca.wikinews.org/w/load.php:3148:10 fireWith https://ca.wikinews.org/w/load.php:3260:7 ready https://ca.wikinews.org/w/load.php:3472:3 completed https://ca.wikinews.org/w/load.php:3503:3

Again, thank you very much for your help.

AKlapper (WMF) (talkcontribs)

For the "addLoadEvent" error on https://ca.wikinews.org/wiki/Portada?debug=true , click the line "load.php:978:2", scroll up, and see that the problem is in the file https://ca.wikinews.org/wiki/MediaWiki:Common.js. Wherever that code was copied from (it says that Bawolff once wrote that), check that original code and whether it has been adapted. In general it is a bad idea to copy code and then not maintaining that code - see ResourceLoader/Migration guide (users)#Keep gadgets central.

For mw.util.$content, see https://phabricator.wikimedia.org/T164242 for how to fix those.

Syum90 (talkcontribs)

Hi, for the "addLoadEvent", it's the exact same code as in the French Wikinews, except for one thing: we replaced the importScript("MediaWiki:ticker2.js") for mw.loader.load('//fr.wikinews.org/w/index.php?title=MediaWiki:ticker2.js&action=raw&ctype=text/javascript') in order to load their "MediaWiki:ticker2.js" page. As a result their ticker works perfectly and ours one doesn't work at all.

By the way, our toolbar now seems to work perfectly as most of our gadgets; the ticker is one of the few gadgets which don't work yet.

Syum90 (talkcontribs)

Well, in fact we've been using the English Wikinews version (ticker) until now, but as I can see the en.wn ticker is not working at this moment and I've replaced it for the fr.wn version, which is working perfectly now. As I've said you the code we have in our common.js is exactly the same as the code used in the fr.wn except for the part indicated, and we're now using their ticker (their "MediaWiki:ticker2.js" page).

Ciencia Al Poder (talkcontribs)

Replace "addLoadEvent" with "$" (without the quotes), which is equivalent. The problem isn't on the ticker itself, but the code that loads the ticker :)

Syum90 (talkcontribs)

@Ciencia Al Poder thank you very much, I've done exactly as you said and our ticker is now working perfectly.

@Ciencia Al Poder@AKlapper (WMF) At this moment it seems that all problems have been resolved at the Catalan Wikinews, if I see any other issue in the future or another user reports any problem I will inform you. Thank you very much for your help :-)