MediaWiki:Common.js

From Squeakypedia
Jump to: navigation, search

Note: After saving, 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: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */
/**
 * Helper script for .hlist class in MediaWiki:Common.css
 * @source mediawiki.org/wiki/Snippets/Horizontal_lists
 * @revision 3.1 (2013-01-16)
 * @maintainer [[User:Edokter]]
 */
if ( $.client.profile().name === 'msie' ) {
	/* Fix wrapping issue in IE 8 and up for hlist in table; put a soft-hyphen in front of list items. */
	if ( $.client.profile().versionNumber > 7 ) {
		mw.util.addCSS( 'table.hlist li:before { content: "\\ad"; }' );
	}
	/* Add pseudo-selector class to last-child list items in IE 8 */
	if ( $.client.profile().versionNumber === 8 ) {
		$( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' )
			.addClass( 'hlist-last-child' );
	}
	/* Generate interpuncts and parentheses for IE < 8 */
	if ( $.client.profile().versionNumber < 8 ) {
		var hlists = $( '.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( ') ' );
	}
}