User:Acagastya/title.js

$.when( mw.loader.using( [ 'mediawiki.util'] ), $.ready ).done( function { var portletlink = mw.util.addPortletLink('p-tb', '#', '', 'ca-copytitle', 'Copy page Title', 'a');  $(portletlink).click( function(e) { e.preventDefault; var range = document.createRange; range.selectNode(document.getElementById('firstHeading')); window.getSelection.addRange(range); document.execCommand("copy"); }); });