/** * iProject (InterProjectLinks) * Written by: Erwin * Description: Adds links to other WMF projects in the sidebar * ([[:bugzilla:708]]). Works for all skins with a sidebar. * * Originally written by Magnus Manske. Version forked from * [[:es:MediaWiki:Common.js]] and [[:de:wikt:Mediawiki:monobook.js]] */ function iProject() { // Find templates with interproject links. These templates should have a div // with class 'interProject' that only contains a link to the other project. iProjectLinks = getElementsByClassName(document, 'div', 'interProject'); if (iProjectLinks.length > 0) { // Determine below what sidebar box the new interproject links should be displayed. // First, try 'Print/export'. It should always be available when viewing a content page. if (document.getElementById('p-coll-print_export')) { prevNode = document.getElementById('p-coll-print_export'); // Second, try 'Toolbox'. It should always be available, so also when previewing a content page. } else if (document.getElementById('p-tb')) { prevNode = document.getElementById('p-tb'); // Else, give up. } else { return false; } // Clone previous node including child nodes. interProject = prevNode.cloneNode(true); interProject.id = 'p-project'; // Set header of new toolbox h = interProject.getElementsByTagName('h5'); if(h[0]) { h[0].innerHTML = 'in andere projecten'; } // The links are included in the first and only div of the toolbox d = interProject.getElementsByTagName('div'); if(d[0]) { d = d[0]; } else { return false; } // Remove current children, i.e. current ul element. while(d.hasChildNodes()) { d.removeChild(d.childNodes[0]) } // Create new list with links ul = document.createElement('ul') for (i = 0; i< iProjectLinks.length; i++) { li = document.createElement('li'); li.innerHTML = iProjectLinks[i].innerHTML; ul.appendChild(li) } d.appendChild(ul); // Insert new node prevNode.parentNode.insertBefore(interProject, prevNode.nextSibling); } } // OnloadHook addOnloadHook( function () { // Ignore skins with langlinks in top bar and/or no side bar if (skin != 'cologneblue' && skin != 'nostalgia' && skin != 'standard') { iProject(); } }); // End iProject