MediaWiki:Gadget-refbuttons.js: diferenças entre revisões

Origem: Wikipédia, a enciclopédia livre.
Conteúdo apagado Conteúdo adicionado
m moveu Wikipédia:Software/Scripts/refToolbar.js para MediaWiki:Gadget-refbuttons.js: pedido do usuário:Helder.wiki: http://pt.wikipedia.org/w/index.php?diff=25306753&oldid=25266002 (ver http://pt.wikipedia.org/w/index.php?ol...
PedR (discussão | contribs)
Com o https:// funcionando em todas as wikis, desnecessário o http://. A pedido do Helder.wiki
Linha 7: Linha 7:
button.title = "Inserir referência";
button.title = "Inserir referência";
buttonimage = document.createElement('img');
buttonimage = document.createElement('img');
buttonimage.src = "http://upload.wikimedia.org/wikipedia/commons/e/ea/Button_easy_cite.png";
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/e/ea/Button_easy_cite.png";
buttonimage.alt = "Inserir referência";
buttonimage.alt = "Inserir referência";
button.appendChild(buttonimage);
button.appendChild(buttonimage);
Linha 379: Linha 379:
if (allrefscontent[i] == allrefscontent[p] && i != p) {
if (allrefscontent[i] == allrefscontent[p] && i != p) {
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';
errorlist[q] += '<td width="25%">Múltiplas referências deste conteúdo <a href="http://pt.wikipedia.org/wiki/Wikipedia:Livro de estilo/Notas de rodapé">devem ser usadas uma vez</a></td></tr>';
errorlist[q] += '<td width="25%">Múltiplas referências deste conteúdo <a href="//pt.wikipedia.org/wiki/Wikipedia:Livro de estilo/Notas de rodapé">devem ser usadas uma vez</a></td></tr>';
q++;
q++;
samecontentexclude[sx] = allrefscontent[i]
samecontentexclude[sx] = allrefscontent[i]
Linha 397: Linha 397:
if (!skipcheck) {
if (!skipcheck) {
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
errorlist[q] += '<td width="25%">Não usa uma <a href="http://pt.wikipedia.org/wiki/Categoria:!Predefinições para referências">predefinição de referência</a></td></tr>';
errorlist[q] += '<td width="25%">Não usa uma <a href="//pt.wikipedia.org/wiki/Categoria:!Predefinições para referências">predefinição de referência</a></td></tr>';
q++;
q++;
templateexclude[tx] = allrefscontent[i];
templateexclude[tx] = allrefscontent[i];
Linha 418: Linha 418:
if (namedrefs[k] == namedrefs[z] && k != z) {
if (namedrefs[k] == namedrefs[z] && k != z) {
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';
errorlist[q] += '<td width="25%">Múltiplas referências são dados os mesmos <a href="http://pt.wikipedia.org/wiki/Wikipedia:Livro de estilo/Notas de rodapé">nome</a></td></tr>';
errorlist[q] += '<td width="25%">Múltiplas referências são dados os mesmos <a href="//pt.wikipedia.org/wiki/Wikipedia:Livro de estilo/Notas de rodapé">nome</a></td></tr>';
q++;
q++;
repeatnameexclude[rx] = namedrefs[z];
repeatnameexclude[rx] = namedrefs[z];
Linha 441: Linha 441:
if (!NRcallError(namedrefs, namedrefcalls[p])) {
if (!NRcallError(namedrefs, namedrefcalls[p])) {
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';
errorlist[q] += '<td width="25%">Uma <a href="http://pt.wikipedia.org/wiki/Wikipedia:Livro_de_estilo/Notas de rodapé#Múltiplas utilizações da mesma nota de rodapé">Referência repetida</a> é usada mas não definida</td></tr>';
errorlist[q] += '<td width="25%">Uma <a href="//pt.wikipedia.org/wiki/Wikipedia:Livro_de_estilo/Notas de rodapé#Múltiplas utilizações da mesma nota de rodapé">Referência repetida</a> é usada mas não definida</td></tr>';
q++;
q++;
undefexclude[ux] = namedrefs[p];
undefexclude[ux] = namedrefs[p];
Linha 464: Linha 464:
'<input type="checkbox" id="unclosed" /> Tags de referências abertas <tt>(&lt;ref&gt;)</tt>.<br/>'+
'<input type="checkbox" id="unclosed" /> Tags de referências abertas <tt>(&lt;ref&gt;)</tt>.<br/>'+
'<input type="checkbox" id="samecontent" /> Referências com o mesmo conteúdo.<br/>'+
'<input type="checkbox" id="samecontent" /> Referências com o mesmo conteúdo.<br/>'+
'<input type="checkbox" id="templates" /> Referências que não usam uma <a href="http://pt.wikipedia.org/wiki/Categoria:!Predefinições para referências">predefinição de referência.</a><br/>'+
'<input type="checkbox" id="templates" /> Referências que não usam uma <a href="//pt.wikipedia.org/wiki/Categoria:!Predefinições para referências">predefinição de referência.</a><br/>'+
'<input type="checkbox" id="repeated" /> Múltiplas referências com o mesmo nome.<br/>'+
'<input type="checkbox" id="repeated" /> Múltiplas referências com o mesmo nome.<br/>'+
'<input type="checkbox" id="undef" /> Uso de referências com nomes indefinidos.<br/>'+
'<input type="checkbox" id="undef" /> Uso de referências com nomes indefinidos.<br/>'+

Revisão das 02h47min de 9 de outubro de 2011

var numforms = 0;
var wikEdAutoUpdateUrl;
function refbuttons() {
  if (mwCustomEditButtons && document.getElementById('toolbar') && wikEdAutoUpdateUrl == null) {
    button = document.createElement('a');
    button.href = "javascript:easyCiteMain()";
    button.title = "Inserir referência";
    buttonimage = document.createElement('img');
    buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/e/ea/Button_easy_cite.png";
    buttonimage.alt = "Inserir referência";
    button.appendChild(buttonimage);
    document.getElementById('toolbar').appendChild(button);
    if (navigator.userAgent.indexOf('MSIE') == -1) {
      citemain = document.createElement('div');
      citemain.style.display = 'none';
      citemain.setAttribute('Id', 'citeselect');
      citemain.appendChild( addOption("citeWeb()", "Web") );
      citemain.appendChild( addOption("citeNews()", "Notícia") );
      citemain.appendChild( addOption("citeBook()", "Livro") );
      citemain.appendChild( addOption("citeJournal()", "Jornal") );
      citemain.appendChild( addOption("citeNamedRef()", "Múltiplas referências") );
      citemain.appendChild( addOption("dispErrors()", "Verificar erros") );
      citemain.appendChild( addOption("hideInitial()", "Cancelar") );
      document.getElementById('wpTextbox1').parentNode.insertBefore(citemain, document.getElementById('wpTextbox1'));
    }
    else {
    selection = '<div id="citeselect" style="display:none"><input type="button" value="Web" onclick="citeWeb()" />'+
      '<input type="button" value="Notícia" onclick="citeNews()" />'+
      '<input type="button" value="Livro" onclick="citeBook()" />'+
      '<input type="button" value="Jornal" onclick="citeJournal()" />'+
      '<input type="button" value="Múltiplas referêrncias" onclick="citeNamedRef()" />'+
      '<input type="button" value="Verificar erros" onclick="dispErrors()" />'+
      '<input type="button" value="Cancelar" onclick="hideInitial()" /></div>';
    document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;
    }
  }
}

function addOption(script, text) {
  option = document.createElement('input');
  option.setAttribute('type', 'button');
  option.setAttribute('onclick', script);
  option.setAttribute("value", text);
  return option;
}

function hideInitial() {
  document.getElementById('citeselect').style.display = 'none';
  oldFormHide();
}

function oldFormHide() {
  if (numforms != 0) {
    document.getElementById('citediv'+numforms).style.display = 'none';
  }
  if (document.getElementById('errorform') != null) {
    document.getElementById('citeselect').removeChild(document.getElementById('errorform'));
  }
} 

function easyCiteMain() {
  document.getElementById('citeselect').style.display = '';
}

function getTime() {
  var time = new Date();
  var nowdate = time.getUTCDate();
  if (nowdate<10) { nowdate = "0"+ nowdate.toString(); }
  var nowmonth = time.getUTCMonth()+1;
  if (nowmonth<10) { nowmonth = "0"+ nowmonth.toString(); }
  var nowyear = time.getUTCFullYear();
  newtime =  nowdate + '/' + nowmonth + '/' + nowyear;
  return (newtime);
}

function citeWeb() {
  citeNewsWeb("citar web");
}
function citeNews() {
  citeNewsWeb("citar notícia");
}

function citeNewsWeb(templatename) {
  oldFormHide();
  template = templatename;
  var legend;
  if (template == "citar web") {
    legend = "Citar fonte da web";
  } else {
    legend = "Citar fonte de notícia";
  }
  newtime = getTime();
  numforms++;
  form = '<div id="citediv'+numforms+'">'+
    '<fieldset><legend>'+legend+'</legend>'+
    '<table cellspacing="5">'+
    '<input type="hidden" value="'+template+'" id="template">'+
    '<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="url"></td>'+
    '<td width="120"><label for="titulo">&nbsp;Título: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="titulo"></td></tr>'+
    '<tr><td width="120"><label for="ultimo">&nbsp;Último nome: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="ultimo"></td>'+
    '<td width="120"><label for="primeiro">&nbsp;Primeiro nome: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="primeiro"></td></tr>'+
    '<tr><td width="120"><label for="coautores">&nbsp;Co-autores: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="coautores"></td>'+
    '<td width="120"><label for="data">&nbsp;Data da publicação: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="data"></td></tr>'+
    '<tr><td width="120"><label for="obra">&nbsp;Obra: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="obra"></td>'+
    '<td width="120"><label for="publicado">&nbsp;Editora: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="publicado"></td></tr>'+
    '<tr><td width="120"><label for="formato">&nbsp;Formato: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="formato"></td>'+
    '<td width="120"><label for="lingua">&nbsp;Idioma: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="lingua"></td></tr>'+
    '<tr><td width="120"><label for="acessodata">&nbsp;Data de acesso: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="acessodata" value="'+ newtime +'"></td>'+
    '<td width="120"><label for="refname">&nbsp;Nome da referência: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="refname"></td></tr>'+
    '</table>'+
    '<input type="button" value="Adicionar fonte" onClick="addcites()">'+
 '</fieldset></div>';
   document.getElementById('citeselect').innerHTML += form;
}

function citeBook() {
  oldFormHide();
  template = "Ref-livro";
  numforms++;
  form = '<div id="citediv'+numforms+'">'+
    '<fieldset><legend>Citar fonte de livro</legend>'+
    '<table cellspacing="5">'+
    '<input type="hidden" value="'+template+'" id="template">'+
    '<tr><td width="120"><label for="sobrenome">&nbsp;Sobrenome: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="sobrenome"></td>'+
    '<td width="120"><label for="nome">&nbsp;Nome: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="nome"></td></tr>'+
    '<tr><td width="120"><label for="coautores">&nbsp;Co-autores: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="coautores"></td>'+
    '<td width="120"><label for="outros">&nbsp;Outros: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="outros"></td></tr>'+
    '<tr><td width="120"><label for="título">&nbsp;Título: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="título"></td>'+
    '<td width="120"><label for="editor">&nbsp;Editora: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="editor"></td></tr>'+
    '<tr><td width="120"><label for="edição">&nbsp;Edição: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="edição"></td>'+
    '<td width="120"><label for="local">&nbsp;Local: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="local"></td></tr>'+
    '<tr><td width="120"><label for="publicação">&nbsp;Data da publicação: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="publicação"></td>'+
    '<td width="120"><label for="páginas">&nbsp;Página(s): </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="páginas"></td></tr>'+
    '<tr><td width="120"><label for="capítulo">&nbsp;Capítulo: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="capítulo"></td>'+
    '<td width="120"><label for="URLcapítulo">&nbsp;URL do capítulo: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="URLcapítulo"></td></tr>'+
    '<tr><td width="120"><label for="URL">&nbsp;URL: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="URL"></td>'+
    '<td width="120"><label for="acessodata">&nbsp;Data de acesso: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="acessodata"></td></tr>'+
    '<tr><td width="120"><label for="id">&nbsp;ISBN: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="id"></td>'+
    '<td width="120"><label for="cita">&nbsp;Cita: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="cita"></td></tr>'+
    '<tr><td width="120"><label for="linkautor">&nbsp;Link da autor: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="linkautor"></td>'+
    '<td width="120"><label for="accessdate">&nbsp;Data de acesso: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="accessdate"></td></tr>'+
    '<td width="120"><label for="refname">&nbsp;Nome da referência: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="refname"></td></tr>'+
    '</table>'+
    '<input type="button" value="Adicionar fonte" onClick="addcites()">'+
 '</fieldset></div>';
   document.getElementById('citeselect').innerHTML += form;
}

function citeJournal() {
  oldFormHide();
  template = "Citar jornal";
  numforms++;
  form = '<div id="citediv'+numforms+'">'+
    '<fieldset><legend>Citar fonte de jornal</legend>'+
    '<table cellspacing="5">'+
    '<input type="hidden" value="'+template+'" id="template">'+
    '<tr><td width="120"><label for="ultimo">&nbsp;Último nome: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="ultimo"></td>'+
    '<td width="120"><label for="primeiro">&nbsp;Primeiro nome: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="primeiro"></td></tr>'+
    '<tr><td width="120"><label for="coautores">&nbsp;Co-autores: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="coautores"></td>'+
    '<td width="120"><label for="data">&nbsp;Data da publicação: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="data"></td></tr>'+
    '<tr><td width="120"><label for="titulo">&nbsp;Título: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="titulo"></td>'+
    '<td width="120"><label for="jornal">&nbsp;Jornal: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="jornal"></td></tr>'+
    '<tr><td width="120"><label for="editora">&nbsp;Editora: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="editora"></td>'+
    '<td width="120"><label for="local">&nbsp;Local: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="local"></td></tr>'+
    '<tr><td width="120"><label for="volume">&nbsp;Volume: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="volume"></td>'+
    '<td width="120"><label for="formato">&nbsp;Formato: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="formato"></td></tr>'+
    '<tr><td width="120"><label for="paginas">&nbsp;Páginas: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="paginas"></td>'+
    '<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="issn"></td></tr>'+
    '<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="oclc"></td>'+
    '<td width="120"><label for="idioma">&nbsp;Idioma: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="idioma"></td></tr>'+
    '<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="url"></td>'+
    '<td width="120"><label for="accessadoem">&nbsp;Data de acesso: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="accessadoem"></td></tr>'+
    '<tr><td width="120"><label for="refname">&nbsp;Nome da referência: </label></td>'+
              '<td width="400"><input type="text" style="width:100%" id="refname"></td></tr>'+
    '</table>'+
    '<input type="button" value="Adicionar fonte" onClick="addcites()">'+
 '</fieldset></div>';
   document.getElementById('citeselect').innerHTML += form;
}

function addcites(template) {
  cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');
  var citebegin = '<ref';
  var citename = '';
  var citeinner = '';
  for (var i=0; i<cites.length-1; i++) {
    if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id != "template") {
      citeinner += "|" + cites[i].id + "=" + cites[i].value;
    }
    else if (cites[i].value != '' && cites[i].id == "refname" && cites[i].id != "template") {
      citebegin += ' name="' + cites[i].value + '"';
    }
    else if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id == "template") {
      citename = '>{{' + cites[i].value;
    }
  }
  cite = citebegin + citename + citeinner + "}}</ref>";
  insertTags(cite, '', '');
  document.getElementById('citediv'+numforms).style.display = 'none';
} 

function getNamedRefs(calls) {
  text = document.getElementById('wpTextbox1').value;
  var regex;
  if (calls) {
    regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^/]\b)) *?\/ *?>/gi //'
  } else {
    regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^/]\b)) *?>/gi //'
  }
  var namedrefs = new Array();
  var i=0;
  var nr=true;
  do {
    ref = regex.exec(text);
    if(ref != null){
      if (ref[5]) {
        namedrefs[i] = ref[5];
      } else if (ref[3]) {
        namedrefs[i] = ref[3];
      } else {
        namedrefs[i] = ref[6];
      }
      i++;
    } else {
      nr=false;
    }
  } while (nr==true);
  return namedrefs;
}

