MediaWiki:Common.js/IEFixes.js View history

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

/** 
* Helper script for .hlist class in Common.css 
* @source mediawiki.org/wiki/Snippets/Horizontal_lists 
* @revision 5 (2013-12-22) 
* @author [[User:Edokter]] */
( function ( mw, $ ) {
    var profile = $.client.profile();
    if ( profile.versionNumber === 8 ) {
        /* IE 8: Add pseudo-selector class to last-child list items */
        mw.hook( 'wikipage.content' ).add( function ( $content ) {
            $content.find( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' )
                .addClass( 'hlist-last-child' );
        } );
    }
    else if ( profile.versionNumber <= 7 ) {
        /* IE 7 and below: Generate interpuncts and parentheses */
        mw.hook( 'wikipage.content' ).add( function ( $content ) {
            var $hlists = $content.find( '.hlist' );
            $hlists.find( 'dt:not(:last-child)' )
                .append( ': ' );
            $hlists.find( 'dd:not(:last-child)' )
                .append( '<b>·</b> ' );
            $hlists.find( 'li:not(:last-child)' )
                .append( '<b>·</b> ' );
            $hlists.find( 'dl dl, dl ol, dl ul, ol dl, ol ol, ol ul, ul dl, ul ol, ul ul' )
                .prepend( '( ' ).append( ') ' );
        } );
    }
}( mediaWiki, jQuery ) );