Community Central
Community Central
Forums: Index Support Requests Extension:Tabber - Setting the default tab displayed
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Archive
Note: This topic has been unedited for 4220 days. It is considered archived - the discussion is over. Information in this thread may be out of date. Do not add to unless it really needs a response.


I am using the tabber extension, to hold my SMW forms and I wanted to set the default tab to the second tab instead of the first (Because the infobox input in the form has to be before the article text, or it will display after the article text). I found a function "tabShow(tabindex)" in the tabber javascript to set the tab, but I am unsure how to actually implement it.

Here is a link to the form. Thanks — SimAnt 23:05, September 22, 2012 (UTC)

if (mw.config.get('wgPageName') === 'Special:FormEdit/Character/Demo') {
    $(window).on('load.tabberhack', function() {
        $('.tabberlive')[0].tabber.tabShow(1); // Switch to tab 2
        $(window).off('load.tabberhack');
    });
};

Stick this in MediaWiki:Common.js. Although it would be more efficient to use <verbatim> to stick it in just the relevant page instead.

[The tabber extension is pretty lame really, it doesn't support nesting (at least, not unless you use {{#tag:tabber}} and {{!}} to work around the bug), it doesn't play well with templates, it breaks headings, it isn't semantic, and the JS supports specifying a default tab, but only by adding a CSS class to the relevant DIV (which you can't since the DIVs are generated by the extension itself, great planning on the part of the author there).] Lunarity 07:00, September 23, 2012 (UTC)

I tried the above code in my personal js and also with Verbatim on Form:Test and MediaWiki:TabberSwap, and it causes the tabber not to display at all on those pages. — SimAnt 21:56, September 23, 2012 (UTC)
That's a problem. It's probably a race against JSSnippets — the problem is that the tabber does not announce when it is ready so the code is running too early. I've adjusted the code, hopefully this will work better. Lunarity 13:51, September 24, 2012 (UTC)
It works! Thanks! — SimAnt 21:40, September 24, 2012 (UTC)
@Lunarity
Are you talking about the tabber as offered by wikia, or about placing Fitzgerald's tabber in Common.js? Because placing it in Common.js does all you describe as lacking, custom divs and everything (example). What seems to be lame is wikia's implementation of it.
--IK Talk 19:38, September 28, 2012 (UTC)
I was referring specifically to the Tabber Extension itself which has a terrible syntax and obtuse behaviours, even by MediaWiki's standards. Using the JavaScript directly and constructing the tabs out of raw DIVs would avoid most of the problems, yes. (Although, the JS design does have a memory leak in it so it isn't perfect either) Lunarity 19:53, September 28, 2012 (UTC)