User:Brandizzi/showrevid.js

// This simple script adds the current revision id to the page subtitle. //   -- User:Brandizzi

function showCurrentRevisionId { // It can be null if e.g. the page is special and does not have versions. if (wgCurRevisionId > 0) { var revIdInfo = document.createTextNode(' (revision ' + wgCurRevisionId + ')'); var subtitleElement = document.getElementById('siteSub'); if (subtitleElement) { var newSubtitle = document.createTextNode(subtitleElement.firstChild.nodeValue + revIdInfo.nodeValue); subtitleElement.replaceChild(newSubtitle, subtitleElement.firstChild); }       var toolsElement = document.getElementById('t-permalink').parentNode.parentNode; if (toolsElement) { toolsElement.appendChild(revIdInfo); }   } } function addOnloadHookIfAvailable(f) { if (typeof addOnloadHook == "undefined") { console.info("addOnloadHook not available"); return; }   addOnloadHook(f); }

addOnloadHookIfAvailable(showCurrentRevisionId);