Usuari:Coet/scripts/panellcontrol.js
Aparença
(S'ha redirigit des de: Usuari:Pasqual/scripts/panellcontrol.js)
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.
// THIS MODULE HAS BEEN DISABLED DUE TO LARGE AMOUNT OF JS ERRORS
// <pre><nowiki>
//Desarrollada por Axxgreazz, para el [[w:es:User:Axxgreazz/Monobook-Suite]]
//http://es.wikipedia.org/wiki/Usuario:Axxgreazz/Monobook-Suite
/* Secció 1: Butlletí dels Viquiestris */
(function () {
if (typeof topaz === undefined || typeof veCString === undefined) {
mw.notify('There is a problem with a gadget you included (Usuari:Coet/scripts/panellcontrol.js). Please review.', { type: 'error' });
return;
}
mw.log.warn( 'The script Usuari:Coet/scripts/panellcontrol.js has deprecation notices. Please review of exclude it from your user scripts.' );
if(typeof veProjecteHabitual=="undefined") veProjecteHabitual="tots"; // "ca.wikipedia.org"
var pqVersióButlletí = 6;
var pqMissatgeButlletí = "You have a new bulletin about Viquiestris";
var pqMissatgeBenvinguda = "You have a wellcome bulletin of Viquiestris";
var pqResumButlletí = "Marking message as read";
var pqResumBenvingudaButlletí = "Congratulating user for his choice";
var veRelease = "VERelease";
function carrega_avís(){
if ( typeof prenGaleta === 'undefined' ) {
mw.log.warn( 'prenGaleta is undefined. Did you load the correct dependencies?');
return;
}
if( proj_abreujat(veProjecteHabitual) != "tots" &&
proj_abreujat(veProjecteHabitual) != proj_abreujat(mw.config.get('wgServer'))) return;
var pqGaletaVersió = prenGaleta('versió');
pqGaletaVersió = parseInt(pqGaletaVersió);
if (pqGaletaVersió != pqVersióButlletí) {
var pqÍndexVersió = llig_versió();
if (pqÍndexVersió == pqVersióButlletí) {
desaGaleta('versió', pqVersióButlletí, 0)
} else {
missatge=prenGaleta("versió")=="" ? pqMissatgeBenvinguda : pqMissatgeButlletí;
document.getElementById('contentSub').innerHTML = '<div style="background-color: '
+ '#ffce7b; border: 1px solid #ffa500; color: black; font-weight: bold; margin: '
+ '2em 0 1em; padding: .5em 1em; vertical-align: middle;">'
+ linkmaker('javascript:mostra_missatge()', veUString(missatge)) + '</div>';
}
}
};
function tria_butlletí(númButlletí,missatge,benvinguda){
if ( typeof veCString === 'undefined' ) {
mw.log.warn( 'This script Usuari:Coet/scripts/panellcontrol.js misconfigured.' );
return;
}
text= benvinguda == true ? "00" : "";
desaGaleta('versió', númButlletí, 0)
topaz.wputil.setpagecontent('User:' + veUsuari + '/' + veCString(veRelease),
númButlletí.toString(),
"[[Usuari:Pasqual/Viquiestris/Butlletí|veB"+númButlletí +
"]]. " + veUString(missatge) + veUString(veEnllaçResum),
true);
window.open ('http://ca.wikipedia.org/wiki/Usuari:Pasqual/Viquiestris/Butlletí'+text);
};
function mostra_missatge(){
índexVersió = llig_versió();
if(isNaN(índexVersió)) {
tria_butlletí(0,pqResumBenvingudaButlletí,true)
} else {
tria_butlletí(pqVersióButlletí,pqResumButlletí)
}
};
function llig_versió(){
var índexVersió = topaz.wputil.getpagecontent('User:'
+ veUsuari + '/' + veCString(veRelease));
return parseInt(índexVersió)
};
/* Secció 2: Panell de control dels Viquiestris */
function CanviaMòdul(ver, tip, conf) {
switch (conf) {
case "0": var pqPrefixe = 'm';
var pqTextConfig = 'no configurable'; break;
case "1": var pqPrefixe = 'viquiestris-';
var pqTextConfig = 'configurable'; break;
}
switch(ver) {
case "Viquiestris":versió="Viquiestris simples";break;
case "ViquiestrisAvançats":versió="Viquiestris avançats";break;
case "paràmetres":versió="paràmetres per defecte";break;
}
var pàginaLectura = 'Usuari:Pasqual/p:' + ver + conf + '.' + tip;
var pàginaEscritura = 'Usuari:' + veUsuari + '/' +
(ver=='paràmetres'?'paràmetres.':'monobook.') + tip;
if (mw.config.get('wgServer') == 'http://ca.wikipedia.org') {
topaz.wputil.setpagecontent(
pàginaEscritura,
'{{subst:' + pàginaLectura + '}}',
'Canviant als ' + versió + ' ' + veUString(veEnllaçResum),
true);
}
};
function carrega_enllaços() {
var ep = document.getElementById('toolbar');
if (ep == null) {
var pqContingut = document.getElementById("content");
var pqEnllaços = "<br /><div><ul>";
mf.unaltraconfiguració(); //mf és a Inici.js
for (i=0; i<configuracions.length; i++) {
var pqVersió = configuracions[i].núm;
var pqTipus = configuracions[i].tipus;
var pqConfig = configuracions[i].config;
/*
alert(pqVersió+'.'+pqTipus);
switch (config) {
case "0": var pqTextConfig = 'no configurable'; break;
case "1": var pqTextConfig = 'configurable'; break;
}
*/
var pqParàmetres = "'" + pqVersió + "','" + pqTipus + "','" + pqConfig + "'";
var pqText = pqVersió == "paràmetres"
? "Restableix a la configuració estàndard dels "
: "Canvia a la versió ";
pqText += pqVersió + " dels Viquiestris." //+ pqTipus; + " (" + pqTextConfig + ")";
pqEnllaços += "<li>" + linkmaker("javascript:CanviaMòdul(" + pqParàmetres
+ ")", pqText) + "<br />";
}
pqContingut.innerHTML += pqEnllaços + "</ul><div>";
}
};
function càrrega_inicial() {
if (mw.config.get('wgCanonicalNamespace') == 'User' && mw.config.get('wgTitle') == 'Pasqual/Viquiestris/Panell de control') {
carrega_enllaços();
}
carrega_avís();
};
function linkmaker (url, text) {
var s='<a href="' + url + '"';
s += '>' + text + '</a>';
return s;
}
$(càrrega_inicial);
/*
* Aparença de les pàgines dels Butlletins.
*/
var pàginaButlletí = document.location.toString().search(/(title=|\/wiki\/)Usuari(_[Dd]iscussi%C3%B3|):Pasqual\/Viquiestris\/Butllet%C3%AD\d*/)>-1;
var isDiff = (document.location.search.indexOf("diff=") != -1 || document.location.search.indexOf("oldid=") != -1);
if (pàginaButlletí && wgIsArticle && !isDiff){
document.write('<style type="text/css">/*<![CDATA[*/ #lastmod, #siteSub, #contentSub, h1.firstHeading, #catlinks { display: none !important; } /*]]>*/</style>');
}
function reanomenaNomEtiqueta() {
try {
var Node = document.getElementById( 'ca-nstab-user' ).firstChild;
if ( Node.textContent ) { // Per DOM Level 3
Node.textContent = 'Butlletí';
} else if ( Node.innerText ) { // IE doesn't handle .textContent
Node.innerText = 'Butlletí';
} else { // Fallback
Node.replaceChild( Node.firstChild, document.createTextNode( 'Butlletí' ) );
}
} catch(e) {
// bailing out!
}
}
if (pàginaButlletí && (mw.config.get('wgNamespaceNumber')==2||mw.config.get('wgNamespaceNumber')==3)) {
addOnloadHook (reanomenaNomEtiqueta);
}
})
// </nowiki></pre>