User:Ilmari Karonen/fancysubpagetitle.js

// RENDER BASE PAGE NAMES OF SUBPAGES IN SMALLER FONT // (proof-of-concept test for discussion on wikitech-l)

if (wgNamespaceNumber > 0 && wgPageName.indexOf("/") >= 0) { appendCSS(       "h1 span.fancysubpagetitle-slash { padding-left: 0.5em; padding-right: 0.5em; }\n" +        "h1 span.fancysubpagetitle-base { font-size: 53%; line-height: 100%; color: #777; display: block; }\n" +    "") addOnloadHook(function {        var heading = document.getElementsByTagName("h1")[0]        var pieces = wgPageName.replace(/_/g, " ").split("/")        var lastpiece = pieces.pop

var divider = document.createElement("span") divider.className = "fancysubpagetitle-slash" divider.appendChild(document.createTextNode("/"))

var basepath = document.createElement("span") basepath.className = "fancysubpagetitle-base"

for (var i = 0; i < pieces.length; i++) { basepath.appendChild(document.createTextNode(pieces[i])) basepath.appendChild(divider.cloneNode(true)) }

heading.innerHTML = "" heading.appendChild(basepath) heading.appendChild(document.createTextNode(lastpiece)) }) }