Usuari:Joancreus/proves.js: diferència entre les revisions

De Viccionari
Contingut suprimit Contingut afegit
Cap resum de modificació
m ja no sóc Pasqual
Línia 3: Línia 3:
* Show interwiki link in language section *
* Show interwiki link in language section *
* By [[ca:wikt:User:Joancreus]] *
* By [[ca:wikt:User:Joancreus]] *
* Thanks to [[ca:wikt:User:Pasqual]] *
* Thanks to [[ca:wikt:User:Coet]] *
* *
* *
*****/
*****/

Revisió del 21:13, 10 nov 2010

/******
 *
 * Show interwiki link in language section  *
 * By [[ca:wikt:User:Joancreus]]            *
 * Thanks to [[ca:wikt:User:Coet]]       *
 *                                          *
                                        *****/
 
function showInterwiki(){
   var b = document.getElementById("p-lang");
   try {
      var ul = b.getElementsByTagName("ul")[0].getElementsByTagName('li');
      for (i in ul) {
         if (ul[i].className != "undefined") {
            try {
               lang = ul[i].className.split('-')[1]
               document.getElementById(lang).innerHTML += '<sup><small> <a ' +
                 'href="http://' + lang +'.wiktionary.org/wiki/' + encodeURIComponent(wgPageName) + '" ' +
                 'class="extiw" title="' + lang + ':' + wgPageName + '">('+ lang +')</a></small></sup>';
            } catch(err){}
         }
      }
   } catch(err){}
}
if (wgNamespaceNumber == 0) {addOnloadHook (showInterwiki);}