Created
August 2, 2012 03:47
-
-
Save junaidpv/3233155 to your computer and use it in GitHub Desktop.
Interproject links part from common.js of ml wiki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
== Interproject links == | |
<pre> */ | |
function Projectlinks() { | |
var elements = new Array(); | |
var spans = document.getElementsByTagName('span'); | |
// filter for projectlinks | |
for (var i=0, j=0; i<spans.length; i++) { | |
if (spans[i].className == 'interProject') { | |
elements[j] = spans[i].getElementsByTagName('a')[0]; | |
j++; | |
} | |
} | |
if (j) { | |
// create navbox | |
var plheader = document.createElement('h5'); | |
plheader.appendChild(document.createTextNode('In other projects')); | |
var plbox = document.createElement('div'); | |
plbox.setAttribute('class','pBody'); | |
plbox.setAttribute('style','margin-top:0.7em;'); | |
var pllist = document.createElement('ul'); | |
// append | |
for (var i=0; i<elements.length; i++) { | |
var plitem = document.createElement('li'); | |
plitem.appendChild(elements[i]); | |
pllist.appendChild(plitem); | |
} | |
plbox.appendChild(plheader); | |
plbox.appendChild(pllist); | |
document.getElementById("p-tb").appendChild(plbox); | |
} | |
} | |
$(Projectlinks); | |
/* </pre> */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment