Jump to content

User:Isnow/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//Reference: http://meta.wikimedia.org/wiki/User:Fristu/monobook.js

function morelangs() {
  var langs = document.getElementById('p-lang').getElementsByClassName('body')[0].cloneNode(true);
  // don't use the same ids twice
  langs.id = 'mylangs';

    var listitems = langs.getElementsByTagName('LI');
    for (i=0;i<listitems.length;i++) {
      if (listitems[i].classList.contains('interwiki-de')
        || listitems[i].classList.contains('interwiki-en')
        || listitems[i].classList.contains('interwiki-fr')
        || listitems[i].classList.contains('interwiki-ja')
        || listitems[i].classList.contains('interwiki-ko')
        || listitems[i].classList.contains('interwiki-zh')) {
        listitems[i].className = 'mylangs-show';
        listitems[i].style = '';
      }
      else {
      	listitems[i].className = 'mylangs-none';
      }
    }
 
    var edititem = langs.getElementsByClassName('wb-langlinks-edit wb-langlinks-link');
    edititem[0].className = 'mylangs-none';
    
  // drop them at the bottom of the content area
  if (document.getElementById('column-content') !== null) {
    document.getElementById('column-content').appendChild(langs);
  } // current version
  if (document.getElementById('content') !== null) {
    document.getElementById('content').appendChild(langs);
  } // beta version
}
if (window.addEventListener) window.addEventListener("load",morelangs,false);
else if (window.attachEvent) window.attachEvent("onload",morelangs);