Usuari:Coet/scripts/Viquiestris.js
Aparença
El codi que afegiu en aquesta pàgina podria tenir contingut maliciós que comprometi el vostre compte. Si no esteu segur si el codi a afegir és segur, pregunteu abans en la Taverna. El codi s'executarà en mostrar una previsualització d'aquesta pàgina. |
Nota: Després de desar, heu de netejar la memòria cau del navegador per veure els canvis. En la majoria de navegadors amb Windows o Linux, premeu Ctrl+F5 o bé premeu Shift i cliqueu el botó "Actualitza" (Ctrl i "Actualitza" amb Internet Explorer). Vegeu més informació i instruccions per a cada navegador a Viquipèdia:Neteja de la memòria cau.
/*
* <pre><nowiki>
*
* Traducció del [[:es:Usuario:Axxgreazz/Monobook-Suite|Monobook-Suite]] al català, de l'usuari
* [[:es:Usuario:Axxgreazz|Axxgreazz]].
*
* Adaptació per a la Viquipèdia en català.
* Realitzada per [[Usuari:Coet|Coet]].
*
*/
console.log("carregant primer modul (viquiestris.js)");
/*** variables i constants intermodulars ***
*
*/
veLlenguaContingut = wgContentLanguage;
veEdicio = wgContentLanguage; //És un àlies de l'anterior.
veLLenguaUsuari = wgUserLanguage;
veProjecte = wgServer.split(".")[1];
veUsuari = wgUserName;
veTitolPagina=document.title;
veHref=location.href;
reEditant=/&action=edit.*/g;
reEdPag=/&action=edit$|&action=submit$/g;
reEdSec=/&action=edit§ion=\d+/g;
veEditant=veHref.search(reEditant)>-1;
veEdPag=veHref.search(reEdPag)>-1;
veEdSec=veHref.search(reEdSec)>-1;
veDiscussio = !wgNamespaceNumber % 2 === 0; //si no és divisible per 2 és una pàg de discussió.
function proj_abreujat(servidor) {
if (servidor=="tots") return "tots";
modalitatProj = servidor.split(".")[1];
if (modalitatProj=="wikipedia") projAbreujat=servidor.replace(/http:\/\//,"").split(".")[0]+"wiki";
if (modalitatProj=="wikimedia") projAbreujat=
servidor.replace(/http:\/\//,"").split(".").toString().split(",")[0];
return projAbreujat;
}
cawiki = "//ca.wikipedia.org/wiki/";
eswiki = "//es.wikipedia.org/wiki/";
commons = "//commons.wikimedia.org/wiki/";
upload = "//upload.wikimedia.org/wikipedia/commons/";
no = false; dreta = false;
si = true; esquerra = true;
comu = 1; meu = 2; ambdos = 3;
ca = "ca"; val = "val"; local = "local"; //per al mòdul ~/altresllengües.js
veEnllacResum = ' using [[ca:User:Coet/viquiestris|Viquiestris]]';
veEnllacResum = ' using [[ca:User:Coet/viquiestris|Viquiestris]]';
veVEprefixat = "[[Usuari:Coet/viquiestris|VE:]] ";
if(typeof vePropi == "undefined"){vePropi = no} //Esta variable haurà de figurar al
//monobook de l'usuari, permet carregar
//el propi mòdul amb la configuració
//personalitzada si el valor és "sí"
var veMarcaAdmin = false;
for (i=0; i<=wgUserGroups.length; i++){
if (wgUserGroups[i] == "sysop") { veMarcaAdmin = true;}
}
/* antigament (fins al 8-4-07 05:44):
if (veUsuari=='Plàcid Pérez Bru' || veUsuari=='Xevi' || veUsuari=='Makinal' ||
veUsuari=='Joanjoc' || veUsuari=='Martorell' || veUsuari=='Friviere' ||
veUsuari=='Oersted' || veUsuari=='Vriullop' || veUsuari=='Pepetps' ||
veUsuari=='Barcelona' || veUsuari=='Alonso' || veUsuari=='SMP' ||
veUsuari=='Xtv' || veUsuari=='Lohen11' || veUsuari=='Felato') {veMarcaAdmin=true};
*/
function veSignatura() {
var pqTrets = (wgUserName=="Coet")?"":"--"; //Jo incorpore un mdash en la meua signatura.
//pqTrets tb en funcions.js
var signatura = pqTrets+"~"+"~~"+"~";
return signatura;
}
veCoet = /(Pas(qual(_%28ca%29)?|kvalo)|Con(lang|world)er|Glagolnik|Coet)/g.test(veUsuari);
/**********
* comença paràmetres.js
*/
var veVigilaDiscussions = no; //defecte: no. Amb sí s'afegiran les discussions a la llista de
//seguiment, en cas d'haver seleccionat l'opció
//"Afegeix les pàgines que he creat la llista de seguiment"
var veResumBuitNoVal = no; //defecte: no. Amb sí no es permetrà desar una pàgina amb un
//resum d'edició buit.
var veProjecteHabitual = "tots"; //defecte "tots". Per especificar algun en concret deixeu entre
//cometes el servidor. p.e.: "ca.wikipedia.org".
/*
* configuració dels botons
* del quadre d'edició
*
* (barra d'eines estesa)
*
*/
var veConfirma = no; //defecte: no. Amb sí es demana si s'ha de realitzar l'acció
//seleccionada. -açò està al revés!-
var veDesa = no; //defecte: no. Amb no apareix un diàleg abans de desar
// l'article.
var veVigila = no; //defecte: no. Amb sí es marcarà l'article per a la llista de
//seguiment.
var veIndexacio = si; //defecte: sí. Amb sí indexa les categories (sense
// accents ni diacrítiques).
var vePlantillaGanyotes = si; //defecte: sí
/*
* configuració de l'administrador
* d'estat d'usuari
*
*/
veBarraEstat = si; //defecte: sí.
veTextComplet = si; //defecte: sí;
vePosicioBarra = esquerra; //defecte: esquerra.
veVigilaEstat = si; //defecte: sí.
veBlink = no; //defecte: no.
/*
* configuració per carregar
* mòduls opcionals
*
*/
//### opcions disponibles: comú, meu o ambdós. Opció per defecte: comú. ###
veBotons = comu;
veCercadors = comu;
vePanells = comu;
veEnllacos = comu;
veFlotants = comu;
//### opcions disponibles: sí o no. ###
vePopups = no; //defecte: no. Inclou mòdul de popups.
veCanvis = no; //defecte: no. Inclou mòdul de canvis recents
veReversio = no; //defecte: no. Inclou mòdul de reversió
veBotonera = no; //defecte: no. Inclou mòdul de la botonera flotant
//### opcions administradors ###
veAutoEsborrament = no;
/***
* comença funcions.js
Funcions desenvolupades per [[w:es:User:Axxgreazz|Axxgreazz]] per al [[w:es:User:Axxgreazz/Monobook-Suite]] de la Viqupèdia en castellà i els Commons. Per a veure les funcionalitats contingudes ací reviseu-lo.
Molt aviat contarem amb una versió en català a:
*[[w:ca:Usuari:Coet/viquiestris]]
Adaptació i traducció de l'usuari [[w:ca:Usuari:Coet]] per a la Viquipèdia en català.
*/
/********************* Funcions de la Viquipèdia en català ***********************/
/* Són les funcions de la barra d'eines del Monobook-Suite */
/* */
/*********************************************************************************/
function negreta () {
insertTags("'''","'''","Text en negreta");
}
function cursiva () {
insertTags("''","''","Text en cursiva");
}
function enllac_intern () {
insertTags("[[","]]","Títol de l'enllaç");
}
function enllac_extern () {
insertTags("[","]","http://www.exemple.cat Títol de l'enllaç");
}
function titular () {
insertTags("== "," ==","Text de titular");
}
function imatge () {
insertTags("[[Fitxer:","]]","Exemple.png");
}
function media () {
insertTags("[[Mèdia:","]]","Exemple.ogg");
}
function matematica () {
insertTags("<math>","</math>","Escriviu ací una fòrmula");
}
function senseformat() {
insertTags("<"+"nowiki>","<"+"/nowiki>","Inseriu ací text sense format");
}
function signatura () {
var pqTrets = veUsuari=="Coet"?"":"--";
var sign = pqTrets+'~'+'~~'+'~';
insertTags("","",sign);
}
function linia () {
insertTags("\n----\n","","");
}
function ratlla () {
insertTags("<s>","</s>","Text ratllat");
}
function plantilla () {
insertTags("{{","}}","Nom de la plantilla");
}
function enllac_plantilla () {
insertTags("{"+"{tl|","}}","Nom de la plantilla");
}
function text_menor() {
insertTags("<small>","</small>","Text de mida menor");
}
function text_major() {
insertTags("<big>","</big>","Text de mida major");
}
function superindex() {
insertTags("<sup>","</sup>","Text superindexat");
}
function subindex() {
insertTags("<sub>","</sub>","Text subindexat");
}
function ref() {
insertTags("<ref>","</ref>","Notes i remarques");
}
function ocult() {
insertTags("<!-- "," -->","Text ocult");
}
function mida_article() {
if (wgNamespaceNumber === 0) {
addOnloadHook (carrega_mides);
} else {
alert ("L'article conté " + document.getElementById("wpTextbox1").value.length + " caràcters.");
}
}
function esborrany() {
tria_espais("1");
var preposicio, inicial, resum, materia;
var procedix = false;
var seleccio = text_seleccionat2();
if (seleccio) {
preposicio = "de";
materia = seleccio;
procedix = true;
} else {
pregunta = "";
if (!pregunta) {void(pregunta = prompt("Esborrany de:", ""));}
if (pregunta === null) {
procedix = false;
} else if (pregunta !== "") {
preposicio = "de";
materia = pregunta
procedix = true;
} else {
preposicio = "";
materia = ""
procedix = true;
}
}
if (procedix) {
espai = "";
if (preposicio!=="") {
preposicio = elidix(preposicio,materia,1);
materia = elidix(preposicio,materia,2);
resum = preposicio + "[[" + materia + "]]";
espai = " ";
} else {
preposicio = "";
materia = "";
resum = "";
}
insertTags2("{{esborrany" + espai + preposicio,"}}",materia);
if (document.editform.wpSummary.value) {
document.editform.wpSummary.value += ", esborrany"
+ espai + resum;
} else {document.editform.wpSummary.value = "Esborrany" + espai + resum;}
}
}
function categoria() {
tria_espais("0 2 4 6 8 10 12 14 102");
var indexacio=String, categ= String;
var procedix = false;
var seleccio = text_seleccionat2();
if (seleccio)
{ categ = seleccio;
procedix = true;}
else
{
pregunta="";
if (!pregunta) {void(pregunta = prompt ("Categoria: ",""));}
if (pregunta===null)
{ procedix = false;}
else if (pregunta !== "")
{ categ = pregunta;
procedix = true;}
else {procedix = false;}
}
if (procedix)
{
if (veIndexacio)
{
indexacio = simplificaCaracter(wgTitle);
if (indexacio != categ)
{insertTags2("[[Categoria:"+ categ + "|","]]\n", indexacio);}
else {insertTags2("[[Categoria:","]]\n",categ);}
}
else
{
insertTags2("[[Categoria:","]]\n",categ);
}
if (document.editform.wpSummary.value)
{
document.editform.wpSummary.value += ", categoria [" + "[Categoria:" + categoria
+ "|" + indexacio + "]]";
}
else
{
document.editform.wpSummary.value = "Categoria [" + "[Categoria:"
+ categ + "|" + indexacio + "]]";
}
}
}
function copyright(){
if (!tria_espais("0")) return;
pqInsercio = "";
if(!pqInsercio)
{
pqInsercio=prompt("Còpia possible des de:","");
}
if(pqInsercio)
{
var text = text_seleccionat2();
if (text)
{
insertTags("{"+"{copyright|1=" + pqInsercio + "|2=" + veSignatura() +
"}" + "}"
+ "\n" + "<!--" + "\n","\n" + "-->","");
}
else
{
text = document.getElementById ("wpTextbox1").value;
document.getElementById ("wpTextbox1").value="{" + "{copyvio|1=" + pqInsercio + "|2="
+ veSignatura() + "}" + "}" + "\n" + text;
}
omple_resum("Copyright des de: " + pqInsercio);
vigila();
desa();
}
}
function plagi() {
pqInsercio="";
if(!pqInsercio){pqInsercio=prompt("Còpia evident de:","")}
if(pqInsercio)
{
document.getElementById ("wpTextbox1").value="{".concat("{plagi|1=", pqInsercio,
"|2=", veSignatura(), "}}");
omple_resum("Plagi des de: " + pqInsercio);
vigila();
desa();
}
}
function avispropostaelim() {
pqPagina = "";
if(!pqPagina){void(pqPagina = prompt("Pàgina proposada per a la seua eliminació?",""));}
if(pqPagina)
{
document.getElementById("wpTextbox1").value += "\n{".concat("{subst:esborrar3|",
pqPagina, "}} ", veSignatura()
);
omple_resum("".concat(veVEprefixat, "Deixant avís de proposta d'esborrament de ",
"la pàgina [[", pqPagina, "]]"), false
);
vigila();
desa();
}
}
function propostaelim() {
motiu = "";
pqPagina = wgPageName;
pqPagina = pqPagina.replace(/_/gi," ");
pqPagina = pqPagina.replace(/\&/gi, '"i comercial"');
if(!motiu) {motiu=prompt("Motiu de l'esborrament?","Article no enciclopèdic");}
if(motiu) {
inserix_plantilla( "{".concat("{esborrar1|",motiu,"}}\n"));
omple_resum (veVEprefixat.concat("Avís d'esborrament ", veUString(veEnllaçResum),
" - motiu: ", motiu), false);
if (typeof veProvaSuperada == "undefined") veProvaSuperada=true;
pqPàginaPropostes = !veProvaSuperada || !veNavegadorSuportat
?"Usuari:Coet/pr:Esborrar pàgines/Propostes"
:"Viquipèdia:Esborrar pàgines/Propostes"
pqLligContingut = topaz.wputil.getpagecontent(pqPàginaPropostes)
if (pqLligContingut.indexOf(pqPàgina)== -1) {
motiu = motiu.replace(/\&/gi, "\"i comercial\""); //El caràcter & no és permès en la següent
//instrucció. Rares vegades l'usarem en un
//resum però cal previndre.
topaz.wputil.addpagecontent(
pqPàginaPropostes,
"\n\n{" + "{subst:esborrar2|títol_pàgina=" + pqPàgina + "|motius=" + motiu + "}" + "}",
"[[Usuari:Coet/viquiestris|VE:]] creant proposta d'esborrament de [["
+ pqPàgina + "]] - motiu: " + motiu,
true);
} else {
alert("La pàgina ja ha estat proposada" + "\n" + "per a la seua eliminació" +
"\nNo ha estat possible afegir la proposta.")
};
vigila()
desa()
}
}
function avalua_proposta(){
if(/Viquipèdia:Esborrar pàgines\/Propostes/.test(veTítolPàgina)){
var pqNomPàginaPropostes = "Viquipèdia:Esborrar pàgines/Propostes"
obrePopup()
} else { alert("Aquesta no és la pàgina de propostes d'esborrament")}
};
function contextualització() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Contextualizar?")) {
inserix_plantilla( "{" + "{contextualizar|{" + "{subst:CURRENTDAY}}|{" + "{subst:CURRENTMONTHNAME}}" + "}" + "}" + "\n")
omple_resum("Inserint plantilla \"Contextualització\"");
edició_menor(true);
vigila()
desa()
}
};
function senseRellevància() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Sense rellevància?")) {
inserix_plantilla( "{" + "{senserellevància|{" +"{subst:CURRENTDAY}}|{" + "{subst:CURRENTMONTHNAME}}" + "}" + "}" + "\n")
omple_resum("Inserint plantilla \"Sense rellevància aparent\"");
edició_menor(true);
vigila()
desa()
}
};
function millorar(){
aspectes = prompt("Podeu triar entre els següents valors:\n"+
"• buit: (general)\n"+
"• 1: enllaços interns "+
"• 2: format\n"+
"• 3: introducció "+
"• 4: ortografia\n"+
"• 5: redacció "+
"• 6: text "+
"• 7: traducció");
if (aspectes){
if(aspectes.charAt(aspectes.length-1)==" ") aspectes=aspectes.substring(0,aspectes.length-1)
plantilles=aspectes.split(" ").length
textPàgina=""; textResum=""; plantilla=""; textPlantilla="";
if(aspectes.search(/(\b[1-7aefiort]\+? ?\b)+/gi)>-1){
for (i=0;i<plantilles;i++){
ésPlantilla=true;
lectura=aspectes.split(" ")[i].toLowerCase();
switch(lectura.charAt(0)) {
case "1": case "e": plantilla = "enllaços interns"; break;
case "2": case "f": plantilla = "format"; break;
case "3": case "i": plantilla = "introducció"; break;
case "4": case "o": plantilla = "ortografia"; break;
case "5": case "r": plantilla = "redacció"; break;
case "6": case "t": plantilla = "text"; break;
case "7": case "a": plantilla = "traducció"; break;
default : ésPlantilla = false
}
if(!ésPlantilla) continue
if(lectura.charAt(1)=="+") {
aspectesPlantilla = prompt("Aspectes a considerar per a la plantilla {{millorar "
+ plantilla+"}}:","")
if (aspectesPlantilla) textPlantilla=plantilla+"|"+aspectesPlantilla
} else {textPlantilla=plantilla}
textPàgina+="{{millorar "+textPlantilla+"}}\n"
if(i==0) textResum='plantilles {{millorar '+plantilla+'}}'+(plantilles>1?", ":" ")
if(i != 0 && i != plantilles-1) textResum +='{{millorar '+plantilla+'}}'
+(i<plantilles-2?", ":" ")
if(i != 0 && i == plantilles-1) textResum +='i {{millorar '+plantilla+'}}'
}
} else {
textPàgina='{{millorar|'+aspectes+'}}\n'
textResum ='plantilla {{millorar}}'
}
}
if(aspectes==""){
textPàgina='{{millorar}}\n'
textResum ='plantilla {{millorar}}'
}
if(aspectes||aspectes==""){
inserix_plantilla(textPàgina)
omple_resum('Inserint '+textResum);
edició_menor(true);
vigila()
desa()
}
};
function copyedit() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla \"copyedit?\"")) {
inserix_plantilla( "{" + "{copyedit}" + "}" + "\n")
omple_resum("Inserint plantilla \"Copyedit\" ");
edició_menor(true);
vigila()
desa()
}
};
function viccionari() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Viccionari?")) {
inserix_plantilla( "{"+"{viccionari}" + "}" + "\n")
omple_resum ("Al viccionari");
edició_menor(true);
vigila();
desa();
}
};
function redirecció() {
Qr = "";
if(!Qr){void(Qr = prompt("Redirecciona cap a?",""));}
if(Qr) {
document.getElementById("wpTextbox1").value = "#" + "REDIRECT [" + "[" + Qr + "]]";
omple_resum("Redireccionant cap a [" + "[" + Qr + "]]");
vigila()
if (!veDesa || confirm("Desitgeu desar els canvis?")) desa();
}
};
function fusió() {
Qr="";
if(!Qr) void(Qr = prompt("Fusió amb:",""));
if(Qr) {
document.getElementById("wpTextbox1").value="{" + "{fusió|" + Qr +"" + "}" + "}" + "\n" +
document.getElementById("wpTextbox1").value;
omple_resum ("Fusió amb [" + "[" + Qr + "]]");
vigila()
desa()
}
};
function emoticona() {
if (text_seleccionat()) {
inclou_operador('<code style="background:yellow">', '</code>');
} else {
Qr = "";
if(!Qr){void(Qr = prompt("Ganyota:",":D"));}
if(Qr) {
if (!vePlantillaGanyotes) {
insertTags('<code style="background:yellow">','</code>',Qr);
} else {
insertTags("{{(",")}}",Qr);
}
}
}
};
function usuari() {
if (text_seleccionat()) {
inclou_operador("{{u|", "}}");
} else {
Qr = "";
if(!Qr) void(Qr = prompt("Usuari:",""));
if(Qr)insertTags("{{u|" + Qr + "}}","","");
}
};
function usuari2() {
if (text_seleccionat()) {
inclou_operador("[[Usuari:", "|]]");
} else {
Qr = "";
if(!Qr){void(Qr = prompt("Usuari:",""));}
if(Qr){insertTags("[[Usuari:" + Qr + "|" + Qr + "]]","","");}
}
};
function benvinguda() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla de Benvinguda?")) {
var cadena = location.href;
var plantilla, sumari, substituïx;
if (wgCanonicalNamespace == "User_talk") {
var ip_re = /^\d+\.\d+\.\d+\.\d+$/;
var discussió = true;
if (ip_re.test(wgTitle)) {
plantilla = "registre";
sumari = "col·laborador anònim";
substituïx = "subst:";
} else {
plantilla = "benvinguda";
sumari = "nou viquipedista";
substituïx = "subst:";
}
} else {
discussió = false;
}
if (discussió) {
insertTags("{{" + substituïx + plantilla + "}}" + signatura_personal(),"","");
if (cadena.indexOf("§ion=")!=-1) {
document.editform.wpSummary.value = "Oferint la benvinguda!";
} else {
omple_resum("Donant la benvinguda a un " + sumari);
}
vigila()
if(typeof veVigilaDiscussions=="undefined") veVigilaDiscussions=false;
if(!veVigilaDiscussions){document.editform.wpWatchthis.checked =false;}
desa()
} else { alert("Esta no és una pàgina de discussió"); }
}
};
function recordatori(){
if(!tria_espais("1 3")) return;
recordatoris=prompt("Quin voleu incloure en aquesta discussió?\n"+
"incloeu només el número, per incloure'n més d'un\n"+
"separeu-los amb un espai, per ex. per a l'1 el dos i el 10\n"+
"escriviu: \"1 2 10\"\n\n"+
" 1 negreta • 2 signar\n"+
" 3 no signar • 4 interwikis\n"+
" 5 categoritzar • 6 enllaços interns\n"+
" 7 cinc articles • 8 categories redundants\n"+
" 9 una vegada • 10 article inacabat\n"+
"11 drets d'autor • 12 enllaços externs\n"+
"13 millor a Commons • 14 registre\n"+
"15 discussió • 16 nou paràgraf\n"+
"17 indexació • 18 llistes\n"+
"19 és inútil esborrar • 20 orfes\n"+
"21 estil imatges • 22 llibre d'estil\n"+
"23 llanceu-vos-hi • 24 reanomenar\n"+
"25 insistent");
if (recordatoris){
llistaRecordatoris={};
llistaRecordatoris={
"1": "negreta",
"2": "signar",
"3": "no signar",
"4": "interwikis",
"5": "categoritzar",
"6": "enllaços interns",
"7": "5 articles",
"8": "categories redundants",
"9": "una vegada",
"10": "article inacabat",
"11": "drets d'autor",
"12": "enllaços externs",
"13": "millor a Commons",
"14": "registre",
"15": "discussió",
"16": "nou paràgraf",
"17": "indexació",
"18": "llistes",
"19": "és inútil esborrar",
"20": "orfes",
"21": "estil imatges",
"22": "Llibre d'estil",
"23": "Llanceu-vos-hi",
"24": "reanomenar",
"25": "insistent"
}
llargRecordatoris=recordatoris.length
nombreRecordatoris=0;
for(pos=0;pos<llargRecordatoris;pos++){
fiNúm=recordatoris.indexOf(" ",pos);
if (fiNúm==-1) fiNúm = llargRecordatoris
núm = recordatoris.substring(pos,fiNúm)
pos=fiNúm
if(llistaRecordatoris[núm]!=""){
resum=document.getElementById("wpSummary").value;
if (pos==llargRecordatoris && nombreRecordatoris == 0) {
document.getElementById("wpTextbox1").value+="\n==Recordatori==\n{{subst:recordatori "
+llistaRecordatoris[núm]+"}}\n\n"+veSignatura()
document.getElementById("wpSummary").value+= "Afegint recordatori "
+ núm + veUString(veEnllaçResum) + "."
}
if (pos!=llargRecordatoris && nombreRecordatoris == 0) {
document.getElementById("wpTextbox1").value+="\n==Recordatoris==\n{{subst:recordatori "
+llistaRecordatoris[núm]+"}}\n"
document.getElementById("wpSummary").value+= "Afegint recordatoris " + núm
}
if (pos!=llargRecordatoris && nombreRecordatoris > 0) {
document.getElementById("wpTextbox1").value+="\n{{subst:recordatori "
+llistaRecordatoris[núm]+"}}\n"
document.getElementById("wpSummary").value+=", "+núm
}
if (pos==llargRecordatoris && nombreRecordatoris > 0) {
document.getElementById("wpTextbox1").value+="\n{{subst:recordatori "
+llistaRecordatoris[núm]+"}}\n\n"+veSignatura()
document.getElementById("wpSummary").value+=" i "+núm+veUString(veEnllaçResum)+"."
}
nombreRecordatoris++
}
núm=0;
} //acaba for
article=prompt("Article relacionat: ","");
if (article && location.href.indexOf("section=") ){ //sols en cas d'editar una secció, no tota
//la pàgina.
qtext = document.getElementById("wpTextbox1").value
qtext = qtext.replace(/(\{\{subst:recordatori .*)(\}\})/gi, "$1|[["+ article +"]]$2")
document.getElementById("wpTextbox1").value = qtext
}
desa()
} //acaba if(recordatori)
}
function avís_copyright() {
if (!tria_espais("3")) return;
var Qr="", adreça = location.href, barra = "";
if(!Qr) void(Qr=prompt("Nom d'article possiblement copiat (dada no obligatòria):", ""));
if (Qr!="") opcional = "|" + Qr;
if(Qr!=null) {
insertTags("{" + "{subst:avís copyvio" + opcional + "}" + "}" + "Salutacions " +
veSignatura(),"","");
if (adreça.indexOf("§ion=")!=-1) {
document.editform.wpSummary.value = "";
} else {
omple_resum("\"Avís de copyright\"")
}
edició_menor(false);
vigila()
if (!veDesa || confirm("Desitgeu desar els canvis?")) desa();
}
}
function avís_usuari() {
if(!tria_espais("3")) return;
tipus="";
var resum = document.editform.wpSummary.value;
if(!tipus){void(tipus = prompt("Podeu triar entre els següents valors:\n"+
"• buit: proves,\n"+
"• 0: edicions polèmiques, "+
"• 0a: edicions ofensives, "+
"• 0b: edicions sense estil,\n"+
"• 0c: edicions SPAM, "+
"• 2: edicions arbitràries, "+
"• 2a: esborrament arbitrari,\n"+
"• 3: atureu-vos, "+
"• 4: darrer avís, "+
"• 5: compte blocat."));}
if(tipus!=null) {
//Cal tenir en compte que les plantilles provesN són redireccions, si es canviara el nom de la
//pàgina destí caldria modifica este codi
ésAnònim=""; reAnònim=/^\d+\.\d+\.\d+\.\d+$/;
if(reAnònim.test(wgTitle) && tipus.search(/[0-2][a-c]?/)!=-1){ésAnònim="|anònim"}
insertTags("{"+ "{subst:Proves" + tipus + ésAnònim + "}} "+veSignatura(),"","");
omple_resum("Avís a l'usuari");
document.editform.wpMinoredit.checked = false;
vigila()
if (!veDesa || confirm("Desitgeu desar els canvis?")) desa();
}
}
function imatge_retirada() {
var adreça = location.href;
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Imatge retirada?")) {
insertTags("{{","}}","subst:Imatge retirada|" + signatura_personal());
if (adreça.indexOf("§ion=")!=-1) {
document.editform.wpSummary.value = "";
} else {
omple_resum("Avís d'imatge retirada");
}
vigila()
desa()
}
}
function senseSignar() {
if (text_seleccionat()){
inclou_operador("{"+"{subst:sense signar|", "|2=~~"+"~"+"~~}}");
} else {
Qr="";
if(!Qr){void(Qr = prompt("Usuari que no ha signat",""));}
if(Qr) {
insertTags("{{subst:","}}","sense signar|" + Qr + "|2=~~"+"~"+"~~" );
omple_resum("Agregant signatura de l'usuari [[Usuari:" + Qr + "|" + Qr + "]] ");
}
}
}
function destrucció() {
var pqMotiu = "";
var pqBarra = "";
if(!pqMotiu){pqMotiu = prompt("Motiu per a la seua eliminació ràpida:","");}
if(pqMotiu == "") {pqBarra = ""} else {pqBarra = "|"};
if (pqMotiu || pqMotiu == "") {
document.getElementById("wpTextbox1").value="<"+"noinclude>{" + "{destrucció" + pqBarra + pqMotiu
+ "}}<"+"/noinclude>\n" + document.getElementById("wpTextbox1").value;
if(pqMotiu != "") pqMotiu = " - motiu: " + pqMotiu;
omple_resum("Marcant article per a eliminació ràpida " + pqMotiu);
vigila()
if (!veDesa || confirm("Desitgeu desar els canvis?")) desa();
}
}
function reversió() {
Qr = "";
if(!Qr){void(Qr = prompt("Usuari de la versió darrera?:",""));}
if(Qr){
omple_resum("Revertits els canvis a la darrera edició de l' usuari" +
"[[Usuari:" + Qr + "|" + Qr + "]]");
vigila()
desa();
}
}
function previsualitza() {
document.editform.wpPreview.click();
};
function mostra_canvis() {
document.editform.wpDiff.click();
};
function vota (vot){
insertTags("*{{","}} "+veSignatura()+"\n",vot)
resumVot="[[Usuari:Coet/viquiestris|Vot:]] "+vot
omple_resum(resumVot, false)
};
function anul_la() {
insertTags("*{{","}} "+"\n","anul·lada");
omple_resum("proposta anul·lada")
};
function signatura_personal() {
var Qr="";
Qr= "\n\nSalutacions cordials\n\n" + veSignatura();
return Qr;
};
/********************* Funcions de la Viquipèdia en castellà *********************/
/* Són les funcions de la barra d'eines del Monobook-Suite */
/* */
/*********************************************************************************/
function miniesborrany() {
var extra, sumari;
var procedix = false;
var text = text_seleccionat2();
if (text) {
extra = " de ";
sumari = " de: [[" + text + "]]";
procedix = true;
} else {
Qr = "";
if(!Qr){void(Qr=prompt("Miniesbozo de :",""));}
if (Qr==null){
procedix = false;
} else if (Qr!="") {
extra = " de|" + Qr;
sumari = " de: [[" + Qr + "]]";
procedix = true;
} else {
extra = "";
sumari = "";
procedix = true;
}
}
if (procedix) {
insertTags("{{miniesbozo" + extra,"}}","");
omple_resum ("miniesbozo" + sumari)
}
}
/************************** Funcions de Commons **********************************/
/* Són les funcions de la barra d'eines del Monobook-Suite */
/* en Commons */
/*********************************************************************************/
//edició
function category_c() {
var text= text_seleccionat2();
if (text){
inclou_operador("[[Category:", "]]");
omple_resum("Category [[Category:" + text +"]]")
} else {
Qr="";
if (!Qr) void(Qr=prompt("Category:",""));
if(Qr) {
insertTags("[[Category:" + Qr + "]]","","");
omple_resum("Category [" + "[Category:" + Qr + "|" + Qr +"]]");
}
}
};
//manteniment
function nosource()
{
insertTags("{" + "{subst:nsd}" + "}","","");
document.editform.wpSummary.value = "no/missing source, tagged by date";
edició_menor(true);
desa()
}
function nolicense()
{
insertTags("{" + "{subst:nld}" + "}","","");
document.editform.wpSummary.value = "no/incomplete licensing information, tagged by date";
edició_menor(true);
desa()
}
function deletion_request()
{
document.getElementById("wpTextbox1").value="{" + "{subst:deletionrequest" + "}" + "}" + "\n" + document.getElementById("wpTextbox1").value;
document.editform.wpSummary.value = "Deletion request";
desa()
}
function delete_image()
{
document.getElementById("wpTextbox1").value="{" + "{subst:delete" + "}" + "}" + "\n" + document.getElementById("wpTextbox1").value;
document.editform.wpSummary.value = "Delete";
desa()
}
//Avisos a usuaris
function image_source()
{
var cadena = location.href;
Qr="";
if(!Qr){void(Qr=prompt("Nom d'imatge (amb extensió):",""));}
if(Qr)
{
insertTags("{" + "{subst:image source|Image:" + Qr + "}" + "}"+ signatura_personal(),"","");
if (cadena.indexOf("§ion=")!=-1)
{ document.editform.wpSummary.value = "";}
else
{ document.editform.wpSummary.value = "Image Tagging [[:Image:" + Qr + "]]";}
edició_menor(false);
desa()
}
}
function welcome()
{
document.getElementById("wpTextbox1").value = "{" + "{subst:welcome}}" + wpMessage + signatura_personal();
omple_resum("Welcome (benvinguda)");
desa()
}
function user2() {
if (text_seleccionat()) {
inclou_operador("[[User:", "|]]");
} else {
Qr = "";
if(!Qr) void(Qr = prompt("User:",""));
if(Qr) insertTags("[[User:" + Qr + "|" + Qr + "]]","","");
}
}
function vot_nul() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Votnul?")) {
insertTags("<s>","</s> {{votnul|1=~~~~}}","Vot per a anul·lar");
omple_resum("Inserint plantilla \"votnul\"");
edició_menor(false);
desa();
}
};
function copyviocommons() {
Qr = ""
var barra = "";
if(!Qr){void(Qr=prompt("Possible còpia des de:",""));}
if(Qr!=null) {
if (Qr != "") { barra = "|";}
var text = text_seleccionat2();
if (text) {
insertTags("<s><nowiki>","</nowiki></s>\n{{copyvio" + barra + Qr + "}}","");
} else {
insertTags("{" + "{copyvio" + barra + Qr + "}" + "}","","");
}
omple_resum("Copyvio des de: "+ Qr);
vigila()
desa()
}
};
function badname () {
var extra;
var procedix = false;
var text = text_seleccionat2();
if (text) {
extra = "";
procedix = true;
} else {
Qr = "";
if(!Qr) void(Qr=prompt("Nom incorrecte per a la imatge:",""));
if (Qr==null) {
procedix = false;
} else if (Qr!="") {
extra = Qr;
procedix = true;
} else {
procedix = false;
}
}
if (procedix) {
insertTags("{{bad name|" + extra,"}}","");
omple_resum ("Inserint plantilla \"Bad name\"");
vigila()
desa()
}
};
function fairuse () {
var extra;
var procedix = false;
var text = text_seleccionat2();
if (text) {
extra = "|";
procedix = true;
} else {
Qr = "";
if(!Qr) void(Qr=prompt("Origen de la imagen :",""));
if (Qr==null) {
procedix = false;
} else if (Qr!="") {
extra = "|" + Qr; procedix = true;
} else {
extra = "";
procedix = true;
}
}
if (procedix) {
insertTags("{{fair use" + extra,"}}","");
omple_resum = ("Inserint plantilla \"Fair use\"");
vigila()
desa()
}
};
/*********************** Galeria de funcions adicionals **************************/
/* Són les funcions de la barra d'eines del Monobook-Suite */
/* per a "botons extres" */
/*********************************************************************************/
function sup(){
insertTags("<sup>","</sup>","Text en superíndex");
}
function sub() {
insertTags("<sub>","</sub>","Text en subíndex");
}
function code() {
insertTags("<code>","</code>","Introduïu codi");
}
function pre() {
insertTags("<"+"pre>","<"+"/pre>","Text preformatat");
}
function big() {
insertTags("<big>","</big>","Text de mida major");
}
function cometes() {
insertTags("«","»","Text entre cometes franceses");
}
function subratlla() {
insertTags("<u>","</u>","Text subratllat");
}
function galeria() {
insertTags("\n<gallery>\n","\n</gallery>","Imatge:Exemple.png");
}
function fontprimària() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Fontprimària?")) {
inserix_plantilla( "{" + "{Font primària}" + "}" + "\n")
omple_resum("Inserint plantilla \"Font primària\"");
edició_menor(true);
desa()
}
}
function neutralitat() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Neutralitat?")) {
inserix_plantilla( "{" + "{neutralitat}" + "}" + "\n")
omple_resum("Inserint plantilla \"Neutralitat\"");
edició_menor(true);
desa()
}
}
function desambiguació() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Desambigüació?")) {
insertTags("{{","}}","desambiguació");
omple_resum("Inserint plantilla \"desambiguació\"");
edició_menor(true);
desa()
}
}
function altres_úsos() {
if (!veConfirma || confirm("Desitgeu aplicar la plantilla Altres úsos?")) {
insertTags("{{","}}","otros usos");
omple_resum("Inserint plantilla \"altres úsos\"")
edició_menor(true);
desa()
}
}
function demostreu()
{
insertTags("{{","}}","demostrar");
}
/*************************** Miscelània de funcions ******************************/
/* Són les funcions extres del Monobook-Suite */
/* */
/*********************************************************************************/
// Sempre marca "Blocar usuaris anònims solament" en Especial:Blockip
$(function(){ var x; if (x=document.getElementById("wpAnonOnly")) {x.checked=true;} });
$(function(){ var x; if (x=document.getElementById("wpCreateAccount")) {x.checked=false;} });
//Esborrament automàtic
function autoesborrament(){ //Parcialment copiat de: [[:en:User:GeorgeMoney/UserScripts/autodel]]
if(veTítolPàgina.indexOf("Confirma l'esborrament")>-1 && veHref.indexOf("&action=delete")>-1){
causa=document.getElementById("wpReason")
if(causa) {
causa=causa.value;
var inputs = document.getElementsByTagName('input');
if(inputs){
for (i=0; i<inputs.length; i++) {
if (inputs[i].name == 'wpConfirmB') {
if(confirm('Desitgeu esborrar la pàgina '+wgTitle+'?\n resum previst: '+causa)) {
inputs[i].click();
}
}
}
}
}
}
};
if (typeof veAutoEsbo == "undefined") {veAutoEsbo=false}
if (veAutoEsbo) addOnloadHook(autoesborrament);
//Funcions de funcions
function inserix_plantilla(plantilla){
document.getElementById("wpTextbox1").value = plantilla + document.getElementById("wpTextbox1").value
};
function omple_resum(contingut, enllaçVE){
enllaç="";
if (typeof enllaçVE == "undefined" || enllaçVE) enllaç = veUString(veEnllaçResum)
nouContingut = contingut+enllaç;
resum=document.getElementById("wpSummary").value
if(resum==""){
document.getElementById("wpSummary").value = nouContingut;
} else {
if(resum.charAt(resum.length-1)!="." && resum.substring(resum.length-3)!="*/ ") resum+="."
//elements que no s'han de repetir
if(resum.indexOf(veUString(veEnllaçResum))>-1 && enllaç!="") {
resum=resum.replace(veUString(veEnllaçResum),"");
}
if(resum.indexOf("[[Usuari:Coet/viquiestris|Vot:]]")>-1) {
nouContingut=nouContingut.replace("[[Usuari:Coet/viquiestris|Vot:]]","");
}
llargResum = resum.length; llargTotal = resum.length+nouContingut.length
if (llargResum < 200 && llargTotal <200) {
document.getElementById("wpSummary").value = resum +" "+nouContingut;
}
if (llargResum < 200 && llargTotal >200) {
document.getElementById("wpSummary").value = resum +" ..."
}
}
};
function edició_menor(bool){
document.editform.wpMinoredit.checked = bool
};
function vigila() {
if(veVigila) document.editform.wpWatchthis.checked = true;
};
function desa(pregunta) {
if(typeof pregunta=="undefined"||pregunta){
var resum = document.getElementById("wpSummary").value
resum = prompt("Desitgeu desar els canvis?\n Resum d'edició:",resum)
if(resum||resum==""){
if (resum.charAt(0) == "-") {resum=resum.substring(1); edició_menor(true)}
document.getElementById("wpSummary").value = resum;
document.editform.submit();
}
} else {document.editform.submit()}
};
function tria_espais(espais,text){
var nomsEspais="", disjuntiva="";
var nomEspai={"0":" article",
"1":"a discussió d'article",
"2":"a plana d'usuari",
"3":"a discussió d'usuari",
"4":"a plana Viquipèdia",
"5":"a discussió Viquipèdia",
"6":"a imatge",
"7":"a discussió d'imatge",
"8":" misstge MediaWiki",
"9":"a discussió MediaWiki",
"10":"a plantilla",
"11":"a discussió de plantilla",
"12":"a plana d'ajuda",
"13":"a discussió d'Ajuda",
"14":"a categoria",
"15":"a discussió d'una categoria",
"102":" Viquiprojecte",
"103":"a discussió de Viquiprojecte"
}
var altresEspais=!text?"altres espais.":text
var totalEspais=espais.split(" ").length
for(espai=0;espai<totalEspais;espai++){
var númeroEspai=espais.split(" ")[espai]
nomsEspais+=disjuntiva+nomEspai[númeroEspai]
if(númeroEspai==wgNamespaceNumber){
return true;
}
disjuntiva=" o un"
}
alert ("Esta pàgina no és un"+nomsEspais+".");
return false;
}