MediaWiki:Common.js

From Uncyclopedia, the content-free encyclopedia

Jump to: navigation, search

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

  • Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
  • Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
  • Opera, Konqueror and Safari users can just click the Reload button.
  • Chrome: press Ctrl+F5 or Shift+F5
/**<pre><nowiki>
 *
 * Some tips when editing this page...
 *
 ** Make sure that your code has been tested in the latest version of Firefox AND Internet Explorer! (Nobody cares about older versions)
 ** No compressed JS. Ever. As of MediaWiki 1.19+ we have [[mw:ResourceLoader]] to compress JS and make it fugly.
 ** Make sure that your code follows some coding conventions, preferrably MediaWiki's (see http://www.mediawiki.org/wiki/Manual:Coding_conventions)
 *
 * Your friendly neighborhood MediaWiki developer,
 * --Jack Phoenix, 26 July 2009
 * <jack@countervandalism.net>
 *
 * Tools: [http://uncyclopedia.wikia.com/index.php?title=-&action=raw&smaxage=0&gen=js reload cache]
 *
 * More notes: It is not enough to just define a function in this file; you must also write
 * a "hook" so that the function ever gets called.  The usual notion is to define it as the
 * handler for the onload event of the article's BODY.  MediaWiki provides:
 *   addOnloadHook(yourFunctionName);
 * However, this only takes effect after all content on the page has loaded, including
 * images. If you're trying to hide an image, this will be too late.  Alternatives take
 * effect the moment the DOM is ready for modification, even though the page might not
 * have been rendered:
 *   jQuery has:     jQuery(document).ready(yourFunctionName);
 *   Yahoo! has:     YAHOO.util.Event.onContentReady(elementID, yourFunctionName);
 *   Google has one too.
 * jQuery is widely used in this file, Wikia has already loaded it, and it is open-source.
 * This makes it preferable to using your favorite proprietary library, and loading into
 * everyone's cache multiple ways of doing the same thing.  --SPIKE Jun'14
 */
 
/* Non-namespace logos */
//===================================================
// faux-namespace fixes
//	(including hack for browsers with NO CSS3 support [IE6, etc])
//	- Bizzeebeever, 2011 (if this breaks shit, you know who to ban)
//===================================================
//add faux namespaces to {namespaces} as follows:
//	"namespaceName" : { tabText : "Tab text goes here", className : "Logo CSS class name" }
//		//tabText: [optional] default is namespaceName
//		//className [optional] will be given prefix "ns-". default is "ns-[namespaceName]"
//make sure if you are adding more than one to use a comma after each line except the last.
//<body> element for specified namespaces will be given the "ns-[className]" class.
//create your new stylesheet selector + rule in MediaWiki:Common.css accordingly
//	i.e. "body.ns-why #p-logo > a { background-image:url( someimage.png ) };")
 
YAHOO.util.Event.onContentReady( 'p-logo', function() {
	var namespaces = {
		$className: function( str ) {
			if ( str in this ) {
				return ' ns-' + ( this[str].className || str ).replace( /[\W]*/g, '' ).toLowerCase();
			}
		},
		$tabText: function ( str ) {
			if ( str in this ) {
				return this[str].tabText || str;
			}
		},
		//===add faux-namespaces below this line===
		'Un-Bestiary': { tabText: 'Bestiary' },
		'Uncycloversity': { tabText: 'Resource' }
	}
	var namespace = wgPageName.match( /^(Talk:)?[-\w\?]+/ )[0].replace( 'Talk:', '' );
	// grab namespace, stripping off "Talk:" if this is a talk page
	if ( !namespace ) {
		return;
	}
	// if empty namespace, probably an error
	if ( namespace in namespaces ) {
		// if a namespace hack is defined above...
		try {
			document.body.className += namespaces.$className( namespace );
			// apply custom style
			document.getElementById( 'ca-nstab-main' ).firstChild.innerHTML = namespaces.$tabText( namespace );
			// Change tab text
		} catch( e ) { return; }
	}
} );
// end faux-namespace fixes
 
