Kullanıcı:Böcürt/statuschangerX.js
Görünüm
Bu sayfaya eklediğiniz kodlar hesabınızı tehlike altına sokacak kötü amaçlı içerik barındırabilir. Başka bir sayfada yer alan betikleri "mw.loader.load", "importScript" veya "iusc" gibi yöntemlerle kullanmadan önce, bu yöntemle içeriği başkaları tarafından kontrol edilebilecek uzaktaki bir betiği dinamik olarak yüklemiş olacağınızı bilmeniz gerekir. Sayfaya eklediğiniz kodun güvenli olup olmadığından emin değilseniz, Köy Çeşmesi'nde deneyimli kullanıcılara danışabilirsiniz. Kod, sayfa önizlemesinde de çalıştırılacaktır. |
//<pre><nowiki>
//Kaynak: http://en.wikipedia.org/wiki/User:Topaz/Wikiscripts
//Kişiselleştirme için [[w:es:User:Axxgreazz/Monobook-Suite]]
//http://es.wikipedia.org/wiki/Usuario:Axxgreazz/Monobook-Suite
incluir ("","","lenguaje.js"); /*Funciones de idioma */
/* Código del programa (No modificar)*/
var topaz = new Object();
topaz.util = {
getobj:function(id) {
return document.getElementById ?
document.getElementById(id) :
document.all[id];
},
add:function(parent, tag, attr) {
var el = document.createElement(tag);
if (attr) {
for (key in attr) {
el[key] = attr[key];
}
}
return parent.appendChild(el);
},
add2:function(parent, el0, tag, attr) {
var el = document.createElement(tag);
if (attr) {
for (key in attr) {
el[key] = attr[key];
}
}
return parent.insertBefore(el, el0);
},
fullescape:function(text) {
return escape(text).replace(/\+/g,"%2B");
},
mousebtnmap:{
ns:[null,1,3,2],
ie:[null,1,2,null,3]
},
xmlhttpreq:function() {
if (window.XMLHttpRequest) {
xmlhttpobj = new XMLHttpRequest()
} else {
try {
xmlhttpobj = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttpobj = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
xmlhttpobj = null;
}
}
}
return xmlhttpobj;
},
cookie:{
noexpire:(function(){
var d = new Date();
d.setTime(d.getTime()+(365*24*60*60*1000));
return d.toGMTString();
})(),
expire:(function(){
var d = new Date();
d.setTime(d.getTime()-1);
return d.toGMTString();
})(),
get:function(name) {
var cl = document.cookie.split(/;\s*/);
for (var i=0; i<cl.length; i++) {
var curc = cl[i].split(/\=/);
if (curc[0] == name) {
return(curc[1]);
}
}
return null;
},
set:function(name, value) {
document.cookie = name + "=" + escape(value) +
"; expires=" + topaz.util.cookie.noexpire +
"; path=/";
},
del:function(name) {
document.cookie = name+"=; expires="+topaz.util.coookie.expire+"; path=/";
}
}
};
topaz.comm = {
doreq:function(url,postdata,headers) {
var req = topaz.util.xmlhttpreq();
req.open(postdata?"POST":"GET", url, false);
for(header in headers) {
req.setRequestHeader(header,headers[header]);
}
req.send(postdata||null);
return req;
}
};
topaz.wputil = {
username:function() {
return topaz.util.getobj("pt-userpage").childNodes[0].childNodes[0].nodeValue;
},
iseditpage:function() {
return document.title.indexOf("Editing ")==0;
},
pagename:function() {
var iseditpage = topaz.wputil.iseditpage();
return document.title.substr(iseditpage?8:0,document.title.indexOf(" - ")-(iseditpage?8:0));
},
addsidepanel:function(id,label) {
var div = topaz.util.add(topaz.util.getobj("column-one"), "div", {className:"portlet",id:id});
topaz.util.add(div, "H5").innerHTML = label;
topaz.util.add(topaz.util.add(div, "div", {className:"pBody"}), "ul");
},
addsidepanelbutton:function(id,label,targhref) {
var li = topaz.util.add((topaz.util.getobj(id).getElementsByTagName("ul"))[0],"li");
with(topaz.util.add(li,"a")) {
innerHTML = label;
href = targhref;
}
return li;
},
addsidepanelbutton2:function(id,label,targhref) {
var li = topaz.util.add2((topaz.util.getobj(id).getElementsByTagName("ul"))[0],((topaz.util.getobj(id).getElementsByTagName("ul"))[0].getElementsByTagName("li"))[0],"li");
with(topaz.util.add(li,"a")) {
innerHTML = label;
href = targhref;
}
return li;
},
setpagecontent:function(pagename,content,summary,watch) {
var prelimresp = topaz.comm.doreq("/w/index.php?title="+pagename+"&action=submit");
var edittime = prelimresp.responseText.match(/\<input type='hidden' value="(\d+)" name="wpEdittime" \/\>/)[1];
var edittoken = prelimresp.responseText.match(/\<input type='hidden' value="([^"]+)" name="wpEditToken" \/\>/)[1];
topaz.comm.doreq("/w/index.php?title="+pagename+"&action=submit",
"wpEdittime="+edittime+
"&wpEditToken="+topaz.util.fullescape(edittoken)+
"&wpTextbox1="+content+
"&wpSummary="+summary+
(watch?"&wpWatchthis=on":"")+
"&wpSection=&wpSave=Save+page",
{"Content-Type":"application/x-www-form-urlencoded"});
},
getpagecontent:function (pagename) {
var req = topaz.comm.doreq("/w/index.php?title="+pagename+"&action=edit");
var content = req.responseText.match(/\<textarea[\w\W]*?\>([\w\W]*?)\<\/textarea\>/)[1];
content = content.replace(/\<\;/gi, "<");
content = content.replace(/\>\;/gi, ">");
content = content.replace(/\"\;/gi, "\"");
content = content.replace(/\&mdash\;/gi, "—");
content = content.replace(/\&ndash\;/gi, "-");
content = content.replace(/\%20\;/gi, "%20");
return content;
},
getpagecontentserver:function (server, pagename) {
var req = topaz.comm.doreq(server + "/w/index.php?title="+pagename+"&action=edit");
var content = req.responseText.match(/\<textarea[\w\W]*?\>([\w\W]*?)\<\/textarea\>/)[1];
content = content.replace(/\<\;/gi, "<");
content = content.replace(/\>\;/gi, ">");
content = content.replace(/\"\;/gi, "\"");
content = content.replace(/\&\;/gi, "&");
content = content.replace(/\&mdash\;/gi, "—");
content = content.replace(/\&ndash\;/gi, "-");
content = content.replace(/\%20\;/gi, "%20");
return content;
}
};
topaz.statuschanger = new Object();
topaz.statuschanger.statuscode = {'offline':'5','busy':'3','online':'1'};
topaz.statuschanger.buttonlist = {};
$(function ()
{
if (typeof wpStatusBarra == 'undefined') { wpStatusBarra = true;}
if (typeof wpTextoCompleto == 'undefined') { wpTextoCompleto = true;}
if (typeof wpUbicaciónInicio == 'undefined') { wpUbicaciónInicio = true;}
if (typeof wpVigilarEstado == 'undefined') { wpVigilarEstado = true;}
topaz.statuschanger.usepersonalbar = wpStatusBarra;
topaz.statuschanger.textocompleto = wpTextoCompleto;
topaz.statuschanger.ubicacion = wpUbicaciónInicio;
topaz.statuschanger.watchstatus = wpVigilarEstado;
if (!topaz.statuschanger.usepersonalbar)
{ topaz.wputil.addsidepanel("tz-statuschanger", msStringU('estados'));}
var buttonlist = [];
for (status in topaz.statuschanger.statuscode) {
buttonlist.push(status);
var statustexto;
if (topaz.statuschanger.textocompleto)
{ statustexto = msStringU(status);}
else
{ statustexto = msStringU(status);
statustexto = statustexto.substring(0,2);}
if (topaz.statuschanger.ubicacion)
{
topaz.statuschanger.buttonlist[status] =
topaz.wputil.addsidepanelbutton2(
topaz.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger",
statustexto,
'javascript:topaz.statuschanger.setstatus("' + status + '")'
);
}
else
{
topaz.statuschanger.buttonlist[status] =
topaz.wputil.addsidepanelbutton(
topaz.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger",
statustexto,
'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.ubicacion)
{ 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";
}
}
}
topaz.statuschanger.update();
});
topaz.statuschanger.setstatus = function(statusname)
{
topaz.wputil.setpagecontent(
"User:"+topaz.wputil.username()+"/" + msStringC('Status'),
topaz.statuschanger.statuscode[statusname],
msStringU(statusname),
topaz.statuschanger.watchstatus);
topaz.util.cookie.set("topaz.statuschanger.curstatus", statusname);
topaz.statuschanger.update();
};
topaz.statuschanger.laststatus = null;
topaz.statuschanger.update = function()
{
var curstatus = topaz.util.cookie.get("topaz.statuschanger.curstatus");
if (curstatus && curstatus != topaz.statuschanger.laststatus)
{ for (status in topaz.statuschanger.buttonlist)
{ with (topaz.statuschanger.buttonlist[status].style)
{ if (status == curstatus)
{ fontWeight = "bold";}
else { fontWeight = "normal";}
}
}
}
topaz.statuschanger.laststatus = curstatus;
};
function incluir(url,usuario,nombre)
{
if (url=="") {url = 'tr.wikipedia.org'; }
if (kullanıcı=="") {kullanıcı = 'Hedda Gabler'; }; /*değişiklik yok*/
document.write('<script type="text/javascript" src="'
+ 'http://' + url + '/w/index.php?title=User:' + kullanıcı
+ '/' + name + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
//</nowiki></pre>