User:ManuelGR/monobook.js

/** * rechercher les éléments de la page dont le paramètre "class" est celui recherché * http://developer.mozilla.org/en/docs/DOM:document.getElementsByClassName */ function getElementsByClass(searchClass,node,tag) { if ( node == null ) node = document; if ( tag == null ) tag = '*'; return getElementsByClassName(node, tag, searchClass); }

/** * Change the presentation of the page title. * * @todo : http://fr.wikibooks.org/wiki/Eros * @author : DavidL, Tavernier (rewrite) */ function setupTitle { if ( (wgAction != 'view')        || wgNamespaceNumber  //only on main space (0)       || document.getElementById('contentSub2')  ) //while the page is deleted, avoiding to catch the "N revisions deleted" return false; var title = getElementsByClass("firstHeading")[0]; var hasInnerText = (title.innerText != undefined); //IE hack stuff saveTitle = hasInnerText ? title.innerText : title.textContent; var subpages = getElementsByClass("subpages"); if (subpages == "") // return if it's not a subpage return false; var links = subpages[0].getElementsByTagName("a"); title.innerHTML = ""; var endTitle = ""; for (var subpage=0; subpage" + textContent + "\n " endTitle += textContent + "/"; }   endTitle = saveTitle.replace(endTitle, ""); title.innerHTML += endTitle; //a wgSubPageName should be more convenient... subpages[0].textContent = saveTitle; // for copypaste the full title (bonus) subpages[0].innerText = saveTitle; //hack } if ( typeof ( g_setuptitle ) == "undefined" ) addOnloadHook(setupTitle);