MediaWiki talk:Common.js/Archive 20
Appearance
![]() | This is an archive of past discussions about MediaWiki:Common.js. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 15 | ← | Archive 18 | Archive 19 | Archive 20 | Archive 21 | Archive 22 | Archive 23 |
Do not create NavFrame buttons if the new class "mw-collapsible" is used
Currently, the code which provides the Wikipedia:NavFrame functionality has a test like this
function createNavigationBarToggleButton(){
// ...
if (hasClass(NavFrame, "NavFrame")) {
// Create the buttons...
}
}
But this causes a conflict (example) if we try to moigrate to the (not so new) MediaWiki plugin which uses the class "mw-collapsible" (see previous discussion). Since it was not good idea to just copy the styles of NavFrames to the classes of this new plugin, I think a good way to help in the migration would be to improve the test above like this:
function createNavigationBarToggleButton(){
// ...
if (hasClass(NavFrame, "NavFrame") && !hasClass(NavFrame, "mw-collapsible")) {
// Create the buttons...
}
}
This way, we could still use the old classes for formatting and the new ones to make things "collapsible". The same idea would apply to the old "collapsible tables" system, where
if ( hasClass( Tables[i], "collapsible" ) ) {
would be replaced by
if ( hasClass( Tables[i], "collapsible" ) && !hasClass(NavFrame, "mw-collapsible") ) {
What do you think? Would that work? Helder 14:04, 5 March 2012 (UTC)
- By the way, we could also replace the deprecated
hasClass(NavFrame, "NavFrame")
by$(NavFrame).hasClass( 'NavFrame' )
(since this is the last script in MediaWiki namespace using this function). Helder 14:14, 5 March 2012 (UTC)