/** Reskin parser ***********************************************************
 * Instructions:
 * 1) Add the page title and namespace exactly ("Name_space:Page_name") as new skin, use
 *	UNDERSCORES *NOT* SPACES: ("Main_Page": "", should be first line). The next parameter
 *	is optionally an existing "MediaWiki:Skin/"-prefixed file (in which case you can skip
 *	step 2).
 * 2) Create MediaWiki:Skin/Name_Space:Page_Name.css and place reskin CSS content there.
 */
reskin = {
	'Main_Page': '',
	'UnNews:Main_Page': 'UnNews.css',
        'UnNews:2015_British_general_election': 'UnNews.css',
        'UnNews:2016_Hillary_Clinton_campaign': 'UnNews.css',
	'UnNews:Religion_Section': 'UnNews.css',
	'AAAAAAAAA!': 'Aaaa.css',
	'An:': '',
	'Babel:666': '',
	'Babel:96': '',
	'Babel:Aa': 'Aaaa.css',
	'Babel:Ap': 'Fullscreen.css',
	'Babel:APPL': 'Fullscreen.css',
	'Babel:CaD': '',
	'Babel:Communpedia': 'Communpedia.css',
	'Babel:F@H': '',
	'Babel:Gbs': '',
	'Babel:Hi': '',
	'Babel:Newspeak': '',
	'Babel:Pumpkin': 'Fullscreen.css',
	'Babel:Vogon': 'Vg:.css',
	'Babel:W2': 'Fullscreen.css',
	'Bad_title': 'Nocategories.css',
	'Broken_Redirect': 'Nocategories.css',
	'Cart': 'Fullscreen.css',
	'Drawing': 'Nocategories.css',
	'EBay': '',
	'Em:': '',
	'File_8AO4F:_The_God_Case': 'Fullscreen.css',
	'Gullible': 'Nocategories.css',
	'Holocaust_denial_denial_denial_denial_denial': 'Nocategories.css',
	'International_Page_Blanking_Day': 'Nocategories.css',
	'Kenny_McCormick': '',
	'Loneliness': 'Em:.css',
	'Talk:Loneliness': 'Em:.css',
	'Marty_Friedman': 'Nocategories.css',
	'Memento': '',
	'Misleading': 'Nocategories.css',
	'Movie_Trailer_Announcer_Guy': '',
	'MS_Paint': '',
	'Namespace:Main_Page': '',
	'Nihilism': '',
	'Rafael_Nadal': '',
	'Rp:': '',
	'ROT13': '',
	'Sdrawkcab': '',
	'Socratic_method': 'Nocategories.css',
	'Slime_Cube': '',
	'Time_Cubicle': 'Slime Cube.css',
	'The_Consumerist': '',
	'Tlh:': '',
	'Tx:': '',
	'UnTunes:Artsy_and_Misunderstood:_A_Bedroom_Emo_Song': 'Em:.css',
	'Uncyclopedia!_Answers': 'Fullscreen.css',
	'Upside_Down': '',
	'Visual_puns': 'Nocategories.css',
	'Wikimedia_fundraising': '',
	'Wikimedia_fundraising/Zombiebaron': '',
	'Wikipedia': '',
	'Yahoo!': 'Fullscreen.css'
	// Make sure all lines in this list except the last one have a comma after!
}
 
var skinName;
 
if( reskin[wgPageName] != undefined && wgIsArticle == true ) {
	skinName = ( reskin[wgPageName].length > 0 ) ? reskin[wgPageName] : wgPageName + '.css';
	document.write( '<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:Skin/' + skinName + '&action=raw&ctype=text/css"; /*]]>*/</style>' );
}
 
/* Special reskin (skin specific) for [[SOPA]] -L */
if ( wgPageName == 'SOPA' ) {
	if ( skin == 'uncyclopedia' ) {
		importStylesheet( 'MediaWiki:Skin/black vector.css' );
	} else if ( skin == 'monobook' ) {
		importStylesheet( 'MediaWiki:Skin/Black monobook.css' );
	}
}
 
