Diferenças entre edições de "MediaWiki:Common.js"

Saltar para a navegação Saltar para a pesquisa
466 bytes adicionados ,  13h18min de 15 de fevereiro de 2014
+ alteração, a pedido de User:Helder.wiki em https://pt.wikipedia.org/w/index.php?diff=38147232&oldid=38133530
(+ alteração, a pedido de User:Helder.wiki em https://pt.wikipedia.org/w/index.php?diff=38147232&oldid=38133530)
/* Código Javascript colocado aqui será carregado para todos os utilizadores em cada carregamento de página */
/*global $, jQuery, mw, importScript */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit' , 'submit'] ) !== -1 ) {
var window.load_edittools = true;
importScript( 'MediaWiki:Edittools.js' );
importScript( 'MediaWiki:Extrabo.js' );
}
 
/** Correlatos
* Adiciona links para os projetos correlatos no menu lateral, a partir da [[Predefinição:Correlatos]].
* Correlatos
* TODO: Remover quando o [[bugzilla:708]] for resolvido
*
* @author: [[:de:wikt:User:Melancholie]]
* Correlatos no menu lateral. Código copiado do de:wikt
* @source: [[:de:wikt:MediaWiki:Common.js/Archiv 2008-04-28]] ([[de:wikt:Special:PermaLink/217901]])
*/
mw.util.addCSS( '#interProject, #sisterProjects {display: none; speak: none;} #p-tb .pBody {padding-right: 0;}' );
function iProject() {
var iProjectHtml, interProject;
if ( document.getElementById( 'interProject' ) ) {
var iProjectiProjectHtml = document.getElementById( 'interProject' ).innerHTML;
var interProject = document.createElement( 'div' );
interProject.style.marginTop = '0.7em';
interProject.innerHTML = '<h5>Correlatos<\/h5><div class="pBody">'+iProjectiProjectHtml+'<\/div>';
document.getElementById( 'p-tb' ).appendChild( interProject );
}
}
}
$( iProject );
 
 
if ( !window.aOnloadFunctions ) {
varmw.log.deprecate( window, 'aOnloadFunctions =', [], 'Use jQuery em vez disso' );
}
 
windowmw.onloadlog.deprecate( =window, 'onload', function() {
if ( window.aOnloadFunctions ) {
for ( var _i=0; _i<window.aOnloadFunctions.length; _i++ ) {
window.aOnloadFunctions[_i]();
}
}
}, 'Use jQuery em vez disso' );
}
 
// END Enable multiple onload functions
// ============================================================
 
functionmw.log.deprecate( window, 'addLoadEvent', function ( func ) {
if ( window.addEventListener ) {
window.addEventListener( 'load', func, false );
window.attachEvent( 'onload', func );
}
}, 'Use jQuery em vez disso' );
}
 
/* Barras de navegação */
 
/**
* Dynamic Navigation Bars (experimental)
* Barras de navegação dinâmica
*
* Description: See [[Wikipedia:NavFrame]].
* Origem: [[:it:MediaWiki:Common.js]]
* Maintainers: UNMAINTAINED
* @source: [[w:en:MediaWiki:Common.js]]
*/
 
//* set up the words in your language */
var NavigationBarHide = ' [ocultar]';
var NavigationBarShow = ' [exibir]';
 
/**
// set up max count of Navigation Bars on page,
* Shows and hides content and picture (if available) of navigation bars
// if there are more, all will be hidden
* Parameters:
// NavigationBarShowDefault = 0; // all bars will be hidden
* indexNavigationBar: the index of navigation bar to be toggled
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
**/
var NavigationBarShowDefault = 0;
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
 
// shows and hides content and picture (if available) of navigation bars
// Parameters:
// indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar( indexNavigationBar ) {
var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
var NavChild;
 
if ( !NavFrame || !NavToggle ) {
}
 
