MediaWiki talk:Gadget-addsection-plus.js

Latest comment: 12 years ago by Superm401 in topic Can we make this happen faster?

{{editprotected}}

Please replace:

if(tablink.textContent) tablink.textContent = '+';
else if(tablink.innerHTML) tablink.innerHTML = '+';

with:

tablink.firstChild.nodeValue = '+';

as it's cross-browser, less complicated, and part of the W3 core DOM-1 spec. innerHTML with XHTML can be messy. Thanks, GracenotesT § 19:42, 19 April 2008 (UTC)Reply

Y Done - Nihiltres{t.l} 20:46, 19 April 2008 (UTC)Reply

Extra spacing edit

Even with this running, the tab still takes up more space than I think it used to. Compare to wiktionary:Talk:Main Page. However, I'm not sure what the cause of this is. Superm401 - Talk 10:22, 20 April 2008 (UTC)Reply

I found it. The padding on the "+"/"new section" tab was increased in MediaWiki:monobook.js. Superm401 - Talk 11:42, 20 April 2008 (UTC)Reply
Code to fix this is:
var plusLink = document.getElementById("ca-addsection").firstChild;
plusLink.style.paddingLeft = ".4em";
plusLink.style.paddingRight = ".4em";
This can just be added at the end of the current function. Superm401 - Talk 12:13, 20 April 2008 (UTC)Reply
 Y Done – now I have to add this to my monobook.js given the custom function I use. :) Nihiltres{t.l} 13:39, 20 April 2008 (UTC)Reply
Sorry. I tested this on discussion pages, but neglected to notice that the code is invalid if there is no "add section" tab (e.g. on regular articles). Basically, this stops any JavaScript later on the page from working. I've commented out the code temporarily, and will put it back after I've confirmed a fix. Superm401 - Talk 16:56, 20 April 2008 (UTC)Reply
Okay, it should be fixed now. Superm401 - Talk 17:04, 20 April 2008 (UTC)Reply
Actually, I don't think MediaWiki:Gadget-addsection-plus.js was ever broken. It already had the check for tab and tablink, and returned if they were null. Only the version in my user space was broken. :) I removed the gratuitous check, and then integrated the two blocks. Sorry for the confusion. Superm401 - Talk 17:08, 20 April 2008 (UTC)Reply

Can we make this happen faster? edit

I've turned this gadget off because I find myself intending to click on 'history' and actually clicking on 'move' because the 'new section' is changed to '+' well after it is visible.

Can we either have this gadget perform its stuff before the tabs are actually displayed, or actually change 'new section' to '+' like we did with 'discussion' to 'talk', invert people's selection of this gadget and make it do the opposite to what it does now :-) ?

Mark Hurd (talk) 04:31, 23 March 2012 (UTC)Reply

I don't know a way to make it happen earlier. It's currently being done on ready, which is about the earliest where we can still ensure the element exists. The inversion idea is clever, but it might be tricky getting consensus. Superm401 - Talk 22:11, 23 March 2012 (UTC)Reply