Usuario:Savh/botonesdenixon.js

De Wikipedia, la enciclopedia libre

Nota: Después de guardar, debes refrescar la caché de tu navegador para ver los cambios. Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar. Firefox: mientras presionas Mayús pulsas el botón Actualizar, (o presiona Ctrl-Shift-R). Los usuarios de Google Chrome y Safari pueden simplemente pulsar el botón Recargar. Para más detalles e instrucciones acerca de otros exploradores, véase Ayuda:Cómo limpiar la caché.

// Botones desarrollados por Usuario:Nixón, copiados para mi uso propio.
//<nowiki>
var pagina = '';
var mot = '';
var ufb = '';
var txt = '';
var botones = '';
var usuario = '';
var temporal = '';
var sep = "|";
var biblio = false;
var dire = mw.util.wikiScript('index') + '?title=';
var textopruebas = "Página a redirigir:";
var personales = false; //¿Activar config personal?
var pruebas = true; //Pruebas
var vand = true; //Vandalismoi
var infra = true; //Infraesbozo
var sra = true; //Sin relevancia aparente
var promo = true; //Promocional
var cont = true; //Sin contexto
var fp = true; //Fuente primaria
var bulo = true; //Bulo
var ne = true; //No enciclopédico
var catvacia = true; //Categoría vacía
var cattras = true; //Categoría trasladada
var autor = true; //A petición de autor
var usp = true; //Uso indebido de página de usuario
var plagio = true; //Plagio
var redir = true; //Redirección innecesaria
var resub = true; //Resumen de borrado en blanco
var disc = true; //Página de discusión huérfana
var autotrad = true; //Traducción automática
var warnblock = true; //Aviso a usuario bloqueado
var aviso1 = true; //Aviso a usuario 1
var aviso2 = true; //Aviso a usuario 2
var aviso3 = true; //Aviso a usuario 3
var aviso4 = true; //Último aviso a usuario 
var avisoblanqueo = true; //Aviso a usuario blanqueo
var avisospam1 = true; //Aviso a usuario spam 1
var avisospam2 = true; //Aviso a usuario spam 2
var bienvenida = true; //Bienvenida usuario
var comprobarplagio = true; // Comprobar si un artículo es plagio




/* Toma de datos */

for(i = 0; i < mw.config.get('wgUserGroups').length; i++) {
   if(mw.config.get('wgUserGroups')[i] == "autoconfirmed") biblio = true;
}

pagina = encodeURI(mw.config.get('wgPageName'));
if(pagina.match("&")) {
   pagina = pagina.replace("&", "%26");
}
dire = dire + pagina + "&action=";
usuario = pagina.split(":")[1];

tmp = '';
if(resub) {
   tmp += '[<a href=' + dire + 'delete&wpReason=-&speedy=yes>borrar</a>] ';
}
if(vand) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Generales|G1]]: vandalismo") + '&speedy=yes>vand</a>] ';
}
if(pruebas) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Generales|G4]]: pruebas de edición") + '&speedy=yes>prueb</a>] ';
}
if(disc) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Generales|G7]]: página de discusión huérfana") + '&speedy=yes>disc</a>] ';
}
if(redir) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Redirecciones|R3]]: redirección innecesaria") + '&speedy=yes>redir</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(promo) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#G3|Promocional o conflicto de intereses]]") + '&speedy=yes>promo</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(cont) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Art.C3.ADculos|A2]]: [[WP:CX|artículo sin contexto claro]]") + '&speedy=yes>cont</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(infra) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Art.C3.ADculos|A2]]: artículo demasiado reducido") + '&speedy=yes>infra</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(autotrad) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Art.C3.ADculos|A3]]: sin traducir o traducción automática") + '&speedy=yes>autotrad</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(sra) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Art.C3.ADculos|A4]]: [[WP:SRA|sin relevancia enciclopédica]]") + '&speedy=yes>sra</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(fp) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Art.C3.ADculos|A1.3]]: [[WP:FP|fuente primaria]]") + '&speedy=yes>fp</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(bulo) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Generales|G5]]: [[WP:BULO|bulo]]") + '&speedy=yes>bulo</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(ne) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Art.C3.ADculos|A1]]: [[WP:NO|no enciclopédico]]") + '&speedy=yes>no-es</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 0) if(plagio) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#Generales|G6]]: [[WP:DA|violación de los derechos de autor]]") + '&speedy=yes>plagio</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 14) if(catvacia) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#C1|C1]]: categoría vacía") + '&speedy=yes>cat vacía</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 14) if(cattras) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#C2|C2]]: categoría trasladada") + '&speedy=yes>cat trasl</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 2 ||  mw.config.get('wgNamespaceNumber') == 3) if(autor) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#P.C3.A1ginas_de_usuario|U1]]: a petición del autor") + '&speedy=yes>usc</a>] ';
}
if(mw.config.get('wgNamespaceNumber') == 2 || mw.config.get('wgNamespaceNumber') == 3) if(usp) {
   tmp += '[<a href=' + dire + 'delete&wpReason=' + encodeURIComponent("[[WP:BR#P.C3.A1ginas_de_usuario|U3]]: [[WP:PU|uso indebido de página de usuario]]") + '&speedy=yes>pag-u</a>] ';
}

if(tmp != '') {
   botones = botones + 'Borrar: ' + tmp + '<br>';
}

tmp = '';