/* drop-downs for cactions tabs and whatnot */
// importScript( 'User:Lyrithya/dropdown.js' );
 
function noLogo() {
	if( document.getElementById( 'nologo' ) ) {
		document.getElementById( 'p-logo' ).style.display = 'none';
	}
}
YAHOO.util.Event.onContentReady( 'p-logo', noLogo );
 
function noTitle() {
	if( document.getElementById( 'notitle' ) ) {
		document.getElementById( 'firstHeading' ).style.display = 'none';
	}
}
YAHOO.util.Event.onContentReady( 'firstHeading', noTitle );
 
function noCategories() {
	if( document.getElementById( 'nocategories' ) ) {
		document.getElementById( 'catlinks' ).style.display = 'none';
	}
}
YAHOO.util.Event.onContentReady( 'catlinks', noCategories );
 
function validateImageURL( textval ) {
	var urlregex = new RegExp(
		"^(http|https)\://(images[0-9]|images)\.wikia.([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*\.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG)$" );
	return ( urlregex.test( textval ) & ( textval.length < 200 ) );
}
 
function logotipo() {
	if( document.getElementById( 'logotipo' ) ) {
		if ( document.getElementById( 'logotipo' ).firstChild.src != null ) {
 			var logoURL = document.getElementById( 'logotipo' ).firstChild.src;
			if ( validateImageURL( logoURL ) ) {
				document.getElementById( 'p-logo' ).innerHTML= '<a style="background-image: url(' + logoURL + ')" href="/wiki/Main_Page" title="Visit the main page"/>';
			}
		} else {
			if ( document.getElementById( 'logotipo' ).firstChild.firstChild.src != null) {
				logoURL = document.getElementById( 'logotipo' ).firstChild.firstChild.src;
				if ( validateImageURL( logoURL ) ) {
					document.getElementById( 'p-logo' ).innerHTML= '<a style="background-image: url(' + logoURL + ')" href="/wiki/Main_Page" title="Visit the main page"/>';
				}
			}
		}
	}
}
YAHOO.util.Event.onContentReady('p-logo', logotipo);
 
/** Dismiss notice remover
 * (only removes if you have made a custom sitenotice designed to use its own close button)
 */
function removeSitenoticeDismiss() {
	snh = document.getElementById( 'siteNoticehide' );
	if( !snh ) {
		return;
	}
	snh = snh.parentNode;
	snh.href = 'javascript:dismissNotice();';
	noticetr = document.getElementById( 'mw-dismissable-notice' );
	if( !noticetr ) {
		snh.parentNode.removeChild( snh );
		return;
	}
	noticetr = noticetr.firstChild.firstChild;
	noticetr.removeChild( noticetr.lastChild );
}
YAHOO.util.Event.onContentReady('siteNoticehide', removeSitenoticeDismiss);
 
/** Username replace function ([[template:USERNAME]]) *******************************
 * Inserts user name into <span class="insertusername"></span>
 * Originally by [[wikia:User:Splarka|Splarka]]
 * New version by [[User:Spang|Spang]]
 */
function UserNameReplace() {
	if( typeof( disableUsernameReplace ) != 'undefined' && disableUsernameReplace || wgUserName == null ) { return; }
	$("SPAN.insertusername").html(wgUserName);
}
addOnloadHook( UserNameReplace );
 
/** Title rewrite ********************************************************
 * Rewrites the page's title,
 * By [[User:Sikon|Sikon]]
 * Recoded with jQuery by Spike, Nov'15
 * [[Template:Title]] puts an invisible DIV in the article with the desired new title,
 *   always accompanied by another DIV with the desired alignment for the title.
 *   Here we copy their text to the page's H1 element and its title.
 * User can define SKIP_TITLE_REWRITE == 1 in personal JavaScript to inhibit this.
 */
