MediaWiki talk:Gadget-morebits.js

Untitled 2011 comment
Could a friendly admin please copy the contents of User:This, that and the other/temp/MediaWiki:Gadget-morebits.js to this page? I am currently in the process of testing this gadget script. — This, that, and the other (talk) 08:09, 16 May 2011 (UTC)
 * Friendly admin gladly complies. Amalthea  10:10, 16 May 2011 (UTC)

IndexOf x $.inArray
Wouldn't be better to change mw.config.get( 'wgUserGroups' ).indexOf( group ) !== -1 to $.inArray(group, mw.config.get( 'wgUserGroups' )) to ensure cross-browser support? Helder 13:55, 18 May 2011 (UTC)
 * I have no idea. But as there is no opposition I have made the change for you. &mdash; Martin (MSGJ · talk) 10:14, 19 May 2011 (UTC)
 * Fair enough. Personally, I think it's a performance decrease, and doesn't really improve legibility. But, that aside, any changes to this page are likely to get unintentionally overwritten, unless Twinkle maintainers get a heads-up at WT:TW. — This, that, and the other (talk) 10:40, 19 May 2011 (UTC)
 * Helder's point was mainly browser compatibility, I think: IE8 doesn't support JS 1.6 and thus doesn't know . Don't know how many other problems morebits has in IE8 (and older), of course.  Amalthea  11:03, 19 May 2011 (UTC)
 * Indeed. IE8 shows "undefined" if I put "javascript:alert(['foo'].indexOf)" in the adress bar while Firefox displays "function indexOf {[native code]}". Helder 18:06, 25 May 2011 (UTC)

Actually, that change broke stuff. Could an admin please revert it? Thanks, — This, that, and the other (talk) 10:57, 19 May 2011 (UTC)
 * Done. Amalthea  11:03, 19 May 2011 (UTC)
 * inArray also returns the index, comparing the return value with -1 should have worked. Amalthea  11:06, 19 May 2011 (UTC)
 * My bad. I forgot to add the "!== -1" part to the code above. This should work:

$.inArray(group, mw.config.get( 'wgUserGroups' )) !== -1;
 * Helder 18:06, 25 May 2011 (UTC)
 * I read at the top of the script: 'Most of the stuff here doesn't work on IE < 9.' I suspect it is not much use to fix this one incompatibility if several others remain. Anyway, as This, that and the other said, this script is in the middle of active development and any changes need to be made in the git repository to be persistent. Amalthea  19:20, 25 May 2011 (UTC)
 * Eh, now I get it: userIsInGroup is called while loading this script, so activating this gadget would actually cause javascript errors in IE8 or below. We can't have that in a gadget. I've made the change here, could someone also do so in the repo? Amalthea  19:25, 25 May 2011 (UTC)
 * I don't quite get it myself, but I trust your judgment, Amalthea. I have made the change in the git repo. — This, that, and the other (talk) 07:42, 26 May 2011 (UTC)