Jump to content

User:Macy/FastButtons.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Macy (talk | contribs) at 17:56, 15 June 2008 (adding sysop functions). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
//FastButtons, based on the original work of Racso from Spanish Wikipedia,
//translated by Macy.

//<pre>
var pagina =''; var mot=''; var txt=''; var botones=''; var usuario=''; var temporal='';
var sep="|"; var biblio=false;
var ufb = ', using [[User:Macys123/FastButtons|FastButtons]]';
var dire="http://en.wikipedia.org/w/index.php?title=";
var fin_otro="edit&borrar=otro-";
var fin_aviso="edit&aviso=";
var vec="http://en.wikipedia.org/w/index.php?title=Wikipedia:Administrator_intervention_against_vandalism&action=edit&section=1&motivoVEC=";
var textopruebas="Warn user:\n1|(article): Level 1\n2|(article): Level 2\n3|(article): Level 3\n4|(article): Level 4\n4im|(article): Level 4im";
var FBpersonales = false; //Personal configuration
var FBpruebas= true;	//Test edits
var FBblanco = true;	//Vandalism
var FBne = true;	//Nonsense pages
var FBinfra = true;	//Attack pages
var FBautopromo = true;	//Globalize/USA
var FBotro = true;	//Globalize (custom)
var FBwikify = true;    //Wikify
var FBunref = true;	//Unreferenced
var FBcleanup = true;	//Cleanup
var FBnpov = true;	//POV
var FBborrar = false;	//Speedy delete (test)
var FBvec = true;	//Report to AIV
var FBprotect = true;	//Mark page as protected
var FBaviso = true;	//Warn user
 
/* Toma de datos */
 
for (i=0; i<wgUserGroups.length; i++)
   {  if (wgUserGroups[i] == "sysop") biblio=true; }
 
pagina=encodeURI(wgPageName);
if (pagina.match("&"))
{
pagina=pagina.replace("&","%26");
}
dire=dire+pagina+"&action=";
usuario=pagina.split(":")[1];
 
 
if (pagina=="Especial:Contributions")
{usuario=location.href.substring(location.href.indexOf('Contributions/')+14,location.href.length);}
 
//</pre>
 
//<pre>
 
/* Inicio */
 
 if (biblio)
{
tmp='';
 
	if (FBborrar){tmp+= '[<a href='+dire+'delete&rapido=si>speedy delete!</a>] '; }
	if (FBprotect){tmp+= '[<a href='+dire+'edit&protected=yes>pp-vand (full)</a>] '; }
	if (FBprotect){tmp+= '[<a href='+dire+'edit&protected=semi>pp-vand (semi)</a>] '; }
 
if (tmp!=''){botones = botones + 'Sysop buttons: ' +tmp+'<br>';}
}
 
{
	tmp='';
 
	if (FBpruebas){tmp+= '[<a href='+dire+'edit&borrar=pruebas>test</a>] '; }
 	if (FBblanco){tmp+= '[<a href='+dire+'edit&borrar=blanco>vandalism</a>] '; }
	if (FBne){tmp+= '[<a href='+dire+'edit&borrar=NE>nonsense</a>] '; }
	if (FBinfra){tmp+= '[<a href='+dire+'edit&borrar=infra>attack</a>] '; }
 	if (FBautopromo){tmp+= '[<a href='+dire+'edit&borrar=autopromo>globalize (USA)</a>] '; }
	if (FBotro){tmp+= '[<a onclick="mot=prompt(/Please enter country/);location.href=dire + fin_otro +encodeURI(mot) ;"> globalize (custom) </a>] ';}
 
	if (tmp!='') { botones= botones + 'CSD/Tags: ' + tmp + '<br>';}
 
}
 
 
tmp='';
 
if (FBwikify){tmp+= '[<a href='+dire+'edit&plant=wikify>wikify</a>] '; }
if (FBunref){tmp+= '[<a href='+dire+'edit&plant=unref>unreferenced</a>] '; } 
if (FBcleanup){tmp+= '[<a href='+dire+'edit&plant=cleanup>cleanup</a>] '; }
if (FBnpov){tmp+= '[<a href='+dire+'edit&plant=npov>POV</a>] '; }
 
