Saltar para o conteúdo

Usuário:Rjclaudio/teste.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)
  • Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5.
if ( wgAction == "edit" || wgAction == "submit" ) addOnloadHook ( init_linkfixr ) ;

function init_linkfixr () {
  var tools = document.getElementById("p-tb") ;

// Mantida
  var out = '<li id="t-permalink">' ;
  var ot = document.editform.wpTextbox1.value ;
  var t = retira_apagar2 ( ot ) ;

  if ( t != ot ) {
    out += "<a href='javascript:pe_mantida();'>Mantida</a>" ;
  } else {
    out += "<span style='color:#888888'>Mantida</span>" ;
  }

  tools = tools.getElementsByTagName("ul")[0] ;
  tools.innerHTML += out ;

}

function retira_apagar2 ( ot ) {
  t = ot;
  t = t.replace(/\{\{[Aa]pagar2\|[^\{\}\n]+\}\}/, '') ;

  return t ;
}

function pe_mantida () {
  var ot = document.editform.wpTextbox1.value ;
  var t = retira_apagar2 ( ot ) ;
  if ( t != ot ) {
    document.editform.wpTextbox1.value = t ;
    var s = document.editform.wpSummary.value ;
    if ( s != "" ) s += "; " ;
    s += "PE encerrada: mantida" ;
    document.editform.wpSummary.value = s ;
    document.editform.submit();
  }
}