MediaWiki talk:Gadget-HotCat.js

Semicolon

edit

{{editprotected}} Add a semicolon at the end of the statement (this is good practice and may erroneously be required by some JavaScript implementations). Brian Jason Drake 11:36, 24 January 2010 (UTC)Reply

We do not follow a JS coding style on Wikipedia. If you want to discuss this, I propose you take it up at MediaWiki_talk:Common.js. —TheDJ (talkcontribs) 14:36, 24 January 2010 (UTC)Reply

Interface-protected edit request on 25 October 2019

edit

Unless I am very much mistaken, the proper way to import a cross-wiki gadget is to use

mw.loader.load( '//commons.wikimedia.org/w/load.php?modules=ext.gadget.HotCat' );

rather than

mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );

I removed HotCat as a gadget in my preferences and loaded it as above, it seems to be working fine.

The latter is 119,287 bytes, whereas the former is just 76,364 bytes. This saves 36% bandwidth — a massive improvement. SD0001 (talk) 21:40, 25 October 2019 (UTC)Reply

  Done @SD0001: I've made the update, give it ~15 mins and then try it out and make sure it is working? — xaosflux Talk 19:23, 7 November 2019 (UTC)Reply
@SD0001 and Xaosflux: Please excuse the duplicate Ping, Xaosflux (Wikipedia talk:HotCat#loader updated), but yep, after that script update, HotCat won't load for me at all. Steel1943 (talk) 19:48, 7 November 2019 (UTC)Reply

Interface-protected edit request on 7 November 2019

edit

Per the above section and Wikipedia talk:HotCat#loader updated, can the edit referenced above please be undone until the script can be properly tested? Steel1943 (talk) 20:36, 7 November 2019 (UTC)Reply

  Undone (edit conflict) @Steel1943 and SD0001: - this has been reverted, please verify in a few mins if it is restored. SD0001, perhaps we can make a beta gadget to test this with as a fork if you'd like? — xaosflux Talk 20:37, 7 November 2019 (UTC)Reply
I think I know the reason why it isn't working when the change is made to the gadget, but works when the change is introduced via the user's common.js (as I have been doing ever since I made the editreq - HotCat works for me w/o issues). Going by the console error cited by MrX, the reason is that the gadget is registered with the same name on both commons and here. The gadget implemented with the name "HotCat" is trying to implement another gadget with the same name "HotCat" - the one from commons, causing the "already impemented" error. RTRC works after the recent loader update by Amorymeltzer because that gadget is named "RTRC" here and "rtrc" on mediawiki.org, hence no naming conflict.
So the only fix is to rename the gadget either here or on commons. @Xaosflux: Do you think it would be uncontroversial to change the name to MediaWiki:Gadget-Hotcat.js? Of course, the gadget itself can continue to be called "HotCat" everywhere else, such as in the gadget description and in the documentation. Its just the name that MediaWiki technically associates with the gadget that needs to be changed. I don't know, but I think this is worth the 40 kb bandwidth savings for the 39000 users. SD0001 (talk) 22:17, 7 November 2019 (UTC)Reply
Edit: Some testing on testwiki shows that isn't necessary to change the page name. Rather, only the name in the gadget definition needs to be changed. That is, change:
HotCat[ResourceLoader|rights=edit,purge]|HotCat.js
to:
Hotcat[ResourceLoader|rights=edit,purge]|HotCat.js
in MediaWiki:Gadgets-definition. I guess this should be quite uncontroversial, since this is totally behind-the-scenes. SD0001 (talk) 22:29, 7 November 2019 (UTC)Reply
Unless I'm going blind, those are identical? — xaosflux Talk 01:57, 8 November 2019 (UTC)Reply

The C is lowercase in the name. But thinking about it, I realise that changing the name of the gadget would cause the thing to be disabled for everyone, and they will all have to re-enable it. OTOH, changing the gadget name on commons would mean hundreds of wikis will have to update their loader codes. No wonder this issue has been unresolved all these years. SD0001 (talk) 12:09, 8 November 2019 (UTC)Reply