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

798 bytes removidos ,  23h45min de 11 de fevereiro de 2014
sem resumo de edição
(+ alteração, a pedido de User:Helder.wiki em [https://pt.wikipedia.org/w/index.php?diff=prev&oldid=38133530])
/* Código Javascript colocado aqui será carregado para todos os utilizadores em cada carregamento de página */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit' , 'submit'] ) !== -1 ) {
var load_edittools = true;
{
importScript( 'MediaWiki:Edittools.js' );
var load_edittools = true;
importScript( 'MediaWiki:EdittoolsExtrabo.js' );
importScript( 'MediaWiki:ExtraboForcepreview.js' );
} else if ( mw.config.get( 'wgPageName' ) == 'Especial:Busca' ) {
importScript( 'MediaWiki:Forcepreview.js' )
importScript( 'MediaWiki:Search.js' );
}
} else if ( navigator.appName == 'Microsoft Internet Explorer' ) {
 
importScript( 'MediaWiki:IEFixes.js' );
else if ( mw.config.get( 'wgPageName' ) == 'Especial:Busca' )
} else if ( $.inArray( mw.config.get( 'wgRestrictionEdit' ), [ 'autoconfirmed' , 'sysop' ] ) !== -1 ) {
{
importScript( 'MediaWiki:SearchTopicon.js' );
}
 
else if ( navigator.appName == 'Microsoft Internet Explorer' )
{
importScript( 'MediaWiki:IEFixes.js' )
}
 
else if( $.inArray( mw.config.get( 'wgRestrictionEdit' ), ['autoconfirmed' , 'sysop' ] ) !== -1 )
{
importScript( 'MediaWiki:Topicon.js' )
}
 
* Correlatos no menu lateral. Código copiado do de:wikt
*/
mw.util.addCSS( '#interProject, #sisterProjects {display: none; speak: none;} #p-tb .pBody {padding-right: 0;}' );
function iProject() {
if ( document.getElementById( 'interProject' ) ) {
var iProject = document.getElementById( 'interProject' ).innerHTML;
var interProject = document.createElement( 'div' );
interProject.style.marginTop = '0.7em';
interProject.innerHTML = '<h5>Correlatos<\/h5><div class="pBody">'+iProject+'<\/div>';
document.getElementById( 'p-tb' ).appendChild( interProject );
}
}
$( iProject );
 
* Adiciona um link direto para carregamentos no Commons
*/
//*
//function linkUploadToCommons() {
if ( document.getElementById( 'carrega-para-commons' ) ){
//{
return;
// if ( document.getElementById( 'carrega-para-commons' ) ) return;
}
// var li_carrega = document.getElementById( 't-upload' );
var li_carrega = document.getElementById( 't-upload' );
// if ( !li_carrega ) return;
if ( !li_carrega ) {
// var afegit = li_carrega.nextSibling;
return;
// var ul_eines = li_carrega.parentNode;
}
// var li = document.createElement( 'li' );
var afegit = li_carrega.nextSibling;
// li.id = 'carrega-para-commons';
var ul_eines = li_carrega.parentNode;
// li.innerHTML = '<a href="http://commons.wikimedia.org/wiki/Commons:Upload/pt">Carregar no Commons</a>';
var li = document.createElement( 'li' );
// if ( afegit ) ul_eines.insertBefore( li, afegit );
li.id = 'carrega-para-commons';
// else ul_eines.appendChild( li );
li.innerHTML = '<a href="//commons.wikimedia.org/wiki/Commons:Upload/pt">Carregar no Commons</a>';
//}
if ( afegit ) {
//
ul_eines.insertBefore( li, afegit );
//$( linkUploadToCommons );
} else {
ul_eines.appendChild( li );
}
}
 
$( linkUploadToCommons );
*/
 
// ============================================================
 
if ( !window.aOnloadFunctions ) {
var aOnloadFunctions = [];
}
 
window.onload = function() {
if ( window.aOnloadFunctions ) {
for ( var _i=0; _i<aOnloadFunctions.length; _i++ ) {
aOnloadFunctions[_i]();
}
}
}
}
 
// ============================================================
 
function addLoadEvent( func ) {
if ( window.addEventListener ) {
{
window.addEventListener( 'load', func, false );
if ( window.addEventListener )
} else if ( window.addEventListener(attachEvent 'load',) func, false );{
else if ( window.attachEvent( 'onload', func );
}
window.attachEvent( 'onload', func );
}
 
// 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 NavToggleNavFrame = document.getElementById( 'NavToggleNavFrame' + indexNavigationBar );
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
 
if ( !NavFrame || !NavToggle ) {
return false;
}
}
 
// if shown now
if ( NavToggle.firstChild.data == NavigationBarHide ) {
for (
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 (
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;
}
}
}
 
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
{
// iterate over all < div >-elements
var indexNavigationBar = 0;
for(
// iterate over all < div >-elements
var i=0;
for(
NavFrame = document.getElementsByTagName( 'div' )[i];
var i=0;
i++
NavFrame = document.getElementsByTagName( 'div' )[i];
) {
i++
// if found a navigation bar
) {
if ( NavFrame.className == 'NavFrame' ) {
// if found a navigation bar
if ( NavFrame.className == 'NavFrame' ) {
 
indexNavigationBar++;
var NavToggle = document.createElement( 'a' );
NavToggle.className = 'NavToggle';
NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
NavToggle.setAttribute( 'href', 'javascript:toggleNavigationBar(' + 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++
j++
) {
) {
if ( NavFrame.childNodes[j].className == 'NavHead' ) {
NavFrame.childNodes[j].appendChild( NavToggle );
}
}
}
}
NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
}
}
}
}
// if more Navigation Bars found than Default: hide all
if ( NavigationBarShowDefault < indexNavigationBar ) {
for(
var i=1;
i<=indexNavigationBar;
i++
i++
) {
toggleNavigationBar( i );
}
}
}
}
 
}
 
if ( mw.config.get( 'wgPageName' ) == 'Portal:Futebol' ) {
NavigationBarShowDefault = 50;
}
 
 
function TransformeEmPaginaDeDiscussao() {
if( document.getElementById( 'PaginaDeDiscussao' ) ) {
document.body.className = 'ns-talk';
}
}
$( TransformeEmPaginaDeDiscussao );
*/
 
rewritePageH1 = function() {
try {
var realTitleBanner = document.getElementById( 'RealTitleBanner' );
if ( realTitleBanner ) {
if ( !document.getElementById( 'DisableRealTitle' ) ) {
var realTitle = document.getElementById( 'RealTitle' );
var h1 = document.getElementsByTagName( 'h1' )[0];
if ( realTitle && h1 ) {
h1.innerHTML = realTitle.innerHTML;
realTitleBanner.style.display = 'none';
}
}
}
}
}
}
}
}
catch ( e ) {
/* Algo deu errado. */
}
}
}
$( rewritePageH1 );
599

edições