function citeNamedRef() {
  namedrefs = getNamedRefs(false);
  if (namedrefs == '') {
    oldFormHide();
    numforms++;
    out = '<div id="citediv'+numforms+'"><fieldset>'+
      '<legend>Por favor, selecione uma referência a repetir no texto:</legend>Não há múltiplas referências no texto (<tt>&lt;ref name="Nome"&gt;</tt>).</fieldset></div>';
    document.getElementById('citeselect').innerHTML += out;
  }
  else {
    oldFormHide();
    numforms++;
    form = '<div id="citediv'+numforms+'">'+
      '<fieldset><legend>Referências no artigo</legend>'+
      '<table cellspacing="5">'+
      '<tr><td><label for="namedrefs">&nbsp;Nomes das referências no texto</label></td>'+
            '<td><select name="namedrefs" id="namedrefs">';
    for (var i=0;i<namedrefs.length;i++) {
      form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';
    }
    form+= '</select>'+
      '</td></tr></table>'+
      '<input type="button" value="Adicionar fonte" onClick="addnamedcite()">'+
      '</fieldset></div>';
     document.getElementById('citeselect').innerHTML += form;
  }
}

function addnamedcite() {
  name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;
  ref = '<ref name="'+name+'" />';
  insertTags(ref, '', '');
  document.getElementById('citediv'+numforms).style.display = 'none';  
}

