Usuari:Pasqual/scripts/commutadordestat.js
De Viquip??dia
Nota: Despr??s de desar, heu de posar al dia la mem??ria cau del vostre navegador per veure els canvis.
- Mozilla/Firefox/Safari: Premeu Shift mentre cliqueu "Actualitza" (Reload), o premeu Ctrl+Shift+R (Cmd+Shift+R en un Mac Apple);
- Internet Explorer: premeu Ctrl mentre cliqueu "Actualitza" (Refresh), o premeu Ctrl+F5;
- Konqueror: simplement cliqueu el bot?? "Recarregar" (Reload), o premeu F5;
- Opera: haureu d'esborrar completament la vostra mem??ria cau (cach??) a Tools???Preferences.
//<pre><nowiki> //Fuente: http://en.wikipedia.org/wiki/User:Topaz/Wikiscripts //Personalizada por Axxgreazz, para el [[w:es:User:Axxgreazz/Monobook-Suite]] //http://es.wikipedia.org/wiki/Usuario:Axxgreazz/Monobook-Suite topaz.statuschanger = new Object(); //topaz.statuschanger.statuscode = {"offline":"5","busy":"3","online":"1"}; topaz.statuschanger.statuscode = {"desconnectat":"5","ocupat":"3","en l??nia":"1"}; topaz.statuschanger.buttonlist = {}; topaz.statuschanger.oldonload = window.onload; strStatus = veCString("Status"); window.onload = function() { if (typeof veBarraEstat == "undefined") {veBarraEstat = true;} if (typeof veTextComplet == "undefined") {veTextComplet = true;} if (typeof vePosici??Barra == "undefined") {vePosici??Barra = true;} if (typeof veVigilaEstat == "undefined") {veVigilaEstat = true;} if (typeof veImageBot?? == "undefined") {veImatgeBot?? = false;} if (typeof veBlink == "undefined") {veBlink = false;} topaz.statuschanger.usepersonalbar = veBarraEstat; topaz.statuschanger.textcomplet = veTextComplet; topaz.statuschanger.ubicaci?? = vePosici??Barra; topaz.statuschanger.watchstatus = veVigilaEstat; if (typeof topaz.statuschanger.oldonload == "function") { setTimeout("topaz.statuschanger.oldonload()",50);} if (!topaz.statuschanger.usepersonalbar) { topaz.wputil.addsidepanel("tz-statuschanger", veUString("statuschanger"));} var buttonlist = []; for (status in topaz.statuschanger.statuscode) { buttonlist.push(status); var pqTextEstat; if (topaz.statuschanger.textcomplet) { pqTextEstat = veUString(status);} else { pqTextEstat = veUString(status); pqTextEstat = pqTextEstat.substring(0,2);} if (topaz.statuschanger.ubicaci??) { topaz.statuschanger.buttonlist[status] = topaz.wputil.addsidepanelbutton2( topaz.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger", pqTextEstat, "javascript:topaz.statuschanger.setstatus('" + status + "')" ); } else { topaz.statuschanger.buttonlist[status] = topaz.wputil.addsidepanelbutton( topaz.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger", pqTextEstat, "javascript:topaz.statuschanger.setstatus('" + status + "')" ); } } if (topaz.statuschanger.usepersonalbar) { for(var i=0; i<buttonlist.length; i++) { with (topaz.statuschanger.buttonlist[buttonlist[i]].style) { if (topaz.statuschanger.ubicaci??) { if (i == 0) { marginRight="0px";} if (i == 2) { borderLeft="1px solid #aaaaaa";} } else { if (i == 2) { marginRight="0px";} if (i == 0) { borderLeft="1px solid #aaaaaa";} } borderRight="1px solid #aaaaaa"; marginLeft="0px"; paddingLeft="2px"; paddingRight="2px"; } backgroundImage="url('http://upload.wikimedia.org/wikipedia/commons/6/68/Bullet-green.png') top left no-repeat"; } } topaz.statuschanger.update(); }; topaz.statuschanger.setstatus = function(statusname) { pqCodiEstat = (veEdici?? == "es") ? topaz.statuschanger.statuscode[statusname] : veUString(statusname); topaz.wputil.setpagecontent( "User:" + veUsuari + "/" + strStatus, pqCodiEstat, "[[Usuari:Pasqual/viquiestris|VE:]] " + veUsuari + " " + veUString("is") + " " + veUString(statusname), topaz.statuschanger.watchstatus); topaz.util.cookie.set(strStatus, statusname); topaz.statuschanger.update(); }; topaz.statuschanger.laststatus = null; var wpuserstatus="" var lapsus=5 topaz.statuschanger.update = function() { var curstatus = topaz.util.cookie.get(strStatus); //updating status each 5 minutes var now= new Date() var now = now.getTime().valueOf(now) var minutes=60000 // 1 minute= 60000 miliseconds checkStatus = topaz.util.cookie.get("comprova") == null ? topaz.util.cookie.set("comprova",(now+lapsus+1)*minutes) : topaz.util.cookie.get("comprova"); if (now-parseInt(checkStatus) > (lapsus*minutes)){ checkStatus = now+(lapsus*minutes) topaz.util.cookie.set("comprova",checkStatus) wpuserstatus = topaz.wputil.getpagecontent("User:"+veUsuari+ "/" + strStatus) wpuserstatus = wpuserstatus.replace("\n",""); curstatus = wpuserstatus; topaz.util.cookie.set(strStatus, curstatus); } veBlink = (veUsuari == "Pasqual" || veBlink == true) ? "blink" : "none"; if (curstatus && curstatus != topaz.statuschanger.laststatus) { for (status in topaz.statuschanger.buttonlist) { with (topaz.statuschanger.buttonlist[status].style) { if (status == unescape(curstatus)) { fontWeight = "bold"; textDecoration = veBlink;} else { fontWeight = "normal"; textDecoration = "none";} } } } topaz.statuschanger.laststatus = curstatus; }; setInterval("topaz.statuschanger.update()", 5000); //w:en:user:Topaz was fixed it in 5000 //</nowiki></pre>