MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/** * Hides the link to parent pages from subpages if is included **/ function hideContentSub { if ( mw.config.get( 'wgNamespaceNumber' ) === 0 || $( '#hideContentSub' ).length > 0 ) { if ( mw.config.get( 'skin' ) === 'oasis' ) { if ($( '#WikiaPageHeader h2' ).text.substring(0, 1) === "<") { var	$wikiaHeader = $( '#WikiaPageHeader h2' ), $backToPageLink; if ( mw.config.get( 'wgNamespaceNumber' ) % 2 === 1 ) { // ugly hack to only leave back to page link on talk pages $backToPageLink = $wikiaHeader.find( 'a[accesskey="c"]' ); $wikiaHeader.html( '' ).append( $backToPageLink ); } else { $wikiaHeader.hide; }			}		} else { if ( $( '#contentSub span.subpages' ).text.substring(0, 1) === "<" ) { $( '#contentSub span.subpages' ).hide; }		}	} }

// onload stuff var firstRun = true;

function loadFunc { if( firstRun ) { firstRun = false; } else { return; }	window.pageName = wgPageName; window.storagePresent = (typeof(localStorage) != 'undefined'); // DEPRECATED if( document.getElementById('infoboxinternal') != null && document.getElementById('infoboxend') != null ) { document.getElementById('infoboxend').innerHTML = '[Hide]'; }	// Upload form - need to run before adding hide buttons if ( wgCanonicalSpecialPageName === 'Upload' ) { setupUploadForm; }	addHideButtons; if( document.getElementById('mp3-navlink') !== null ) { document.getElementById('mp3-navlink').onclick = onArticleNavClick; document.getElementById('mp3-navlink').getElementsByTagName('a')[0].href = 'javascript:void(0)'; }	if( window.storagePresent ) { initVisibility; }	fillEditSummaries; fillPreloads; substUsername; substUsernameTOC; rewriteTitle; showEras('title-eraicons'); showEras('title-shortcut'); rewriteHover; // replaceSearchIcon; this is now called from MediaWiki:Monobook.js	fixSearch; hideContentSub; var body = document.getElementsByTagName('body')[0]; var bodyClass = body.className; if( !bodyClass || (bodyClass.indexOf('page-') === -1) ) { var page = window.pageName.replace(/\W/g, '_'); body.className += ' page-' + page; }	if( typeof(onPageLoad) != "undefined" ) { onPageLoad; } }

// ============================================================ // BEGIN JavaScript title rewrite -- jQuery version and new wikia skin fixes by Grunny function rewriteTitle { if( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) { return; }	if( $('#title-meta').length == 0 ) { return; }	var newTitle = $('#title-meta').html; if( skin == "oasis" ) { $('header.WikiaPageHeader > h1').html(' ' + newTitle + ' '); $('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html + ';'); } else { $('.firstHeading').html(' ' + newTitle + ' '); $('.firstHeading').attr('style','text-align:' + $('#title-align').html + ';'); } } function showEras(className) { if( skin == 'oasis' ) { return; }	if( typeof( SKIP_ERAS ) != 'undefined' && SKIP_ERAS ) return; var titleDiv = document.getElementById( className ); if( titleDiv == null || titleDiv == undefined ) return; var cloneNode = titleDiv.cloneNode(true); var firstHeading = getFirstHeading; firstHeading.insertBefore(cloneNode, firstHeading.childNodes[0]); cloneNode.style.display = "block"; } // END JavaScript title rewrite