Hauptmenü öffnen

AntamarWiki β

Änderungen

MediaWiki:Common.js

4.226 Bytes entfernt, 12:39, 30. Mai 2013
Click Event für NavHead hinzugefügt
/* Begin of mw.loader.using callback */
 
/**
* Load scripts specific to Internet Explorer
*/
if ( $jQuery.client.profile().name === 'msie' ) {
importScript( 'MediaWiki:Common.js/IEFixes.js' );
}
var require_wikiminiatlas = false;
var coord_filter = /geohack/;
$jQuery( document ).ready( function() { $jQuery( 'a.external.text' ).each( function( key, link ) {
if ( link.href && coord_filter.exec( link.href ) ) {
require_wikiminiatlas = true;
}
} );
if ( $jQuery( 'div.kmldata' ).length ) {
require_wikiminiatlas = true;
}
} );
} )();
/**
* Collapsible tables ********************************************************* * * Description: Allows tables to be collapsed, showing only the header. See * [[Wikipedia:NavFrame]].click events * Maintainers: [[User:R. Koot]]@author Gaddezwerch
*/
var autoCollapse = 2;var collapseCaption = 'verstecken';var expandCaption = 'anzeigen'; window.collapseTable = function jQuery( tableIndex ) { var Button = document".getElementById( 'collapseButton' + tableIndex NavHead"); var Table = document.getElementById( 'collapsibleTable' + tableIndex ); if ( !Table || !Button ) { return false; } var Rows = Table.rows; var i; if ( Button.firstChild.data === collapseCaption ) { for ( i = 1; i < Rows.length; i++ ) { Rows[i].style.display = 'none'; } Button.firstChild.data = expandCaption; } else { for ( 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 = {}; var Tables = document.getElementsByTagName( 'table' ); var i; function handleButtonLink( index, e ) { window.collapseTable( index ); e.preventDefault(); } for ( i = 0; i < Tables.length; i++ ) { if ( $( Tables[i] ).hasClass( 'collapsible' ) ) { /* only add button and increment count if there is a header row to work with */ var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0]; if ( !HeaderRow ) continue; var Header = HeaderRow.getElementsByTagName( 'th' )[0]; if ( !Header ) continue; NavigationBoxes[ tableIndex ] = Tables[i]; Tables[i].setAttributecss( 'idcursor', 'collapsibleTablepointer' + tableIndex ); var Button = document.createElementjQuery( 'span' ); var ButtonLink = document.createElement( 'a' ); var ButtonText = document.createTextNode( collapseCaption ); Button.className = 'collapseButton'; /* Styles are declared in Common.css */ ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex ); ButtonLink".setAttribute( 'href', '#' ); $( ButtonLink NavHead").on( 'click', $.proxy( handleButtonLink, ButtonLink, tableIndex ) ); ButtonLink.appendChild( ButtonText ); Button.appendChild( document.createTextNodefunction( '[' ) ); Button.appendChild( ButtonLink ); Button.appendChild( document.createTextNode( ']' ) ); Header.insertBefore( Button, Header.firstChild ); tableIndex++; } } for ( i = 0; i < tableIndex; i++ ) { if jQuery( $( NavigationBoxes[i] this).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $parent( NavigationBoxes[i] ).hasClassfind( 'autocollapse' ) ) ) { window.collapseTable( i ); } else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) { var element = NavigationBoxes[i]; while ((element = element.parentNode)) { if ( $( element ).hasClass( 'outercollapseNavContent' ) ) { window.collapseTable toggle( i ); break; } } } }} $( createCollapseButtons );
/**
* Maintainers: UNMAINTAINED
*/
/* set up the words in your language */var NavigationBarHide = '[' + collapseCaption + 'verstecken]';var NavigationBarShow = '[' + expandCaption + 'anzeigen]';
/**
if ( NavToggle.firstChild.data === NavigationBarHide ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $jQuery( NavChild ).hasClass( 'NavContent' ) || $jQuery( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'none';
}
} else if ( NavToggle.firstChild.data === NavigationBarShow ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $jQuery( NavChild ).hasClass( 'NavContent' ) || $jQuery( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'block';
}
for ( var i = 0; (NavFrame = divs[i]); i++ ) {
/* if found a navigation bar */
if ( $jQuery( NavFrame ).hasClass( 'NavFrame' ) ) {
indexNavigationBar++;
NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
NavToggle.setAttribute( 'href', '#' );
$//jQuery( NavToggle ).on( 'click', $jQuery.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
var isCollapsed = $jQuery( NavFrame ).hasClass( 'collapsed' );
/**
* Check if any children are already hidden. This loop is here for backwards compatibility:
*/
for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
if ( $jQuery( NavChild ).hasClass( 'NavPic' ) || $jQuery( NavChild ).hasClass( 'NavContent' ) ) {
if ( NavChild.style.display === 'none' ) {
isCollapsed = true;
if ( isCollapsed ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $jQuery( NavChild ).hasClass( 'NavPic' ) || $jQuery( NavChild ).hasClass( 'NavContent' ) ) {
NavChild.style.display = 'none';
}
/* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
if ( $jQuery( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
NavToggle.style.color = NavFrame.childNodes[j].style.color;
NavFrame.childNodes[j].appendChild( NavToggle );
}
$jQuery( createNavigationBarToggleButton ); /** * Uploadwizard_newusers * Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]] * * Maintainers: [[User:Krimpet]] */function uploadwizard_newusers() { if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'Upload' && mw.config.get( 'wgAction' ) === 'view' ) { var oldDiv = document.getElementById( 'autoconfirmedusers' ), newDiv = document.getElementById( 'newusers' ); if ( oldDiv && newDiv ) { var userGroups = mw.config.get( 'wgUserGroups' ); if ( userGroups ) { for ( var i = 0; i < userGroups.length; i++ ) { if ( userGroups[i] === 'autoconfirmed' ) { oldDiv.style.display = 'block'; newDiv.style.display = 'none'; return; } } } oldDiv.style.display = 'none'; newDiv.style.display = 'block'; return; } }} $(uploadwizard_newusers);
/**
*/
function addEditIntro( name ) {
$jQuery( '.mw-editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) { el.href = $jQuery( this ).attr( 'href' ) + '&editintro=' + name;
} );
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
$jQuery( function () {
if ( document.getElementById( 'disambigbox' ) ) {
addEditIntro( 'Template:Disambig_editintro' );
} );
$jQuery( function () {
var cats = document.getElementById( 'mw-normal-catlinks' );
if ( !cats ) {