function rewriteTitle() {
	if( typeof( SKIP_TITLE_REWRITE ) != 'undefined' && SKIP_TITLE_REWRITE ) {
		return;
	}
 
	var newDocumentTitle = $("DIV#title-meta")[0].innerHTML;
	if (newDocumentTitle == null || newDocumentTitle == undefined) { return };
 
        $("H1#firstHeading")
          .html(newDocumentTitle)
          .css("align", $("DIV#title-align").text());
 
	document.title = newDocumentTitle;
}
 
jQuery(document).ready(rewriteTitle);
 
/** Dynamic navigation bars ************************************************
 * Allows navigation templates to expand and collapse their content to save space
 * Documentation on Wikipedia at Wikipedia:NavFrame
 */
 
// set up the words in your language
var NavigationBarHide = '[hide]';
var NavigationBarShow = '[show]';
 
// set up max count of Navigation Bars on page,
// if there are more, all will be hidden
// NavigationBarShowDefault = 0; // all bars will be hidden
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
var NavigationBarShowDefault = 1;
 
// Function called by a [show]/[hide] link in a collapsible DIV, so declared by class name.
//	The function changes the legend on the link, then changes the content's CSS to affect
//	its visibility.
// Parameters:
//	indexNavigationBar: the 1-based index of the navigation bar to be toggled
// var NavToggle,NavFrame used to be the element. After converting to jQuery, they are 
//	now the jQuery selector.  Former error detection (elements don't exist?) is deleted;
//	the jQuery won't do anything if someone supplies an index not referring to any frame.
 
function toggleNavigationBar( indexNavigationBar ) {
	var NavToggle = '#NavToggle' + indexNavigationBar;
	var NavFrame  = '#NavFrame'  + indexNavigationBar;
 
	// Content is shown now but reader clicked [hide]
	if( $(NavToggle).text() == NavigationBarHide ) {
		$(NavToggle).text(NavigationBarShow)
		$(NavFrame).children("NavContent").css("display", "none")
			   .end()
			   .children("NavPic").css("display", "none");
 
	// Content is hidden now but reader clicked [show]
	} else if( $(NavToggle).text() == NavigationBarShow ) {
		$(NavToggle).text(NavigationBarHide)
		$(NavFrame).children("NavContent").css("display", "block")
			   .end()
			   .children("NavPic").css("display", "block");
	}
}
 
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
  var indexNavigationBar = 0;
  $("DIV.NavFrame").each( function() {
	indexNavigationBar++;
	var NavToggle = document.createElement( 'a' );
	NavToggle.className = 'NavToggle';
	NavToggle.id        = 'NavToggle' + indexNavigationBar;
	NavToggle.href      = 'javascript:toggleNavigationBar(' + indexNavigationBar + ');';
 
	var NavToggleText = document.createTextNode( NavigationBarHide );
	NavToggle.appendChild( NavToggleText );
 
	$(this).attr( 'id', 'NavFrame' + indexNavigationBar )
               .child(".NavHead").append(NavToggle);
  });
 
  // if more Navigation Bars found than Default: hide all
  if( NavigationBarShowDefault < indexNavigationBar ) {
	for( var i = 1; i <= indexNavigationBar; i++ ) {
		toggleNavigationBar( i );
	}
  }
}
 
addOnloadHook( createNavigationBarToggleButton, false );
 
 
/** Another collapsible whatnits implementation - for the sidebar mostly, but can be used with whatever
	I'd write some documentation or something, but I can't be arsed. -Lyrithya
 
********************************************* star */
 
jQuery( document ).ready( function() {
	$( '.collapsed > *' ).next().css( 'display', 'none' );
	$( '.expanded > *' ).click( function() {
		$( this ).next().toggle();
		$( this ).parent().toggleClass( 'expanded' );
		$( this ).parent().toggleClass( 'collapsed' );
	});
	$( '.collapsed > *' ).click( function() {
		$( this ).next().toggle();
		$( this ).parent().toggleClass( 'collapsed' );
		$( this ).parent().toggleClass( 'expanded' );
	});
});
 
