User:XcruftX/monobook.js

$(add_links);

function add_links { mw.util.addPortletLink('p-cactions', 'javascript:foo', 'foo'); }

function foo { alert("foo"); }