Uzanto:Castelobranco/Scripts/FastButtons.js

El Vikipedio, la libera enciklopedio

Notu:Post publikigo forviŝu la kaŝmemoron de via foliumilo por vidi la ŝanĝojn.

  • Firefox / Safari: Premu majuskligan klavon klakante Reŝarĝi, aŭ premu aŭ Stir-F5Stir-R (⌘-R kun Makintoŝo)
  • Google Chrome: Premu Stir-majuskligklavon-R (⌘-Majuskligklavo-R kun Makintoŝo)
  • Interreta Esplorilo / Edge: Premu Stir klakante Refreŝu, aŭ premu Stir-F5
  • Opera: Premu Stir-F5.
//FastButtons, baseado no trabalho original do usuário Racso da Wikipédia em Espanhol,
//traduzido por Macy (Inglês), HyperBroad (Português), CasteloBranco (Esperanto).

//<pre>
var pagina =''; var mot=''; var txt=''; var botones=''; var usuario=''; var temporal='';
var sep="|"; var biblio=true;
var ufb = ', per [[Wikipedia:Software/Scripts/FastButtons|FastButtons]]';
var dire="http://eo.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://eo.wikipedia.org/wiki/Wikipedia:Página de testes&action=edit&motivoVEC=";
var textopruebas="Aviso:\n1|(article): Level 1\n2|(article): Level 2\n3|(article): Level 3\n4|(article): Level 4\n4im|(article): Level 4im";
var prodreason="Por favor, informe o motivo para a eliminação:";
var FBpersonales = false; //Configuração pessoal
var FBpruebas= false;	//spu
var FBblanco = false;	//website
var FBne = false;	//absurdo
var FBinfra = false;	//spam
var FBautopromo = false;//Promotional
var FBotro = true;	//Custom CSD
var FBcommons = true;	//NowCommons
var FBimfu = false;	//No fair use rationale
var FBprod = false;	//PROD pages
var FBwikify = false;   //Wikifcar
var FBunref = true;	//sen fontoj
var FBcleanup = true;	//reciclagem
var FBnpov = true;	//parcial
var FBglobal = true;	//contexto
var FBcedit = true;	//controverso
var FBborrar = false;	//Apagar
var FBvec = false;	//Denunciar
var FBprotect = false;	//Protegida
var FBaviso = false;	//Aviso
var FBwelcome = true;	//Boas vindas
 
//Todos os dados estão aqui:
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>apagar!</a>] '; }
	if (FBprotect){tmp+= '[<a href='+dire+'edit&protected=yes>proteger</a>] '; }
	if (FBprotect){tmp+= '[<a href='+dire+'edit&protected=semi>proteger-ip</a>] '; }
 
if (tmp!=''){botones = botones + 'Botões para sysop: ' +tmp+'<br>';}
}
 
