User:Macy/FastButtons.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Rlevse (talk | contribs) at 20:19, 7 August 2008 (moved User:Macys123/FastButtons.js to User:Macy/FastButtons.js: Automatically moved page while renaming the user "Macys123" to "Macy"). 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 fin_prod="edit&prod=";
var vec="http://en.wikipedia.org/wiki/User:Macys123/Sandbox&action=edit&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 prodreason="Please enter a reason for proposing this page for deletion:";
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;	//Promotional
var FBotro = true;	//Custom CSD
var FBcommons = true;	//NowCommons
var FBimfu = true;	//No fair use rationale
var FBprod = true;	//PROD pages
var FBwikify = true;    //Wikify
var FBunref = true;	//Unreferenced
var FBcleanup = true;	//Cleanup
var FBnpov = true;	//POV
var FBglobal = true;	//Globalize
var FBcedit = true;	//Copyedit
var FBborrar = false;	//Speedy delete (test)
var FBvec = false;	//Report to AIV (test)
var FBprotect = true;	//Mark page as protected
var FBaviso = true;	//Warn user
var FBwelcome = false;	//Welcome user
 
//All data is here:
for (i=0; i<wgUserGroups.length; i++)
   {  if (wgUserGroups[i] == "sysop") biblio=true; }

for (i=0; i<wgUserGroups.length; i++)
   {  if (wgUserGroups[i] == "autoconfirmed") autoconfirmed=true; }
 
pagina=encodeURI(wgPageName);
if (pagina.match("&"))
{
pagina=pagina.replace("&","%26");
}
dire=dire+pagina+"&action=";
usuario=pagina.split(":")[1];
 
 
if (pagina=="Special:Contributions")
{usuario=location.href.substring(location.href.indexOf('Contributions/')+14,location.href.length);}
 
//</pre>
 
//<pre>
 
//Start
 
 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>';}
}
 
if (biblio===false)
if (autoconfirmed===true)
{
	tmp='';
 
	if (FBpruebas){tmp+= '[<a href='+dire+'edit&borrar=blanco>test</a>] '; }
 	if (FBblanco){tmp+= '[<a href='+dire+'edit&borrar=pruebas>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>promotional</a>] '; }
 	if( wgNamespaceNumber ==  6 )
	if (FBimfu){tmp+= '[<a href='+dire+'edit&borrar=norat>no fair use</a>] '; }
 	if( wgNamespaceNumber ==  6 )
	if (FBcommons){tmp+= '[<a href='+dire+'edit&borrar=commons>commons</a>] '; }
	if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
	if (FBprod){tmp+='[<a onclick="mot=prompt(prodreason);location.href=dire + fin_prod +encodeURI(mot) ;">PROD</a>] ';}
	if (FBotro){tmp+= '[<a onclick="mot=prompt(/Enter reason:/);location.href=dire + fin_otro +encodeURI(mot) ;"> Other </a>] ';}
 
	if (tmp!='') { botones= botones + 'CSD: ' + tmp + '<br>';}
 
}
 
 
tmp='';
 
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBwikify){tmp+= '[<a href='+dire+'edit&plant=wikify>wikify</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBunref){tmp+= '[<a href='+dire+'edit&plant=unref>unreferenced</a>] '; } 
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBcleanup){tmp+= '[<a href='+dire+'edit&plant=cleanup>cleanup</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBnpov){tmp+= '[<a href='+dire+'edit&plant=npov>POV</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBglobal){tmp+= '[<a href='+dire+'edit&plant=global>globalize</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBcedit){tmp+= '[<a href='+dire+'edit&plant=cedit>copyedit</a>] '; }
 
if (tmp!=''){botones = botones + 'Templates: ' +tmp+'<br>';}
 
 
tmp='';
 
if( wgNamespaceNumber ==  3 )
if (FBaviso){tmp+='[<a onclick="mot=prompt(textopruebas);location.href=dire + fin_aviso +encodeURI(mot) ;">warn user</a>] ';}
if( wgNamespaceNumber ==  2 || wgNamespaceNumber == 3 )
{
if (FBvec){tmp+= '[<a onclick=";mot=prompt(\n/Please add reason below/);location.href=vec + usuario + sep + mot;">AIV report</a>] ';}
}
if( wgNamespaceNumber ==  3 )
if (FBcedit){tmp+= '[<a href='+dire+'edit&plant=welcome>welcome user</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= '{{db-g11}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Requesting speedy deletion G11'+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='{{delete|'+decodeURI(mot)+'}}\n'+txt;
			document.getElementById ("wpTextbox1").value=txt;
			document.editform.wpSummary.value = 'Requesting speedy deletion'+ufb;
	 		document.editform.submit();
		}
	}
} 
 
else if (location.href.match("borrar=norat")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{db-i8}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Requesting speedy deletion I8'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("borrar=commons")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{db-i6}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Requesting speedy deletion I6'+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("plant=global")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{globalize}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Tagged with {{globalize}}'+ufb;
		document.editform.wpSave.click();
	}
}

else if (location.href.match("plant=cedit")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{copyedit}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = 'Tagged with {{copyedit}}'+ufb;
		document.editform.submit();
	} 
}

else if (location.href.match("plant=welcome")) 
{
	txt=document.getElementById("wpTextbox1").value
	if (txt.match("{destruir")==null)
	{
		txt='{{subst:w-basic}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = 'Welcoming user'+ufb;
		document.editform.submit();
	} 
}
 
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 [[Special:Contributions/' + uid + '|' + uid + ']]'+ufb;
	document.editform.submit();
}
 
else if (location.href.match("aviso=")) 
{
	txt=document.getElementById("wpCombobox1").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();
}
 
else if (location.href.match("prod=")) 
{
	txt=document.getElementById("wpTextbox1").value;
	mot=location.href.substring(location.href.indexOf('aviso=')+6, location.href.length);
	txt=txt+'\n\n{{subst:prod|'+decodeURI(mot)+'}}';
	document.getElementById ("wpTextbox1").value=txt;
	document.editform.wpSummary.value = 'Warning user'+ufb;
	document.editform.submit();
}
 
});

//</pre>

//Special FastButtons start here
//Edit count FastButton
addOnloadHook(function() {
  if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
     return;
  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
     var username = encodeURIComponent( wgTitle );
     var checkurl = "http://toolserver.org/~interiot/cgi-bin/Tool1/wannabe_kate?username="+ username +"&site=en.wikipedia.org" ;
 
     addPortletLink("p-cactions", checkurl, "edc", "ca-contrib", "View edit count by this user");
 
  }
});

//Special:Prefixindex FastButton
addOnloadHook(function() {
  if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
     return;
  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
     var username = encodeURIComponent( wgTitle );
     var checkurl = wgServer + "/w/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2" ;
 
     addPortletLink("p-cactions", checkurl, "all pages", "ca-contrib", "List of pages by this user");
 
  }
});