User:JimTittsler/links and iframes.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 weSelectMe(node) { 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; } }

addOnloadHook( function { var plink = document.getElementById("t-permalink");  if (wgArticleId && plink) {    var permanent_link = wgScript + '?oldid=' + wgCurRevisionId;    var short_url = wgScript + '?curid=' + wgArticleId;    plink.innerHTML = ['Links'     , ''      , 'Permanent Link'      , 'IFrame snippet to this revision: '      , '&lt;iframe src="' + wgServer + permanent_link + '" width="100%" height="300"&gt;&lt;/iframe&gt; '      , 'Short URL' , 'IFrame snippet to this page: ' , '&lt;iframe src="' + wgServer + short_url + '" width="100%" height="300"&gt;&lt;/iframe&gt; </li>' , '</ul>' ].join(''); } } );