Usuário:Cósmico/correções.js

Origem: Wikipédia, a enciclopédia livre.

Nota: Depois de publicar, poderá ter de contornar a 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: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
  • Opera: Pressione Ctrl-F5.
if ( $.inArray(mw.config.get('wgAction'), ['edit' , 'submit' ]) !== -1) $( init_linkfixr ) ;

function init_linkfixr () {
  var tools = document.getElementById("p-tb") ;
  var out = '<li id="t-permalink">' ;

  var ot = document.editform.wpTextbox1.value ;
  var t = get_linkfixr_text ( ot ) ;
  if ( t != ot ) {
    out += "<a href='javascript:run_linkfixr();'>Correções</a>" ;
  } else {
    out += "<span style='color:#888888'>Correções</span>" ;
  }
  tools = tools.getElementsByTagName("ul")[0] ;
  tools.innerHTML += out ;
}

function get_linkfixr_text ( ot ) {
  var t = ot ;

  var ct ;
  do {
    ct = t ;

    t = t.split('\(in German\)').join('(em [[língua alemã|alemão]])') ;
    t = t.split('{{Info álbum').join('{{Info/Álbum') ;
    t = t.split('{{Info/Asteróide').join('{{Info/Asteroide') ;
    t = t.split('{{Info artista musical').join('{{Info/música/artista') ;
    t = t.split('{{Info astronauta').join('{{Info/Astronauta') ;
    t = t.split('{{Info medalhista').join('{{Info/esporte/atleta') ;
    t = t.replace(/\{\{Infobox (ator|actor)/, '{{Info/Ator') ;
    t = t.split('{{Infobox automóvel').join('{{Info/Automóvel') ;
    t = t.split('{{Info Avião Civil').join('{{Info/Avião civil') ;
    t = t.split('{{Info Avião').join('{{Info/Avião Militar') ;
    t = t.split('{{InfoBairroUdia').join('{{Info/Bairro do Brasil 4') ;
    t = t.split('{{DadosBatalha').join('{{Info/Batalha') ;
    t = t.split('{{Info banda').join('{{Info/Banda') ;
    t = t.split('{{Info biografia').join('{{Info/Biografia') ;
    t = t.split('{{Info bio adulto').join('{{Info/Bio adulto') ;
    t = t.split('{{Info canção').join('{{Info/Canção') ;
    t = t.split('{{Campeonato de Futebol').join('{{Info/Campeonato de futebol') ;
    t = t.split('{{Infobox Cidade').join('{{Info/Cidade') ;
    t = t.split('{{Alemanha/cidades').join('{{Info/Cidade da Alemanha') ;
    t = t.split('{{Áustria/cidades').join('{{Info/Cidade da Áustria') ;
    t = t.split('{{Info cientista').join('{{Info/Cientista') ;
    t = t.split('{{DadosClubeFutebol').join('{{Info/Clube de futebol') ;
    t = t.split('{{Polónia/Comuna').join('{{Info/Comuna da Polónia') ;
    t = t.split('{{Info companhia aérea').join('{{Info/Companhia aérea') ;
    t = t.split('{{Polónia/Condado').join('{{Info/Condado da Polónia') ;
    t = t.split('{{Infobox Country Olympics').join('{{Info/Country Olympics') ;
    t = t.split('{{Diocese').join('{{Info/Diocese') ;
    t = t.split('{{Infobox Emissora de rádio').join('{{Info/Emissora de rádio') ;
    t = t.split('{{Infobox Emissora').join('{{Info/Emissora de televisão') ;
    t = t.split('{{Info Empresa').join('{{Info/Empresa') ;
    t = t.split('{{Estado extinto').join('{{Info/Estado extinto') ;
    t = t.split('{{Info Estação').join('{{Info/Estação') ;
    t = t.split('{{Cinema/Ficha Técnica Ampliada').join('{{Info/Filme') ;
    t = t.split('{{Cinema/Ficha Técnica').join('{{Info/Filme') ;
    t = t.split('{{Info furacão').join('{{Info/Furacão') ;
    t = t.split('{{Infobox guerra').join('{{Info/Guerra') ;
    t = t.split('{{Info jogo').join('{{Info/Jogo') ;
    t = t.split('{{Info língua').join('{{Info/Língua') ;
    t = t.split('{{Info livro').join('{{Info/Livro') ;
    t = t.split('{{DadosMunicípioPortugal').join('{{Info/Município de Portugal') ;
    t = t.split('{{DadosMicrorregiãoBrasil').join('{{Info/Microrregião') ;
    t = t.split('{{F1drive').join('{{Info/Motorista da F1') ;
    t = t.split('{{Info navio').join('{{Info/navio') ;
    t = t.split('{{Infobox Nome').join('{{Info/Nome') ;
    t = t.split('{{Infobox Participação Anual na ESC').join('{{Info/Participação anual no ESC') ;
    t = t.split('{{Infobox Monarca').join('{{Info/Monarca') ;
    t = t.split('{{Info/Doença').join('{{Info/Patologia') ;
    t = t.split('{{Património Mundial').join('{{Info/Património Mundial') ;
    t = t.split('{{Pintura').join('{{Info/Pintura') ;
    t = t.split('{{Político').join('{{Info/Político') ;
    t = t.split('{{Infobox Rede de televisão').join('{{Info/Rede de televisão') ;
    t = t.replace(/\{\{[Rr]ef-section/, '{{Referências') ;
    t = t.split('{{Infobox serie de TV').join('{{Info/Série de televisão') ;
    t = t.split('{{Info single').join('{{Info/Single') ;
    t = t.split('{{Super-Herói').join('{{Info/Super-Herói') ;
    t = t.split('{{Taxocaixa').join('{{Info/Taxonomia') ;
    t = t.split('{{Info Televisão').join('{{Info/Televisão') ;
    t = t.split('{{DadosUniversidadesBrasil').join('{{Info/Universidade do Brasil') ;
    t = t.split('{{Infobox Wrestler').join('{{Info/Wrestler') ;

    t = t.replace(/([0-9]) janeiro/, '$1 de janeiro') ;
    t = t.replace(/([0-9]) fevereiro/, '$1 de fevereiro') ;
    t = t.replace(/([0-9]) março/, '$1 de março') ;
    t = t.replace(/([0-9]) abril/, '$1 de abril') ;
    t = t.replace(/([0-9]) maio/, '$1 de maio') ;
    t = t.replace(/([0-9]) junho/, '$1 de junho') ;
    t = t.replace(/([0-9]) julho/, '$1 de julho') ;
    t = t.replace(/([0-9]) agosto/, '$1 de agosto') ;
    t = t.replace(/([0-9]) setembro/, '$1 de setembro') ;
    t = t.replace(/([0-9]) outubro/, '$1 de outubro') ;
    t = t.replace(/([0-9]) novembro/, '$1 de novembro') ;
    t = t.replace(/([0-9]) dezembro/, '$1 de dezembro') ;

    t = t.replace(/janeiro ([0-9])/, 'janeiro de $1') ;
    t = t.replace(/fevereiro ([0-9])/, 'fevereiro de $1') ;
    t = t.replace(/março ([0-9])/, 'março de $1') ;
    t = t.replace(/abril ([0-9])/, 'abril de $1') ;
    t = t.replace(/maio ([0-9])/, 'maio de $1') ;
    t = t.replace(/junho ([0-9])/, 'junho de $1') ;
    t = t.replace(/julho ([0-9])/, 'julho de $1') ;
    t = t.replace(/agosto ([0-9])/, 'agosto de $1') ;
    t = t.replace(/setembro ([0-9])/, 'setembro de $1') ;
    t = t.replace(/outubro ([0-9])/, 'outubro de $1') ;
    t = t.replace(/novembro ([0-9])/, 'novembro de $1') ;
    t = t.replace(/dezembro ([0-9])/, 'dezembro de $1') ;

    t = t.replace(/== (V|v)er (T|t)ambém ==/, '== {{Ver também}} ==') ;
    t = t.replace(/==(V|v)er (T|t)ambém==/, '== {{Ver também}} ==') ;
    t = t.split('=={{Ver Também}}==').join('== {{Ver também}} ==') ;

    t = t.replace(/\{\{Desambiguação\}\}\n\*/, "{{Desambiguação}}\n\n'''{{PAGENAME}}''' pode se referir a:\n*") ;
    t = t.replace(/\{\{Desambiguação\}\}\n\n\*/, "{{Desambiguação}}\n\n'''{{PAGENAME}}''' pode se referir a:\n*") ;
    t = t.replace(/== Ligações (E|e)xternas ==/, '== {{Ligações externas}} ==') ;
    t = t.replace(/==Ligações (E|e)xternas==/, '== {{Ligações externas}} ==') ;
    t = t.replace(/== {{Ligações (E|e)xternas}} ==/, '== {{Ligações externas}} ==') ;
    t = t.replace(/=={{Ligações (E|e)xternas}}==/, '== {{Ligações externas}} ==') ;
    t = t.split('==Links==').join('== {{Ligações externas}} ==') ;
    t = t.split('=={{Links}}==').join('== {{Ligações externas}} ==') ;
    t = t.split('==Links Externos==').join('== {{Ligações externas}} ==') ;

    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ãáâäàåäą]([^\}]*\}\})/, '$1a$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ÁÀÂÄĂǍĀÃÅĄÆǢΆÂ]([^\}]*\}\})/, '$1A$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ĆĊĈČÇ]([^\}]*\}\})/, '$1C$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ċĉčç]([^\}]*\}\})/, '$1c$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[éèêëě]([^\}]*\}\})/, '$1e$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ÉÊÈË]([^\}]*\}\})/, '$1E$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[íïìîï]([^\}]*\}\})/, '$1i$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ÍÌÎÏ]([^\}]*\}\})/, '$1I$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[óöøõôō]([^\}]*\}\})/, '$1o$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ÓÒÔÔÕØ]([^\}]*\}\})/, '$1O$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[úùûü]([^\}]*\}\})/, '$1u$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ÚÙÛÜ]([^\}]*\}\})/, '$1U$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[çćč]([^\}]*\}\})/, '$1c$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ÇČ]([^\}]*\}\})/, '$1C$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ď]([^\}]*\}\})/, '$1d$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[Ď]([^\}]*\}\})/, '$1D$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)ł([^\}]*\}\})/, '$1l$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ñńň]([^\}]*\}\})/, '$1n$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ÑŇ]([^\}]*\}\})/, '$1N$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ř]([^\}]*\}\})/, '$1r$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[Ř]([^\}]*\}\})/, '$1R$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[šśş]([^\}]*\}\})/, '$1s$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ŠŞ]([^\}]*\}\})/, '$1S$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ťţ]([^\}]*\}\})/, '$1t$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[Ť]([^\}]*\}\})/, '$1T$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[žż]([^\}]*\}\})/, '$1z$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[Ž]([^\}]*\}\})/, '$1Z$2') ;
    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)æ([^\}]*\}\})/, '$1ae$2') ;
    t = t.replace(/(\{\{ *DEFAULTSORT *\:[^\}]*)[ªº"]([^\}]*\}\})/, '$1$2') ;

    t = t.replace(/(\{\{DEFAULTSORT *\:[^\}]*)[ß]([^\}]*\}\})/, '$1S$2') ;

    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?a(.*}})/, '{{DEFAULTSORT:$1A$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?b(.*}})/, '{{DEFAULTSORT:$1B$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?c(.*}})/, '{{DEFAULTSORT:$1C$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?d(.*}})/, '{{DEFAULTSORT:$1D$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?e(.*}})/, '{{DEFAULTSORT:$1E$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?f(.*}})/, '{{DEFAULTSORT:$1F$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?g(.*}})/, '{{DEFAULTSORT:$1G$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?h(.*}})/, '{{DEFAULTSORT:$1H$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?i(.*}})/, '{{DEFAULTSORT:$1I$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?j(.*}})/, '{{DEFAULTSORT:$1J$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?k(.*}})/, '{{DEFAULTSORT:$1K$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?l(.*}})/, '{{DEFAULTSORT:$1L$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?m(.*}})/, '{{DEFAULTSORT:$1M$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?n(.*}})/, '{{DEFAULTSORT:$1N$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?o(.*}})/, '{{DEFAULTSORT:$1O$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?p(.*}})/, '{{DEFAULTSORT:$1P$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?q(.*}})/, '{{DEFAULTSORT:$1Q$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?r(.*}})/, '{{DEFAULTSORT:$1R$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?s(.*}})/, '{{DEFAULTSORT:$1S$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?t(.*}})/, '{{DEFAULTSORT:$1T$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?u(.*}})/, '{{DEFAULTSORT:$1U$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?v(.*}})/, '{{DEFAULTSORT:$1V$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?w(.*}})/, '{{DEFAULTSORT:$1W$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?x(.*}})/, '{{DEFAULTSORT:$1X$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?y(.*}})/, '{{DEFAULTSORT:$1Y$2') ;
    t = t.replace(/{{DEFAULTSORT\:(.+[ \-\(\/])?z(.*}})/, '{{DEFAULTSORT:$1Z$2') ;

    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])A(.*)}}/, '{{DEFAULTSORT:$1a$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])B(.*)}}/, '{{DEFAULTSORT:$1b$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])C(.*)}}/, '{{DEFAULTSORT:$1c$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])D(.*)}}/, '{{DEFAULTSORT:$1d$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])E(.*)}}/, '{{DEFAULTSORT:$1e$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])F(.*)}}/, '{{DEFAULTSORT:$1f$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])G(.*)}}/, '{{DEFAULTSORT:$1g$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])H(.*)}}/, '{{DEFAULTSORT:$1h$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])I(.*)}}/, '{{DEFAULTSORT:$1i$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])J(.*)}}/, '{{DEFAULTSORT:$1j$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])K(.*)}}/, '{{DEFAULTSORT:$1k$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])L(.*)}}/, '{{DEFAULTSORT:$1l$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])M(.*)}}/, '{{DEFAULTSORT:$1m$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])N(.*)}}/, '{{DEFAULTSORT:$1n$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])O(.*)}}/, '{{DEFAULTSORT:$1o$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])P(.*)}}/, '{{DEFAULTSORT:$1p$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])Q(.*)}}/, '{{DEFAULTSORT:$1q$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])R(.*)}}/, '{{DEFAULTSORT:$1r$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])S(.*)}}/, '{{DEFAULTSORT:$1s$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])T(.*)}}/, '{{DEFAULTSORT:$1t$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])U(.*)}}/, '{{DEFAULTSORT:$1u$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])V(.*)}}/, '{{DEFAULTSORT:$1v$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])W(.*)}}/, '{{DEFAULTSORT:$1w$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])X(.*)}}/, '{{DEFAULTSORT:$1x$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])Y(.*)}}/, '{{DEFAULTSORT:$1y$2}}') ;
    t = t.replace(/{{DEFAULTSORT\:(.*[^ \-\(\/])Z(.*)}}/, '{{DEFAULTSORT:$1z$2}}') ;

    t = t.replace(/&ndash;/, '–') ;
    t = t.replace(/&mdash;/, '—') ;
    t = t.replace(/ – /, ' — ') ;

    t = t.replace(/\[\[Categoria: /, '[[Categoria:') ;
    t = t.split('DEFAULTSORT: ').join('DEFAULTSORT:') ;
    t = t.replace(/\[\[(C|c)ategory:/, '[[Categoria:') ;
    t = t.replace(/\[\[categoria:/, '[[Categoria:') ;
    t = t.split('[[ Categoria:').join('[[Categoria:') ;

    t = t.replace(/\[\[Categoria:a/, '[[Categoria:A') ;
    t = t.replace(/\[\[Categoria:b/, '[[Categoria:B') ;
    t = t.replace(/\[\[Categoria:c/, '[[Categoria:C') ;
    t = t.replace(/\[\[Categoria:d/, '[[Categoria:D') ;
    t = t.replace(/\[\[Categoria:e/, '[[Categoria:E') ;
    t = t.replace(/\[\[Categoria:f/, '[[Categoria:F') ;
    t = t.replace(/\[\[Categoria:g/, '[[Categoria:G') ;
    t = t.replace(/\[\[Categoria:h/, '[[Categoria:H') ;
    t = t.replace(/\[\[Categoria:i/, '[[Categoria:I') ;
    t = t.replace(/\[\[Categoria:j/, '[[Categoria:J') ;
    t = t.replace(/\[\[Categoria:k/, '[[Categoria:K') ;
    t = t.replace(/\[\[Categoria:l/, '[[Categoria:L') ;
    t = t.replace(/\[\[Categoria:m/, '[[Categoria:M') ;
    t = t.replace(/\[\[Categoria:n/, '[[Categoria:N') ;
    t = t.replace(/\[\[Categoria:o/, '[[Categoria:O') ;
    t = t.replace(/\[\[Categoria:p/, '[[Categoria:P') ;
    t = t.replace(/\[\[Categoria:q/, '[[Categoria:Q') ;
    t = t.replace(/\[\[Categoria:r/, '[[Categoria:R') ;
    t = t.replace(/\[\[Categoria:s/, '[[Categoria:S') ;
    t = t.replace(/\[\[Categoria:t/, '[[Categoria:T') ;
    t = t.replace(/\[\[Categoria:u/, '[[Categoria:U') ;
    t = t.replace(/\[\[Categoria:v/, '[[Categoria:V') ;
    t = t.replace(/\[\[Categoria:w/, '[[Categoria:W') ;
    t = t.replace(/\[\[Categoria:x/, '[[Categoria:X') ;
    t = t.replace(/\[\[Categoria:y/, '[[Categoria:Y') ;
    t = t.replace(/\[\[Categoria:z/, '[[Categoria:Z') ;

    t = t.replace(/=='/, '==') ;
    t = t.replace(/== '/, '== ') ;
    t = t.replace(/'=/, '=') ;
    t = t.replace(/' =/, '= ') ;

    t = t.split(':==').join('==') ;
    t = t.split(': ==').join(' ==') ;

    t = t.split('{{DEFAULTSORT:}}').join('') ;
    t = t.split('[[Categoria:]]').join('') ;
    t = t.split('[[Título da ligação]]').join('') ;
    t = t.split('[[Ficheiro:Exemplo.jpg]]').join('') ;
    t = t.split('[[Ficheiro:]]').join('') ;
    t = t.split('<small><small>').join('<small>') ;
    t = t.split('</small></small>').join('</small>') ;
    t = t.split('<small></small>').join('') ;

//    t = t.replace(/\{\{(CURRENTYEAR|CURRENTMONTHNAME|CURRENTMONTHDAY|PAGENAME)\}\}/, '{{subst:$1}}') ;
//    t = t.replace(/(\<ref.*\<\/ref\>)(\,|\.|\;)/, '$2$1') ;

    t = t.split('[[Imagem:').join('[[Ficheiro:') ;
    t = t.split('[[Image:').join('[[Ficheiro:') ;
    t = t.split('[[File:').join('[[Ficheiro:') ;
    t = t.split('{{Subst:').join('{{subst:') ;
    t = t.split('{{Predefinição:').join('{{') ;
    t = t.split('<sup>1</sup>').join('¹') ;
    t = t.split('<sup>2</sup>').join('²') ;
    t = t.split('&sup2;').join('²') ;
    t = t.split('{{CURRENTYEAR').join('{{subst:CURRENTYEAR') ;
    t = t.split('{{CURRENTMONTHNAME').join('{{subst:CURRENTMONTHNAME') ;
    t = t.replace(/\{\{PAGENAME/, '{{subst:PAGENAME') ;
    t = t.split('\n\n\n').join('\n\n') ;
    t = t.split('\}\}\{\{').join('}}\n{{') ;
    t = t.split('[["').join('"[[') ;
    t = t.split('"]]').join(']]"') ;
    t = t.split("[['").join("'[[") ;
    t = t.split("']]").join("]]'") ;
    t = t.split(',]]').join(']],') ;
    t = t.split(':]]').join(']]:') ;
    t = t.split(';]]').join(']];') ;
    t = t.replace(/\[\[ /, '[[') ;
    t = t.replace(/ \]\]/, ']]') ;
    t = t.replace(/ \n/, '\n') ;
    t = t.replace(/\<br\>\n\|/, '<br />') ;
    t = t.replace(/\<br\/\>\n\|/, '\n\|') ;
    t = t.replace(/\<br\/\>\n \|/, '\n \|') ;
    t = t.replace(/\<br \/\>\n\|/, '\n\|') ;
    t = t.replace(/\<br \/\>\n \|/, '\n \|') ;
    t = t.replace(/\<br \/\>\n\n/, '\n\n') ;


  } while ( ct != t ) ;

  return t ;
}

function run_linkfixr () {
  var ot = document.editform.wpTextbox1.value ;
  var t = get_linkfixr_text ( ot ) ;
  if ( t != ot ) {
    document.editform.wpTextbox1.value = t ;
    var s = document.editform.wpSummary.value ;
    if ( s != "" ) s += "; " ;
    s += "ajustes usando [[Usuário:LuizM/correções.js|correções.js]]" ;
    document.editform.wpSummary.value = s ;
  }
}