if(mw.config.get('wgNamespaceNumber') == 3) 
{
	if(warnblock) {
   tmp += '[<a href=' + dire + 'edit&warn=block>Aviso bloqueado</a>] ';
}
	if(aviso1) {
   tmp += '[<a href=' + dire + 'edit&warn=aviso1>Aviso1</a>] ';
}
	if(aviso2) {
   tmp += '[<a href=' + dire + 'edit&warn=aviso2>Aviso2</a>] ';
}
	if(aviso3) {
   tmp += '[<a href=' + dire + 'edit&warn=aviso3>Aviso3</a>] ';
}
	if(aviso4) {
   tmp += '[<a href=' + dire + 'edit&warn=aviso4>Aviso4</a>] ';
}
	if(avisospam1) {
   tmp += '[<a href=' + dire + 'edit&warn=avisospam1>Avisospam1</a>] ';
}
	if(avisospam2) {
   tmp += '[<a href=' + dire + 'edit&warn=avisospam2>Avisospam2</a>] ';
}
	if(bienvenida) {
   tmp += '[<a href=' + dire + 'edit&warn=bienvenida>Bienvenida</a>] ';
}
}

if(mw.config.get('wgNamespaceNumber') == 0) 
{
	if(sra) {
   tmp += '[<a href=' + dire + 'edit&warn=sra>sra</a>] ';
}
	if(promo) {
   tmp += '[<a href=' + dire + 'edit&warn=promo>promo</a>] ';
}
	if(autotrad) {
   tmp += '[<a href=' + dire + 'edit&warn=autotrad>autotrad</a>] ';
}
	if(comprobarplagio)
	tmp += '[<a href="https://copyvios.toolforge.org/?lang=es&project=wikipedia&title=' + pagina  + '&oldid=&action=search&use_engine=1&use_links=1&turnitin=0" target="_blank">** Comprobar Plagio **</a>] ';
}
if(tmp != '') {
   botones = botones + 'Avisos: ' + tmp + '<br>';
}

jQuery( function( $ ) {
	var contentSub= document.getElementById('contentSub');
	if(contentSub && contentSub.innerHTML != '') {
      document.getElementById('contentSub').innerHTML += '<br>';
   }
   	if(contentSub) {

   document.getElementById('contentSub').innerHTML = document.getElementById('contentSub').innerHTML + botones;
   	}
   if(mw.util.getParamValue( 'speedy' ) === "yes") {
      document.getElementById("wpConfirmB").click();
   } else {if(mw.util.getParamValue( 'warn' ) === "block") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:usuario bloqueado}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Aviso: Usuario ha sido bloqueado' + ufb;
      document.editform.wpMinoredit.checked = true;
      document.editform.submit();
   } 
   if(mw.util.getParamValue( 'warn' ) === "aviso1") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:aviso prueba1}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Pruebas de edición' + ufb;
      document.editform.submit();
   }
    if(mw.util.getParamValue( 'warn' ) === "aviso2") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:aviso prueba2}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Vandalismo de páginas' + ufb;
      document.editform.submit();
   }
   if(mw.util.getParamValue( 'warn' ) === "aviso3") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:aviso prueba3}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Vandalismo de páginas' + ufb;
      document.editform.wpMinoredit.checked = true;
      document.editform.submit();
   }
    if(mw.util.getParamValue( 'warn' ) === "aviso4") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:aviso prueba4}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Último aviso' + ufb;
      document.editform.wpMinoredit.checked = true;
      document.editform.submit();
   }
    if(mw.util.getParamValue( 'warn' ) === "bienvenida") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:Bienvenida usuario}} --~~~~' 
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Bienvenida' + ufb;
      document.editform.submit();
   }
    if(mw.util.getParamValue( 'warn' ) === "avisoblanqueo ") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:aviso blanqueo}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Blanqueo de páginas' + ufb;
      document.editform.submit();
   }
     if(mw.util.getParamValue( 'warn' ) === "avisospam1") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:aviso spam1}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Aviso [[WP:EE|spam]]' + ufb;
      document.editform.submit();
   }
     if(mw.util.getParamValue( 'warn' ) === "avisospam2") {
      txt = document.getElementById("wpTextbox1").value;
      txt = txt + '\n{{subst:aviso spam2}} --~~~~'
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Aviso [[WP:EE|spam]]' + ufb;
      document.editform.submit();
   }
   if(mw.util.getParamValue( 'warn' ) === "sra") {
      txt = document.getElementById("wpTextbox1").value;
      txt = '\n{{sin relevancia|{{sust:CURRENTDAY}}|{{sust:CURRENTMONTHNAME}}}}' + txt
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Sin relevancia aparente' + ufb;
      document.editform.wpMinoredit.checked = true;
      document.editform.submit();
   }
   
    if(mw.util.getParamValue( 'warn' ) === "promo") {
      txt = document.getElementById("wpTextbox1").value;
      txt = '\n{{sust:promocional|{{sust:CURRENTDAY}}|{{sust:CURRENTMONTHNAME}}}}' + txt
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Promocional' + ufb;
      document.editform.wpMinoredit.checked = true;
      document.editform.submit();

   }
    if(mw.util.getParamValue( 'warn' ) === "autotrad") {
      txt = document.getElementById("wpTextbox1").value;
      txt = '\n{{autotrad|{{subst:CURRENTDAY}}|{{subst:CURRENTMONTHNAME}}}}' + txt
      document.getElementById("wpTextbox1").value = txt;
      document.editform.wpSummary.value = 'Traducción automática' + ufb;
      document.editform.wpMinoredit.checked = true;
      document.editform.submit();
;

   }
   }

});

//</nowiki>