MediaWiki:Common.js

Por equipe do Dicionário de Favelas Marielle Franco
A versão imprimível não é mais suportada e pode ter erros de renderização. Atualize os favoritos do seu navegador e use a função de impressão padrão do navegador.

Nota: Após publicar, você pode ter que limpar o "cache" do seu navegador para ver as alterações.

  • Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
  • Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
  • Internet Explorer/Edge: PressioneCtrl enquanto clica Recarregar, ou Pressione Ctrl-F5
  • Opera: Pressione Ctrl-F5.
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki
/* Incluir título da seção Referências automático */
$(document).ready(function(){
    $('.mw-references-wrap').before('<h2>Notas e Referências</h2>');
});

/* Sidebar
function ModifySidebar( action, section, name, link ) { try { switch ( section ) { case 'languages': var target = 'p-lang'; break; case 'toolbox': var target = 'p-tb'; break; case 'navigation': var target = 'p-navigation'; break; default: var target = 'p-' + section; break; }

if ( action == 'add' ) { var node = document.getElementById( target ) .getElementsByTagName( 'div' )[0] .getElementsByTagName( 'ul' )[0];

var aNode = document.createElement( 'a' ); var liNode = document.createElement( 'li' );

aNode.appendChild( document.createTextNode( name ) ); aNode.setAttribute( 'href', link ); liNode.appendChild( aNode ); liNode.className = 'plainlinks'; node.appendChild( liNode ); }

if ( action == 'remove' ) { var list = document.getElementById( target ) .getElementsByTagName( 'div' )[0] .getElementsByTagName( 'ul' )[0];

var listelements = list.getElementsByTagName( 'li' );

for ( var i = 0; i < listelements.length; i++ ) { if ( listelements[i].getElementsByTagName( 'a' )[0].innerHTML == name || listelements[i].getElementsByTagName( 'a' )[0].href == link ) { list.removeChild( listelements[i] ); } } }

} catch( e ) { // let's just ignore what's happened return; } }

function CustomizeModificationsOfSidebar() { // adds [[Especial:Árvore_de_categorias|Special:CategoryTree]] to toolbox ModifySidebar( 'add', 'toolbox', 'CategoryTree', '[https://en.wikipedia.org/wiki/Special:CategoryTree' https://en.wikipedia.org/wiki/Special:CategoryTree'] ); // removes [[Especial:Carregar_arquivo|Special:Upload]] from toolbox ModifySidebar( 'remove', 'toolbox', 'Upload file', '[https://en.wikipedia.org/wiki/Special:Upload' https://en.wikipedia.org/wiki/Special:Upload'] ); }

jQuery( CustomizeModificationsOfSidebar )

document.getElementById('p-tb').remove()

*/

/**
 * Hide prefix in category
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Hide_prefix_in_category
 * @rev 2020-04-28
 */
$( function () {
    var prefix = $( '#mw-cat-hideprefix' ).text().trim();
    if ( prefix ) {
        $( '#mw-pages a' ).text( function ( i, val ) {
            return val.slice( 0, prefix.length ) === prefix ? val.slice( prefix.length ) : val;
        } );
    }
} );