MediaWiki:Gadget-Links.js

/* add Links button with permanent link, short link, and iframe snippets for each * 2010-12-21 http://WikiEducator.org/User:JimTittsler * short links derived from commons:Bugzilla:021572 -- commons:meta:user:Platonides */ $( function {	var plink = document.getElementById("t-permalink");

if (wgArticleId && plink) { var permanent_link = wgScript + '?oldid=' + wgCurRevisionId; var short_url = wgScript + '?curid=' + wgArticleId; var height = document.getElementById('content').offsetHeight; plink.innerHTML = ['Links' , '' , 'Permanent Link' , 'IFrame snippet to this revision: ' , ' &lt;iframe src="' + wgServer + permanent_link + '" width="100%" height="'		, height			, '"&gt;WikiEducator &lt;/iframe&gt; ' , 'Short URL' , 'IFrame snippet to this page: ' , '&lt;iframe src="' + wgServer + short_url + '" width="100%" height="'		, height			, '"&gt;WikiEducator &lt;/iframe&gt; ' , '</ul>' ].join(''); // copy to clipboard on click $('.weLinkSelect').click(function {			var node = $(this)[0];			var selection, range, doc, win;			if ((doc = node.ownerDocument) && (win=doc.defaultView) && typeof win.getSelection != 'undefined' && typeof doc.createRange != 'undefined' && (selection = window.getSelection) && typeof selection.removeAllRanges != 'undefined') {				range = doc.createRange;				range.selectNode(node);				selection.removeAllRanges;				selection.addRange(range);			} else if (document.body && typeof document.body.createTextRange != 'undefined' && (range = document.body.createTextRange)) { /* IE */				range.moveToElementText(node);				range.select;			}		}); } } );