/*
 * Trivial plugin for hiding the portals in the sidebar panel
 * Written by Silent Penguin
 */
(function( $ ) {
	$.fn.hidingToolbox = function( options ) {
		var settings = {
			'initClosed': true,
			'duration': 200,
			'contentSelector': '.pBody',
			'handleSelector': 'h5',
			'slide': function( visible ) {
				if( visible ) {
					this.parent().addClass( 'hidden' ).removeClass( 'visible' );
				} else {
					this.parent().addClass( 'visible' ).removeClass( 'hidden' );
				}
			}
		};
 
		// where the magic happens
		var handleClick = function() {
			var handle = $( this ).parent().find( settings['contentSelector'] );
			var visible = handle.is( ':visible' )
			handle[visible ? 'slideUp' : 'slideDown'](settings['duration'], function() {
				return settings['slide'].apply( $( this ), [visible] );
			} );
		}
 
		var handleHoverIn = function() {
			$( this ).addClass( 'hover' );
		}
 
		var handleHoverOut = function() {
			$( this ).removeClass( 'hover' );
		}
 
		var length = this.length;
 
		if ( typeof( options ) == typeof( Object() ) ) {
			$.extend( settings, options );
		}
		// If options exist and is the right type, lets merge them with our default settings
 
		if (
			typeof( settings['initClosed'] ) == typeof( Array() ) &&
			!settings['initClosed'].length
		)
		{
			settings['initClosed'] = true;
		}
		// if our init closed is an empty array, define it to the default again.
 
		return this.each( function( key ) {
			var self = $( this );
			self.find( settings['handleSelector'] )
				.hover( handleHoverIn, handleHoverOut ) // detect hovers, style accordingly
				.click( handleClick ); // click event to open and close
			var initClosed = typeof( settings['initClosed'] ) == typeof( Array() )
				? settings['initClosed'][Math.min( key, length - 1 )]
				: settings['initClosed'];
			self.find( settings['contentSelector'] )[initClosed ? 'hide' : 'show']().parent().addClass( initClosed ? 'hidden' : 'visible' );
		});
	};
})( jQuery );
 
jQuery( document ).ready( function() {
	jQuery( '.generated-sidebar:not(#p-navigation), #p-tb, #p-wikicities-nav, #p-lang' ).hidingToolbox({'initClosed': [false, true, false, false]});
	jQuery( '#column-one' ).addClass( 'collapsible_pile' );
});
 
/** Archive edit tab disabling *************************************
 * Disables the edit tab on old forum topic pages to stop noobs bumping old topics.
 * Page can still be edited by going via the edit tab on the history etc, or by
 * typing the edit address manually.
 * By [[User:Spang|Spang]]
 */
function disableOldForumEdit() {
	if( typeof( enableOldForumEdit ) != 'undefined' && enableOldForumEdit ) {
		return;
	}
	if( !document.getElementById( 'ca-edit' ) || !document.getElementById( 'old-forum-warning' ) ) {
		return;
	}
	editLink = document.getElementById( 'ca-edit' ).firstChild;
	editLink.removeAttribute( 'href', 0 );
	editLink.style.color = 'gray';
	editLink.innerHTML = 'No Editing';
}
addOnloadHook( disableOldForumEdit );
 
/** Add section tab disabling *************************************
 * Disables the add section tab on any page you like, mainly useful for your userpage
 * (depending on how you have your userpage set up)
 * To use it, include any HTML element with an ID of disableAddSection, such as <div id="disableAddSection"></div>
 * By Olipro
 */
function disableAddSection() {
  if ($("#disableAddSection").length > 0) { $("#ca-addsection").remove(); };
}
 
addOnloadHook( disableAddSection );
 
/** Remove example text **************************************************
 * Automatically removes any example text left on the page upon saving.
 * By [[User:Spang]]
 */