if (tmp!=''){botones = botones + 'Maintenance templates: ' +tmp+'<br>';}
 
 
tmp='';
 
if (FBaviso){tmp+='[<a onclick="mot=prompt(textopruebas);location.href=dire + fin_aviso +encodeURI(mot) ;">Warn user</a>] ';}
 
//if (biblio==true)
//{if (FBvec){tmp+= '[<a onclick=";mot=prompt(/Motivo/);location.href=vec + usuario + sep + mot;">AIV report</a>] ';}}

//if (biblio==true)
//{if (FBuaa){tmp+= '[<a onclick=";mot=prompt(/Motivo/);location.href=vec + usuario + sep + mot;">UAA report</a>] ';}}
 
if (tmp!=''){botones = botones + 'Special: ' +tmp+'<br>';}
 
 
/* Botones funcionando */
 
addOnloadHook(function ()
{
 
if (document.getElementById('contentSub').innerHTML!='')
{document.getElementById('contentSub').innerHTML+='<br>';}
 
document.getElementById('contentSub').innerHTML = document.getElementById('contentSub').innerHTML+ botones;
 
 
if (location.href.match("borrar=blanco")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if (txt.match("{destruir")==null)
	{
		txt= '{{db-test}}\n' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Requesting speedy deletion G2'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=pruebas")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{db-vandalism}}\n' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Requesting speedy deletion G3'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=NE")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{db-nonsense}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Requesting speedy deletion G1'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=infra")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{db-attack}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Requesting speedy deletion G10'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=autopromo"))
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{globalize/USA}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Tagged with {{globalize/USA}}'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("borrar=otro")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		mot=location.href.substring(location.href.indexOf('otro-')+5, location.href.length)
		if (mot!=null)
		{
			txt='{{globalize|'+decodeURI(mot)+'}}\n'+txt;
			document.getElementById ("wpTextbox1").value=txt;
			document.editform.wpSummary.value = 'Quick {{globalize|+decodeURI(mot)'+ufb;
	 		document.editform.submit();
		}
	}
} 

else if (location.href.match("protected=yes")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{pp-vandalism}}\n' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Tagged with {{pp-vandalism}}'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("protected=semi")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{pp-semi-vandalism}}\n' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Tagged with {{pp-semi-vandalism}}'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("plant=wikify")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{wikify}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = 'Tagged with {{wikify}}'+ufb;
		document.editform.submit();
	} 
}
 
 
else if (location.href.match("plant=unref")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{unreferenced}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = 'Tagged with {{unreferenced}}'+ufb;
		document.editform.submit();
	} 
}
 
 
else if (location.href.match("plant=cleanup")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{cleanup}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Tagged with {{cleanup}}'+ufb;
		document.editform.wpSave.click();
	}
}
 
 
else if (location.href.match("plant=npov")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{POV}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Tagged with {{POV}}'+ufb;
		document.editform.wpSave.click();
	}
}
 
 
else if (location.href.match("rapido=si")) 
{
	document.getElementById ("wpConfirmB").click();
}
 
 
 
else if (location.href.match("motivoVEC=")) 
{
	var txt2;
	var strt="Añade la siguiente solicitud debajo de esta línea.-->";
	mot=location.href.substring(location.href.indexOf('motivoVEC=')+10, location.href.length);
	txt=document.getElementById("wpTextbox1").value;
	txt2=txt.split(strt).join(strt+"\n\n{{subst:vandal|"+decodeURI(mot)+"}} --~~~~");
	document.getElementById("wpTextbox1").value=txt2;
	document.editform.wpSummary.value = 'Reporting'+ufb;
	document.editform.submit();
}
 
else if (location.href.match("aviso=")) 
{
	txt=document.getElementById("wpTextbox1").value;
	mot=location.href.substring(location.href.indexOf('aviso=')+6, location.href.length);
	txt=txt+'\n\n{{subst:uw-vandalism'+decodeURI(mot)+'}} --~~~~';
	document.getElementById ("wpTextbox1").value=txt;
	document.editform.wpSummary.value = 'Warning user'+ufb;
	document.editform.submit();
}
 
 
});
 
//</pre>