Jump to content

User:Zocky/LanguageLinks.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Zocky (talk | contribs) at 12:40, 20 August 2007 (Created page with 'importStylesheet('User:Zocky/LanguageLinks.css'); addOnloadHook(function() { langs = document.getElementById('p-lang'); if(langs) { var lis=langs.getElement...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
importStylesheet('User:Zocky/LanguageLinks.css');
addOnloadHook(function() {
  langs = document.getElementById('p-lang');
  if(langs) {
    var lis=langs.getElementsByTagName('li');
    for (var i=0;i<lis.length;i++) {
      lnk=lis[i].firstChild;
      if(lnk.href.replace(/^.*?\/wiki\//,'')!='')
        lnk.innerHTML = '<span class="lang-name">' + lnk.href.replace(/(^http:\/\/|\..*$)/g,'') + ':</span>'
                      + '<span class="lang-foreign">'+decodeURI(lnk.href.replace(/^.*?\/wiki\//,'').replace(/_/g,' '))+'</span>';
    };
  };
});