User:Logicalthinker33/vector.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin can be added at User:Logicalthinker33/vector.css. |
// include the Luasóg framework
importScript('User:Luasóg bot/framework.js');
// wait for the page to load
window.onload = function(){
// instantiate an instance of Luasog pointing at the en.wiki API
var luasog = new Luasog("http://en.wikipedia.org/w/api.php");
// set up the callback function
var callback = function(data){
// add the number of edits for this user to the inner HTML of the contributions link
document.getElementById("pt-mycontris").innerHTML =
document.getElementById("pt-mycontris").innerHTML.replace
("</a>", " ("+data.query.userinfo.editcount+")</a>");
};
// request the edit count for this use and call callback when done
luasog.request({action:"query", meta:"userinfo", uiprop:"editcount"}, callback);
};
// Adds a "Replace" tab which pops up two prompt boxes; one for a regexp and one for a replacement
function wpTextboxReplace()
{
var s = prompt("Search regexp:");
if(s){
var r = prompt("Replace /"+s+"/ with:");
if(!r && r != '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "mg"), r);
}
}
addOnloadHook(function () {
if (document.forms.editform) {
addPortletLink('p-cactions', 'javascript:wpTextboxReplace()', 'Replace', 'ca-replace',
'Regexp replace for the edit window', 'R', document.getElementById('ca-history'));
}
});
//