Hello Sergey, I am currently working on some feature additions to Header Tabs for a private wiki and thought that maybe I could contribute back. You can see my development version running Sandbox but be aware it's not the final version, I'm still playing around with various UI elements. I hope to have the code publicly reviewable soon.
All features were added to the 1.17 jquery branch only:
- hash tag with tab or heading id now open the correct tab automatically on page-load
- $htTabNameInURI=true: If you click on a tab, it appends the hash for it to the URL so that bookmarks load to the correct tab
- $htAlwaysOn=false: If no <headertabs/> is found, inserts it at the end of the article. You can still use the tag to end tabs earlier
- $htRenderSingleTab=false: If only one tab is found, should we show tabs? Default is no. (change from current behaviour)
- $htDefaultFirstTab=false: If set to a string like 'General', automatically puts everything 'above' the first specified tab into this tab.
- $htDisableDefaultToc=true: The default TOC now works properly because the anchors load the right tab, however in most cases you still do not want to show a huge TOC above the tabs (maybe only if your skin puts them beside?). This disables the TOC only if tabs are being shown, if they aren't, then the TOC remains wherever it was inserted.
- $htGenerateTabTocs=true: Generates a TOC for each tab, but only if standard MW would usually generate a TOC for the headers found in the tab.
- $htEditTabLink=true: Adds a 'edit tab' link, I am currently playing with two ways of doing this, either in the top far right MW vector tabs, or by putting a section-style 'edit' link on the far right of the Tabs.
- $htAddTabLink=false: Adds a 'new' link, I am currently playing with 3 ways of doing this, either in the top far right MW vector tabs, using a '+' tab like browsers do, or by putting a section-style edit 'new' link on the far right of the tabs.
- $htStyle=false: A new style interface for tabs, the most popular from Extension:Header_Tabs/JQueryStyles could become standardized named styles you can use here. For now I've just added 'bare'.
- $htDisableInNamespaces=array(MAIN_TALK, USER_TALK): List of TALK namespaces where tabs will not be displayed if using the $htAlways on flag. This is to facilitate people using $htAddTabLink
- New magic words to match similar article-wide actions. __NOTABTOC__, , __NOTABEDITLINKS__, __NOTABNEWLINK__, __NOTABS__ will be added (next on my list)
I've done a bit of cleaning up of some of the code:
- ResourceLoader is now used properly and javascript is in
HeaderTabs/skins-jquery/ext.headertabs.core.js
and css in modules, for example,HeaderTabs/skins-jquery/ext.headertabs.bare.css
- Support for Extension:Configure
- the 'skins' folder has been renamed 'skins-yui' so people stop changing those files on MW 1.17 thinking it will affect jquery
Of course as it currently stands I have a few problems:
- $htRenderSingleTab and $htDefaultFirstTab cannot both be true, it puts tabs in things like the 'last edited at' line because more then article text is fed into the Parser.
- $htAddTabLink only works if you change MediaWiki:Newsectionheaderdefaultlevel to insert level-1 headers instead of level-2 headers. This change of course affects talk pages, which now become tab-heavens with $htAlwaysOn hence the use of $htDisableInNamespaces
- Some of my implementations may have better solutions, for example I hope to find nicer ways to generate the tab TOCS, and fix how the browser snaps down when viewing a tab with a TOC.
I hope to establish a new 'default' state that is not it's current state:
- $htAlwaysOn=true, $htDefaultFirstTab='General', $htStyle='bare' -- I believe this is a much better experience out of the box, however large wikis who for some reason use level 1 headers extensively will want to disable the alwayson, and wikis already using the tabs heavily for forms who want more of a visual cue may want to keep style at false.
While I could keep maintaining my version, I have SVN access and I was hoping that you would be open my collaborating with you and Yaron on Header Tabs. I'm committed to continuing to improve the features, and generally supporting the extension. I hope we can merge the changes outlined above with the main Header Tabs and continue to improve the extension. I'm very open to your feedback on these features as well.
This post was posted by Ofbeaton, but signed as Olivier Beaton.