//* if shown now */
if ( NavToggle.firstChild.data === NavigationBarHide ) {
for ( NavChild = NavFrame.firstChild; NavChild !== null; NavChild = NavChild.nextSibling ) {
for (
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if ( NavChild.className == 'NavPic' ) {
NavChild.style.display = 'none';
}
if ( NavChild.className == 'NavContent' ) {
NavChild.style.display = 'none';
}
NavToggle.firstChild.data = NavigationBarShow;
 
/ /* if hidden now */
} else if ( NavToggle.firstChild.data === NavigationBarShow ) {
for ( NavChild = NavFrame.firstChild; NavChild !== null; NavChild = NavChild.nextSibling ) {
for (
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if ( NavChild.className == 'NavPic' ) {
NavChild.style.display = 'block';
}
if ( NavChild.className == 'NavContent' ) {
NavChild.style.display = 'block';
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
 
event.preventDefault();
// adds show/hide-button to navigation bars
};
 
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
var NavFrame;
// iterate over all < div >-elements
/* iterate over all < div >-elements */
for(
var divs = document.getElementsByTagName( 'div' );
var i=0;
for( var i = 0; (NavFrame = divs[i]); i++ ) {
NavFrame = document.getElementsByTagName( 'div' )[i];
/* if found a navigation bar */
i++
if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
) {
// if found a navigation bar
if ( NavFrame.className == 'NavFrame' ) {
 
indexNavigationBar++;
NavToggle.className = 'NavToggle';
NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
NavToggle.setAttribute( 'href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');#' );
$( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
 
var NavToggleText = document.createTextNode( NavigationBarHide );
NavToggle.appendChild( NavToggleText );
/ /* 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++ ) {
for(
if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
var j=0;
j < NavToggle.style.color = NavFrame.childNodes[j].style.lengthcolor;
j++
) {
if ( NavFrame.childNodes[j].className == 'NavHead' ) {
NavFrame.childNodes[j].appendChild( NavToggle );
}
}
}
// if more Navigation Bars found than Default: hide all
if ( NavigationBarShowDefault < indexNavigationBar ) {
for(
var i=1;
i<=indexNavigationBar;
i++
) {
toggleNavigationBar( i );
}
}
 
}
 
$mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
 
// Language selector
importScript( 'MediaWiki:Ticker.js' );
importScript( 'MediaWiki:PageCSS.js' );
 
if ( mw.config.get( 'wgPageName' ) == 'Portal:Futebol' ) {
NavigationBarShowDefault = 50;
}
 
/**
$( TransformeEmPaginaDeDiscussao );
 
/**
/** Altera o título da página
* Altera o título da página
*
* A função procura por um banner como:
** <div id="RealTitleBanner">Div que está oculta
* Origem: [[:w:en:MediaWiki:Common.js]]
** <nowiki><divspan id="RealTitleBannerRealTitle">Div that isNovo hiddentítulo</nowikispan>
** </div>
* <nowiki><span id="RealTitle">title</span></nowiki>
* Um elemento com id=DisableRealTitle desabilita a função
* <nowiki></div></nowiki>
* @source: [[w:MediaWiki:Gadget-TitleRewrite.js]] ([[w:Special:PermaLink/33988491]])
* An element with id=DisableRealTitle disables the function.
* @source: [[:en:MediaWiki:Common.js]] ([[en:Special:PermaLink/95609539]]) / [[:en:User:Interiot/js/RealTitle.js]]
* @see: [[:en:MediaWiki talk:Common.js/Archive 2#Initial letter is shown capitalized due to technical restrictions]]
* @see: [[:en:Wikipedia:Village pump (technical)/Archive AC#Name technical restrictions workaround]]
* @author: [[:en:User:Interiot]]
* @author: [[User:!Silent]]
*/
( function( $ ) {
'use strict';
 
function rewritePageTitle() {
rewritePageH1 = function() {
var $realTitle,
try {
var $realTitleBanner = document.getElementById$( '#RealTitleBanner' );
 
if ( realTitleBanner ) {
if ( !document$realTitleBanner.getElementByIdlength !== 0 && !$( '#DisableRealTitle' ).length ) {
var $realTitle = document.getElementById$( '#RealTitle' );
 
var h1 = document.getElementsByTagName( 'h1' )[0];
if ( $realTitle && h1.length ) {
$( 'h1:first' ).innerHTML =html( $realTitle.innerHTMLhtml() );
$realTitleBanner.style.display = 'none'hide();
}
}
}
}
catch ( e ) {
/* Algo deu errado. */
}
}
 
$( rewritePageH1 );
$( rewritePageTitle );
 
}( jQuery ) );
599

edições

Menu de navegação