Bruger:SimmeD/Scripts/brugerInformation.js

Fra Wikipedia, den frie encyklopædi
var userInfo_script= function()
{
 var username = encodeURIComponent( mw.config.get('wgTitle') );
 var url = "http://www.da.wikipedia.org/w/api.php?action=query&list=users&ususers="+username+"&usprop=blockinfo|groups|editcount|registration|emailable|gender"
window.location = url;
}

// Add the tool on the "værktøjer" list
function linkuserInfomra() {
 if (document.getElementById("t-userInfomra")) return;
 var li_current = document.getElementById("t-autolist");
// if (!li_current) return;
 var li_next = li_current.nextSibling;
 var ul_node = li_current.parentNode;
 var li = document.createElement("li");
 li.setAttribute("id", "t-userInfomra");
 li.setAttribute("title", "Se information bruger.");
 li.appendChild(document.createElement("a"));
 li.firstChild.appendChild(document.createTextNode("Bruger Information"));
 ul_node.insertBefore(li, li_next);
}

$(linkuserInfomra());
document.getElementById('t-autolist').onclick = userInfo_script;