if (biblio===true)
if (autoconfirmed===true)
{
	tmp='';
 
	if (FBpruebas){tmp+= '[<a href='+dire+'edit&borrar=blanco>spu</a>] '; }
	if (FBblanco){tmp+= '[<a href='+dire+'edit&borrar=pruebas>website</a>] '; }
	if (FBne){tmp+= '[<a href='+dire+'edit&borrar=NE>absurdo</a>] '; }
	if (FBinfra){tmp+= '[<a href='+dire+'edit&borrar=infra>spam</a>] '; }
	if (FBautopromo){tmp+= '[<a href='+dire+'edit&borrar=autopromo>impróprio</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 )
	if (FBprod){tmp+='[<a onclick="mot=prompt(prodreason);location.href=dire + fin_prod +encodeURI(mot) ;">PROD</a>] ';}
	if (FBotro){tmp+= '[<a onclick="mot=prompt(/Justificativa:/);location.href=dire + fin_otro +encodeURI(mot) ;"> forigo </a>] ';}
 
	if (tmp!='') { botones= botones + 'Forigo: ' + tmp + '<br>';}
 
}
 
 
tmp='';
 
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBwikify){tmp+= '[<a href='+dire+'edit&plant=wikify>wikificar</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBunref){tmp+= '[<a href='+dire+'edit&plant=unref>sen fontoj</a>] '; } 
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 )
if (FBcleanup){tmp+= '[<a href='+dire+'edit&plant=cleanup>reciclagem</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 || wgNamespaceNumber == 2 )
if (FBnpov){tmp+= '[<a href='+dire+'edit&plant=npov>parcial</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 || wgNamespaceNumber == 2 )
if (FBglobal){tmp+= '[<a href='+dire+'edit&plant=global>aktuala</a>] '; }
if( wgNamespaceNumber ==  0 || wgNamespaceNumber == 1 || wgNamespaceNumber == 2)
if (FBcedit){tmp+= '[<a href='+dire+'edit&plant=cedit>futuro</a>] '; }
 
if (tmp!=''){botones = botones + 'Kvalito: ' +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/Informe o motivo abaixo/);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 + 'Especial: ' +tmp+'<br>';}
 
/* Botones funcionando */
 
$(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= '{{er1|01|2=~~~~}}<!--\n' + txt + '\n-->';
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 01)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=pruebas")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{er1|02|2=~~~~}}<!--\n' + txt + '\n-->';
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 02)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=NE")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{er1|03|2=~~~~}}<!--\n' + txt + '\n-->';
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 03)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=infra")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{spam|1=~~~~}}<!--\n' + txt + '\n-->';
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 06)'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("borrar=autopromo"))
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{er1|20|2=~~~~}}\n' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página proposta para eliminação rápida (regra 20)'+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='{{forigu|'+decodeURI(mot)+'}}\n'+txt;
			document.getElementById ("wpTextbox1").value=txt;
			document.editform.wpSummary.value = 'Peto pri forigo'+ufb;
	 		document.editform.submit();
		}
	}
} 
 
else if (location.href.match("borrar=norat")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '{{er1|14|2=~~~~}}\n' + txt
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Proposta para eliminação rápida (regra 14)'+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 = 'Proposta para eliminação rápida:'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("protected=yes")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página protegida'+ufb;
		document.editform.submit();
	}
}
 
else if (location.href.match("protected=semi")) 
{
	txt=document.getElementById("wpTextbox1").value;
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt= '' + txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página protegida contra IPs'+ufb;
		document.editform.submit();
	}
}
 
 
else if (location.href.match("plant=wikify")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{subst:wkf}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = 'Página marcada para wikificar'+ufb;
		document.editform.submit();
	} 
}
 
 
else if (location.href.match("plant=unref")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{sen fontoj|dato={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = '+{{sen fontoj}}'+ufb;
		document.editform.submit();
	} 
}
 
 
else if (location.href.match("plant=cleanup")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{reciclagem|data={{subst:CURRENTMONTHNAME}} de {{subst:CURRENTYEAR}}}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página marcada para reciclagem'+ufb;
		document.editform.wpSave.click();
	}
}
 
 
else if (location.href.match("plant=npov")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{parcial}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Página marcada como parcial'+ufb;
		document.editform.wpSave.click();
	}
}
 
 
else if (location.href.match("plant=global")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{aktuala evento}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt;
		document.editform.wpSummary.value = 'Ŝablono pri aktuala evento'+ufb;
		document.editform.wpSave.click();
	}
}

else if (location.href.match("plant=cedit")) 
{
	txt=document.getElementById("wpTextbox1").value
	if ((txt.match("{destruir")==null) && (txt!=""))
	{
		txt='{{futuro}}\n'+txt;
		document.getElementById ("wpTextbox1").value=txt; 
		document.editform.wpSummary.value = '+Ŝablono pri estonta evento'+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+'{{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
$(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://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user="+ username +"&site=&dbname=ptwiki_p" ;
 
     mw.util.addPortletLink("p-cactions", checkurl, "cde", "ca-contrib", "Ver o número de edições deste utilizador.");
 
  }
});

//Special:Prefixindex FastButton
$(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" ;
 
     mw.util.addPortletLink("p-cactions", checkurl, "todas as páginas", "ca-contrib", "Ver todas as páginas deste utilizador.");
 
  }
});