User:ErrantX/emailuser.js

function emailuser {

if (mw.config.get('wgNamespaceNumber') == 2 | mw.config.get('wgNamespaceNumber') == 3) {   var start = document.title.indexOf(":") + 1; var end = document.title.indexOf("/"); if (end != -1) {       var user = document.title.slice(start,end); }   else {       var user = document.title.slice(start).replace(" - Wikipedia, the free encyclopedia",""); }   var img = mw.html.element("img",{src:'//upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Email_go.png/15px-Email_go.png'}); addPortletLink ("p-views", "//en.wikipedia.org/wiki/Special:EmailUser/"+user, "", "email-user", "Email this user"); document.getElementById("email-user").firstChild.firstChild.innerHTML = img; } }

$(function { emailuser ; });