User:Victor Lopes/AutoEd/unnamed.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
 //<source lang=javascript>
var AutoEd_baseurl = 'http://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Victor Lopes/AutoEd/';
if (location.protocol === 'https:') {
  AutoEd_baseurl = 'https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Victor Lopes/AutoEd/';
}
 
mw.loader.load(AutoEd_baseurl + 'core4.js'); //Imports the "framework" script needed to make this function

//Sets variable configuration
autoEdTag4 = "translating parameters from PT to EN and fixing other issues using [[WP:AutoEd|AutoEd]] (see [[Help:CS1 errors]])"; //Tweaks edit summary
autoEdLinkName4 = "Fix PT citations"; //Changes the link name at the top of the page
autoEdLinkHover4 = "Run AutoEd to fix unnamed parameter"; //When user hovers over link

//Set up function
function ReplaceUnnamed(str) { //function to replace unnamed and unsupported parameters
 
 //Spanish and Italian and Portuguese and Catalan
  str = str.replace(/(\{\{[Cc]it)ar*( web\s*\|)/g, '$1e$2');
  str = str.replace(/(\{\{[Cc]it)ar*( peri[óo]dico\s*\|)/g, '$1e journal\|');
  str = str.replace(/(\{\{[Cc]it)ar*( v[íi]deo\s*\|)/g, '$1e video\|');
  str = str.replace(/(\{\{[Cc]it)a( jornal\s*\|)/g, '$1e journal\|');
  str = str.replace(/(\{\{[Cc]it)ar*( li[bv]ro\s*\|)/g, '$1e book\|');
  str = str.replace(/(\{\{[Cc]it)a( noticia\s*\|)/g, '$1e news\|');
  str = str.replace(/(\{\{[Cc]it)a( news\s*\|)/g, '$1e news\|');
  str = str.replace(/(\{\{[Cc]it)a( publicaci[óo]n\s*\|)/g, '$1e journal\|');
  str = str.replace(/(\{\{[Cc]it)a( pubblicazione\s*\|)/g, '$1e journal\|');
    str = str.replace(/(\{\{)[Rr]ef-llibre(\s*\|)/g, '$1cite book$2');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*acessadoem\s*=/g, '$1\|access-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ac+essodata\s*=/g, '$1\|access-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*agencia\s*=/g, '$1\|agency=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*altri\s*=/g, '$1\|others=');  
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*annooriginale\s*=/g, '$1\|orig-year=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*a[ñn]+o\s*=/g, '$1\|year=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*any\s*=/g, '$1\|year=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*añoacceso\s*=/g, '$1\|access-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*apellido-editor\s*=/g, '$1\|editor-last=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*apellidos*(\d)\s*=/g, '$1\|last$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*apellidos*\s*=/g, '$1\|last=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*archive url\s*=/g, '$1\|archive-url=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arquivodata\s*=/g, '$1\|archive-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*arquivourl\s*=/g, '$1\|archive-url=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autor(\d)\s*=/g, '$1\|author$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autorlink(\d)*\s*=/g, '$1\|author-link$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autore*\s*=/g, '$1\|author=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*autore(\d)\s*=/g, '$1\|author$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cap[ií]t[ou]lo*\s*=/g, '$1\|chapter=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cita\s*=/g, '$1\|quote=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cita[cç][aã]o\s*=/g, '$1\|quote=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*citazione\s*=/g, '$1\|quote=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*citt[àá]\s*=/g, '$1\|location='); 
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*coautor[eis]+\s*=/g, '$1\|coauthors=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cognom\s*=/g, '$1\|last=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*cognome*(\d)*\s*=/g, '$1\|last$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*col·lecció\s*=/g, '$1\|series=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*consulta\s*=/g, '$1\|access-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*curatore\s*=/g, '$1\|editor=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*data\s*=/g, '$1\|date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*dataarchivio\s*=/g, '$1\|archive-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*[dati\-]*acces+o\s*=/g, '$1\|access-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edició\s*=/g, '$1\|edition=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edición\s*=/g, '$1\|publisher=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edição\s*=/g, '$1\|edition=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*editor[aie]\s*=/g, '$1\|publisher=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*editorial\s*=/g, '$1\|publisher=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*edizione*\s*=/g, '$1\|edition=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*enlaceautor*(\d)\s*=/g, '$1\|author-link$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*enlaceautor\s*=/g, '$1\|author-link=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*enllaçautor\s*=/g, '$1\|author-link=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fecha-publicación\s*=/g, '$1\|publication-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fecha\s*=/g, '$1\|date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fecha+c+es+o\s*=/g, '$1\|access-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*fechaarchivo\s*=/g, '$1\|archive-date=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*formato\s*=/g, '$1\|format=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*giornale\s*=/g, '$1\|journal=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*idioma\s*=/g, '$1\|language=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*jornal\s*=/g, '$1\|journal=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*l[ií]ngua\d*\s*=/g, '$1\|language=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*llengua\s*=/g, '$1\|language=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lloc\d*\s*=/g, '$1\|location=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*local\d*\s*=/g, '$1\|location=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*lugar-publicación\d*\s*=/g, '$1\|location=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*m[êe]se*\s*=/gi, '$1\|month=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*n[uú]mero*\s*=/g, '$1\|issue=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nom[br]*e(\d)\s*=/g, '$1\|first$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nom[br]*e\s*=/g, '$1\|first=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*nombre-editor\s*=/g, '$1\|editor-first=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*o[bep]+ra\s*=/g, '$1\|work=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*otros\s*=/g, '$1\|others=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p[áa]gina\s*=/g, '$1\|page=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p[áa]ginas\s*=/g, '$1\|pages=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*p[áaà]gines*\s*=/g, '$1\|pages=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*peri[óo]dico\s*=/g, '$1\|journal=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*primei*ro(\d)*\s*=/g, '$1\|first$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*pub+lica[cz]i[óo]ne*\s*=/g, '$1\|journal=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publicação\s*=/g, '$1\|publisher=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publicació\s*=/g, '$1\|work=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*publicado\s*=/g, '$1\|publisher=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*registo\s*=/g, '$1\|registration=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*rivista\s*=/g, '$1\|work=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*seri[ae]*\s*=/g, '$1\|series=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sitioweb\s*=/g, '$1\|website=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*sito\s*=/g, '$1\|website=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*suscripción\s*=/g, '$1\|subscription=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tempo*\s*=/g, '$1\|time=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tipo*\s*=/g, '$1\|type=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*tit[uo]lo\s*=/g, '$1\| title=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*títol\s*=/g, '$1\|title=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*título\s*=/g, '$1\|title=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*trabalho\s*=/g, '$1\|work=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*traduttore\s*=/g, '$1\|translator=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*ubicación\s*=/g, '$1\|location=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*[úu]ltimo(\d)*\s*=/g, '$1\|last$2=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*urlarchivi*o\s*=/g, '$1\|archive-url=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*urlmorta\s*=/g, '$1\|url-status=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*volumen\s*=/g, '$1\|volume=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\|\s*wkautore\s*=/g, '$1\|author-link=');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*janeiro\s*de/g, '$1January');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*fevereiro\s*de/g, '$1February');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*março\s*de/g, '$1March');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*abril\s*de/g, '$1April');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*maio\s*de/g, '$1May');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*junho\s*de/g, '$1June');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*julho\s*de/g, '$1July');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*agosto\s*de/g, '$1August');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*setembro\s*de/g, '$1September');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*outubro\s*de/g, '$1October');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*novembro\s*de/g, '$1November');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))de\s*dezembro\s*de/g, '$1December');
  str = str.replace(/({{\s*[cC]it[ea](?:[^}{]*(?:\{\{[^}{]*}}[^}{]*)*))\[\[G1\]\]/g, '$1[[G1 (website)|G1]]');
  
    return str;
}
 
function autoEdFunctions4() { //Activates individual modules when "auto ed" tab is clicked
    var txt = document.editform.wpTextbox1;
    txt.value = ReplaceUnnamed(txt.value);
//    txt.value = autoEdWhitespace(txt.value);
}
  
 //</source>