function getAllRefs() {
  text = document.getElementById('wpTextbox1').value;
  regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"
  var allrefs = new Array();
  var i=0;
  var nr=true;
  do {
    ref = regex.exec(text);
    if(ref != null){
      if (ref[0].search(/[^\s]{150}/) != -1) {
        ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");
      }
      ref[0] = ref[0].replace(/</g, "&lt;");
      ref[0] = ref[0].replace(/>/g, "&gt;");
      allrefs[i] = ref[0];
      i++;
    } else {
      nr=false;
    }
  } while (nr==true);
  return allrefs;
}

function NRcallError(namedrefs, refname) {
  for (var i=0; i<namedrefs.length; i++) {
    if (namedrefs[i] == refname) {
      return true;
    }
  }
  return false;
}

function errorCheck() {
  var allrefs = getAllRefs();
  var allrefscontent = new Array();
  var samecontentexclude = new Array();
  var sx=0;
  var templateexclude = new Array();
  var tx=0;
  var skipcheck = false;
  var namedrefcalls = getNamedRefs(true);
  for (var i=0; i<allrefs.length; i++) {
    allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8");  //"
  }
  var namedrefs = getNamedRefs(false);
  var errorlist = new Array();
  var q=0;
  unclosed = document.getElementById('unclosed').checked;
  samecontent = document.getElementById('samecontent').checked;
  templates = document.getElementById('templates').checked;
  repeated = document.getElementById('repeated').checked;
  undef = document.getElementById('undef').checked;
  for (var i=0; i<allrefs.length; i++) {
    if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) { 
      errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
      errorlist[q] += '<td width="25%">Unclosed <tt>&lt;ref&gt;</tt> tag</td></tr>';
      q++;
    }
    if (samecontent) {
      for (var d=0; d<samecontentexclude.length; d++) {
        if (allrefscontent[i] == samecontentexclude[d]) {
          skipcheck = true;
        }
      }
      var p=0;
      while (p<allrefs.length && !skipcheck) {
        if (allrefscontent[i] == allrefscontent[p] && i != p) {
          errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';
          errorlist[q] += '<td width="25%">Múltiplas referências deste conteúdo <a href="//pt.wikipedia.org/wiki/Wikipedia:Livro de estilo/Notas de rodapé">devem ser usadas uma vez</a></td></tr>';
          q++;
          samecontentexclude[sx] = allrefscontent[i]
          sx++;
          break;
        }
        p++;
      }
     skipcheck=false;
    }
    if (allrefscontent[i].search(/{{cite/i) == -1 && allrefscontent[i].search(/{{citation/i) == -1 && allrefscontent[i].search(/{{Comic (book|strip) reference/i) == -1 && allrefscontent[i].search(/{{Editorial cartoon reference/i) == -1 && allrefscontent[i].search(/{{harv/i) == -1 && templates) {
      for (var x=0; x<templateexclude.length; x++) {
        if (allrefscontent[i] == templateexclude[x]) {
          skipcheck = true;
        }
      }
      if (!skipcheck) {
        errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
        errorlist[q] += '<td width="25%">Não usa uma <a href="//pt.wikipedia.org/wiki/Categoria:!Predefinições para referências">predefinição de referência</a></td></tr>';
        q++;
        templateexclude[tx] = allrefscontent[i];
        tx++;
      }
      skipcheck = false;
    }
  }
  if (repeated) {
    var repeatnameexclude = new Array();
    var rx=0;
    for (var k=0; k<namedrefs.length; k++) {
      for (var d=0; d<repeatnameexclude.length; d++) {
        if (namedrefs[k] == repeatnameexclude[d]) {
          skipcheck = true;
        }
      }
      var z=0;
      while (z<namedrefs.length && !skipcheck) {
        if (namedrefs[k] == namedrefs[z] && k != z) {
          errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';
          errorlist[q] += '<td width="25%">Múltiplas referências são dados os mesmos <a href="//pt.wikipedia.org/wiki/Wikipedia:Livro de estilo/Notas de rodapé">nome</a></td></tr>';
          q++;
          repeatnameexclude[rx] = namedrefs[z];
          rx++;
          break;
        }
        z++;
      }
     skipcheck = false;
    }
  }
  if (undef) {
    var undefexclude = new Array();
    var ux=0;
    for (var p=0; p<namedrefcalls.length; p++) {
      for (var d=0; d<undefexclude.length; d++) {
        if (allrefscontent[i] == undefexclude[d]) {
          skipcheck = true;
        }
      }
      if (!skipcheck) {
        if (!NRcallError(namedrefs, namedrefcalls[p])) {
          errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';
          errorlist[q] += '<td width="25%">Uma <a href="//pt.wikipedia.org/wiki/Wikipedia:Livro_de_estilo/Notas de rodapé#Múltiplas utilizações da mesma nota de rodapé">Referência repetida</a> é usada mas não definida</td></tr>';
          q++;
          undefexclude[ux] = namedrefs[p];
          ux++;
        }
      }
      skipcheck = false;
    }
 }
  if (q > 0) {
    return errorlist;
  } else {
    return 0;
  }
}

function dispErrors() {
  oldFormHide();
  form = '<div id="errorform"><fieldset>'+
    '<legend>Verificar erros</legend>'+
    '<b>Procurar por:</b><br/>'+
    '<input type="checkbox" id="unclosed" /> Tags de referências abertas <tt>(&lt;ref&gt;)</tt>.<br/>'+
    '<input type="checkbox" id="samecontent" /> Referências com o mesmo conteúdo.<br/>'+
    '<input type="checkbox" id="templates" /> Referências que não usam uma <a href="//pt.wikipedia.org/wiki/Categoria:!Predefinições para referências">predefinição de referência.</a><br/>'+
    '<input type="checkbox" id="repeated" /> Múltiplas referências com o mesmo nome.<br/>'+
    '<input type="checkbox" id="undef" /> Uso de referências com nomes indefinidos.<br/>'+
    '<input type="button" id="errorchecksubmit" value="Verificar" onclick="doErrorCheck()"/>'+
    '</fieldset></div>';
  document.getElementById('citeselect').innerHTML += form;
}

function doErrorCheck() {
  var errors = errorCheck();
  document.getElementById('citeselect').removeChild(document.getElementById('errorform'));
  if (errors == 0) {
    if (numforms != 0) {
      document.getElementById('citediv'+numforms).style.display = 'none';
    }
    numforms++;
    out = '<div id="citediv'+numforms+'"><fieldset>'+
      '<legend>Verificação de erros</legend>Nenhum erro encontrado!</fieldset></div>';
    document.getElementById('citeselect').innerHTML += out;
  }
  else {
    if (numforms != 0) {
      document.getElementById('citediv'+numforms).style.display = 'none';
    }
    numforms++;
    form = '<div id="citediv'+numforms+'">'+
      '<fieldset><legend>Verificação de erros</legend>'+
      '<table border="1px">';
    for (var i=0; i<errors.length; i++) {
      form+=errors[i];
    }
    form+= '</table>'+
      '</fieldset></div>';
     document.getElementById('citeselect').innerHTML += form;
  }
}

hookEvent("load", refbuttons);