function stripExamples() {
	try {
		var tb = document.forms[0].wpTextbox1;
		var tbh = tb.scrollTop;
		tb.value = tb.value.replace(/(\'\'\'Bold text\'\'\'|\'\'Italic text\'\'|\[\[Link title\]\]|\[http:\/\/www\.example\.com link title\]|\n== Headline text ==\n|\[\[Image:Example\.jpg\]\]|\[\[File:Example\.jpg\]\]|<math>Insert formula here<\/math>|<nowiki>Insert non-formatted text here<\/nowiki>|<code><\/code>|\[\[Media:Example\.ogg\]\]|\n(?=\n\n\n))/g,'');
		tb.scrollTop = tbh;
		return true;
	} catch( e ) {
		return true;
	}
}
addOnloadHook(
	function() {
		if ( ( wgAction == 'edit' || wgAction == 'submit' ) && wgCanonicalSpecialPageName == false ) {
			document.forms[0].wpSave.setAttribute( 'onclick', 'return stripExamples()' );
		}
	}
)
 
/** JavaScript for the UnNews namespace ***********************************
 */
function unNewsFrontPageJS() {
/* For any article: if an Audio is available, move the indication inside the masthead. */
  if ($("TABLE.UnNewsAudioAvailable").length > 0) {
    $("TD.masthead_right").replaceWith($("TABLE.UnNewsAudioAvailable"));
    };
/* For the Front Page: Remove all the p-cactions, such as View source and History */
  if (wgPageName == "UnNews:Main_Page") {
    $("DIV#p-cactions").remove();
    };
  };
 
if (wgNamespaceNumber == 102) { addOnloadHook( unNewsFrontPageJS ); };
 
/** Sortable table fixes **************************************************
 * Fixes some problems the default sortable table script has.
 * Slightly modifies the ts_resortTable function found in wikibits.js
 */
function ts_resortTable( lnk ) {
	var span = lnk.getElementsByTagName( 'span' )[0];
	var td = lnk.parentNode;
	var tr = td.parentNode;
	var column = td.cellIndex;
	var table = tr.parentNode;
 
	while( table && !( table.tagName && table.tagName.toLowerCase() == 'table' ) ) {
		table = table.parentNode;
	}
 
	if( !table ) {
		return;
	}
 
	if( table.rows.length <= 1 ) {
		return;
	}
 
	if( ts_number_transform_table == null ) {
		ts_initTransformTable();
	}
 
	var rowStart = table.tHead && table.tHead.rows.length > 0 ? 0 : 1;
	var itm = '';
	for( var i = rowStart; i < table.rows.length; i++ ) {
		if( table.rows[i].cells.length > column ) {
			itm = ts_getInnerText( table.rows[i].cells[column] );
			itm = itm.replace(/^[\s\xa0]+/,"").replace(/[\s\xa0]+$/,"");
			if( itm != '' ) {
				break;
			}
		}
	}
	var sortfn = ts_sort_generic;
	var preprocessor = ts_toLowerCase;
	if( /^\d\d[\/. -][a-zA-Z]{3}[\/. -]\d\d\d\d$/.test( itm ) ) {
		preprocessor = ts_dateToSortKey;
	} else if( /^\d\d[\/.-]\d\d[\/.-]\d\d\d\d$/.test( itm ) ) {
		preprocessor = ts_dateToSortKey;
	} else if( /^\d\d[\/.-]\d\d[\/.-]\d\d$/.test( itm ) ) {
		preprocessor = ts_dateToSortKey;
	} else if( /(^[\u00a3$\u20ac\u00a4\u00a5]|\u00a2$)/.test( itm ) ) {
		preprocessor = ts_currencyToSortKey;
	} else if( ts_number_regex.test( itm ) || /sm=n$/.test( itm ) ) {
		preprocessor = ts_parseFloat;
	}
	var reverse = span.getAttribute( 'sortdir' ) == 'down';
	var newRows = new Array;
	var staticRows = new Array;
	for( var j = rowStart; j < table.rows.length; j++ ) {
		var row = table.rows[j];
		if( ( ' ' + row.className + ' ' ).indexOf( ' unsortable ' ) < 0 ) {
			var keyText = ts_getInnerText( row.cells[column] );
			var oldIndex = reverse ? -j : j;
			var preprocessed = preprocessor( keyText );
			newRows[newRows.length] = new Array( row, preprocessed, oldIndex );
		} else {
			staticRows[staticRows.length] = new Array( row, false, j-rowStart );
		}
	}
	newRows.sort( sortfn );
	var arrowHTML;
	if( reverse ) {
		arrowHTML = "<img src=\"" + ts_image_path + ts_image_down + "\" alt=\"&darr;\"/>";
		newRows.reverse();
		span.setAttribute( 'sortdir', 'up' );
	} else {
		arrowHTML = "<img src=\"" + ts_image_path + ts_image_up + "\" alt=\"&uarr;\"/>";
		span.setAttribute( 'sortdir', 'down' );
	}
	for( var i = 0; i < staticRows.length; i++ ) {
		var row = staticRows[i];
		newRows.splice( row[2], 0, row );
	}
	for( var i = 0; i < newRows.length; i++ ) {
		if( ( ' ' + newRows[i][0].className + ' ' ).indexOf( ' sortbottom ' ) == -1 ) {
			table.tBodies[0].appendChild( newRows[i][0] )
		}
	}
	for( var i = 0; i < newRows.length; i++ ) {
		if( ( ' ' + newRows[i][0].className + ' ' ).indexOf( ' sortbottom ' ) != -1 ) {
			table.tBodies[0].appendChild( newRows[i][0] )
		}
	}
	var spans = getElementsByClassName( tr, 'span', 'sortarrow' );
	for( var i = 0; i < spans.length; i++ ) {
		spans[i].innerHTML = "<img src=\"" + ts_image_path + ts_image_none + "\" alt=\"&darr;\"/>";
	}
	span.innerHTML = arrowHTML;
	if( ts_alternate_row_colors ) {
		ts_alternate( table );
	}
}
 
/** IP template for ban patrol ******
 * Others can be added for other or all pages.
 */
if( mwCustomEditButtons && wgPageName == 'Uncyclopedia:Ban_Patrol' ) {
	mwCustomEditButtons[mwCustomEditButtons.length] = {
		'imageFile': 'http://images1.wikia.com/uncyclopedia/images/d/d7/IP_button.png',
		'speedTip': 'IP template',
		'tagOpen': '{' + '{' + 'IP|',
		'tagClose': '}' + '}',
		'sampleText': '127.0.0.1'
	};
}
 
/** Featured Interwiki *******************************
 * Stolen from Wikipedia
 */
function linkFA() {
// in jQuery you could iterate over all a page's interwiki links as follows:
//  $("#p-lang LI[class^='interwiki-']").each( function () { ... } );
 
	if ( document.getElementById( 'p-lang' ) ) {
		interwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );
 
		for ( var i in interwikiLinks ) {
			if ( document.getElementById( interwikiLinks[i].className + '-fa' ) ) {
				interwikiLinks[i].className += ' FA';
				interwikiLinks[i].title = 'This is a featured article in another language';
			}
		}
	}
};
YAHOO.util.Event.onContentReady( 'column-one', linkFA );
 
importScript( 'MediaWiki:VFH vote.js' );
 
/** COMMENTED-OUT FORMER CODE **************************
 * Nachteule told me to add this on my talkpage - Dr. S
 * Both of these are deprecated and were removed in MW 1.20 --SPIKE
 * window.wgMWSuggestTemplate = "http://uncyclopedia.wikia.com/api.php?action=opensearch\x26search={searchTerms}\x26namespace={namespaces}\x26suggest";
 * window.wgSearchNamespaces = [0];
 */
Personal tools
projects