MediaWiki:Common.js

importScript('MediaWiki:Functions.js'); /* Any JavaScript here will be loaded for all users on every page load. */

function GetBlip{ var blip_elements = getElementsByClassName(document.getElementById('bodyContent'),'div','video_blip'); for(var i = 0; i < blip_elements.length; i++){ blip_elements[i].innerHTML = " "; } } GetBlip;

// ============================================================ // BEGIN Dynamic Navigation Bars (experimantal) // This script is from Wikipedia. For author attribution, please see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history

/* Test if an element has a certain class ************************************** * * Description: Uses regular expressions and caching for better performance. * Maintainers: User:Mike Dillon, User:R. Koot, User:SG */

var hasClass = (function {    var reCache = {};    return function (element, className) {        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);   }; });

/** Collapsible tables ********************************************************* * *  Description: Allows tables to be collapsed, showing only the header. See *              NavFrame. * Maintainers: User:R. Koot */ var autoCollapse = 2; var collapseCaption = "hide"; var expandCaption = "show"; function collapseTable( tableIndex ) {    var Button = document.getElementById( "collapseButton" + tableIndex ); var Table = document.getElementById( "collapsibleTable" + tableIndex ); if ( !Table || !Button ) { return false; }    var Rows = Table.getElementsByTagName( "tr" ); if ( Button.firstChild.data == collapseCaption ) { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = "none"; }        Button.firstChild.data = expandCaption; } else { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = Rows[0].style.display; }        Button.firstChild.data = collapseCaption; } } function createCollapseButtons {    var tableIndex = 0; var NavigationBoxes = new Object; var Tables = document.getElementsByTagName( "table" ); for ( var i = 0; i < Tables.length; i++ ) { if ( hasClass( Tables[i], "collapsible" ) ) { NavigationBoxes[ tableIndex ] = Tables[i]; Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex ); var Button    = document.createElement( "span" ); var ButtonLink = document.createElement( "a" ); var ButtonText = document.createTextNode( collapseCaption ); Button.style.styleFloat = "right"; Button.style.cssFloat = "right"; Button.style.fontWeight = "normal"; Button.style.textAlign = "right"; Button.style.width = "6em"; ButtonLink.setAttribute( "id", "collapseButton" + tableIndex ); ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" ); ButtonLink.appendChild( ButtonText ); Button.appendChild( document.createTextNode( "[" ) ); Button.appendChild( ButtonLink ); Button.appendChild( document.createTextNode( "]" ) ); var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0]; /* only add button and increment count if there is a header row to work with */ if (Header) { Header.insertBefore( Button, Header.childNodes[0] ); tableIndex++; }        }     }     for ( var i = 0;  i   on the end of your article!"	};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/__cb20120507231341/central/images/4/43/Button_Infobox.png", "speedTip": "Infobox nation", "tagOpen": "", "sampleText": "" };

}*/ /* =================  Edit summaries from runescape.wikia.com ================= */ $(function {       if (skin == 'oasis'){            var $label = $('#edit_enhancements_toolbar #wpSummaryLabel');	    if (!$label.size) {	    	    return;	    }        }        if (skin == 'monobook'){	    var $label = $('.editOptions #wpSummaryLabel');	    if (!$label.size) {	    	    return;	    }        }	$combo = $(' ').attr('id', 'stdSummaries').change(function { var val = $(this).val; if (val != '') { $('#wpSummaryEnhanced,#wpSummary').val(val); }	});       $label.prepend(' ').prepend($combo).prepend('Summaries: ');	$.ajax({ 'dataType': 'text', 'data': { 'title': 'Template:Stdsummaries', 'action': 'raw', 'ctype': 'text/plain' },		'url': wgScript, 'success': function(data) { var lines = data.split("\n"); for (var i in lines) { var val = (lines[i].indexOf('-- ') == 0) ? lines[i].substring(3) : ''; var text = (lines[i].indexOf('-- ') == 0) ? ' ' + lines[i].substring(3) : lines[i]; var disable = (lines[i].indexOf('-- ') == 0 || lines[i].indexOf('(') == 0) ? '' : 'disabled';				var $opt = '' + text + ' ';				$combo.append($opt);			}		}	}); }) /* ================= * jQuery version of fillPreloads * by Grunny at starwars.wikia.com * ================= */ function fillPreloads {	if( !$( '#lf-preload' ).length ) {		return;	}	var	preloadOptionsHtml = '',		$preloadOptionsList;	$( '#lf-preload' ).attr( 'style', 'display: block' );	$.get( wgScript, { title: 'Template:Stdpreloads', action: 'raw', ctype: 'text/plain' }, function( data ) { var lines = data.split( '\n' ); for( var i = 0; i < lines.length; i++ ) { var value = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : ""; preloadOptionsHtml += '' + lines[i] + ' '; }		$preloadOptionsList = $( ' ' ).attr( 'id', 'stdSummaries' ).html( preloadOptionsHtml ).change( function {			var value = $( this ).val;			if ( value !== '' ) {				value = 'Template:' + value + '/preload';				value = value.replace( ' ', '_' );				$.get( wgScript, { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) { insertAtCursor( document.getElementById( 'wpTextbox1' ), data ); } );			}		} );		$( '#lf-preload-cbox' ).html( $preloadOptionsList ); } );	$( '#lf-preload-pagename' ).html( '' );	$( '#lf-preload-button' ).html( '' ); } function doCustomPreload {	var value = $( '#lf-preload-pagename > input' ).val;	value = value.replace( ' ', '_' );	$.get( wgScript, { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) { insertAtCursor( document.getElementById( 'wpTextbox1' ), data ); } ); }