MediaWiki talk:Gadget-morebits.js
Latest comment: 13 years ago by This, that and the other in topic IndexOf x $.inArray
![]() | Before modifying or proposing changes to this script, please note: Modifications made to this gadget script are likely to be unintentionally overwritten, as the script is automatically synchronized with an off-wiki code repository. Please notify Twinkle's maintainers of any changes you propose or make to this script. |
Untitled 2011 comment
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
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
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
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. — 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
Array.indexOf
.
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)
- Helder's point was mainly browser compatibility, I think: IE8 doesn't support JS 1.6 and thus doesn't know
- 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)
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
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 also returns the index, comparing the return value with -1 should have worked. Amalthea 11:06, 19 May 2011 (UTC)
$.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)
- 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 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)
- Helder 18:06, 25 May 2011 (UTC)