MediaWiki talk:Gadget-site.js
Add topicwgIsMainPage
[edit]Could you simplify
if ( mw.config.get( 'wgMainPageTitle' ) === mw.config.get( 'wgPageName' ) && mw.config.get( 'wgAction' ) === 'view' )
to
if ( mw.config.get( 'wgIsMainPage' ) && mw.config.get( 'wgAction' ) === 'view' )
? Helder 14:08, 18 July 2012 (UTC)
- This code used to work for all subpages of the Main page but after this edit in June 2011 the current setup doesn't make much sense anymore. I suggest replacing this (and a lot of CSS code in Common.css) with something like
if ( /^MediaWiki(\/.+)?$/.test( mw.config.get( 'wgPageName' ) )
&& mw.config.get( 'wgAction' ) === 'view' )
{
importScript('MediaWiki:Mainpage.js');
}
Collapsible tables
[edit]The code seems broken (at least for me before changing collapsible to mw-collapsibe on Template:Collapse top). Maybe we should get rid of it, looking first on a recent xml dump that isn't being used anywhere else and replace it with mw-collapsibe. --Ciencia Al Poder (talk) 13:36, 31 December 2012 (UTC)
- Ok, I did that research for myself from the latest dump available (mediawikiwiki-20121226-pages-articles-multistream.xml) and migrated all of them. --Ciencia Al Poder (talk) 16:11, 1 January 2013 (UTC)
Use mw.hook( 'wikipage.content' )
[edit]Hi!
Could someone make this fix for the collapsible things? Helder 16:32, 25 August 2013 (UTC)
- Done, and improved upon further. Krinkle (talk) 00:14, 28 August 2013 (UTC)
fix MW:Common.js
[edit]/* Any JavaScript here will be loaded for all users on every page load. */
/**
* Description: Lazy-load mediawiki.ui.button module when .mw-ui-button is present
* Maintainers: [[User:Edokter]]
*/
mw.hook( 'wikipage.content' ).add( function() {
if ( ( mw.loader.getState( 'mediawiki.ui.button' ) === 'registered' ) && ( $( '.mw-ui-button' ).length ) ) {
mw.loader.load( 'mediawiki.ui.button' );
}
} );
/* End of mw.loader.using callback */
} );
The code currently on MediaWiki:Common.js has mismatched brackets. Please correct to:
/* Any JavaScript here will be loaded for all users on every page load. */
/**
* Description: Lazy-load mediawiki.ui.button module when .mw-ui-button is present
* Maintainers: [[User:Edokter]]
*/
mw.hook( 'wikipage.content' ).add( function() {
if ( ( mw.loader.getState( 'mediawiki.ui.button' ) === 'registered' ) && ( $( '.mw-ui-button' ).length ) ) {
mw.loader.load( 'mediawiki.ui.button' );
}
} );
Thanks Technical 13 (talk) 23:28, 24 February 2014 (UTC)
Category prefix hiding
[edit]I just noticed this trick on Category:Search and I'm not sure I'm fond of it. The result seems undesirable, see phabricator:F2330328 where it's very hard to understand what a generic title such as "Old" might be. If that snippet's idea is to sort of fix bug 29975, I think it's fairly misguided. --Nemo 19:19, 24 August 2015 (UTC)