User:Remember the dot/monobook.js

// /* Prints all subpages of a text at once */ function printText {   //get list of subpages var apiRequest = new XMLHttpRequest apiRequest.open("GET", mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/api.php?format=xml&action=query&list=allpages&apprefix=" + wgPageName + "/", false) apiRequest.send(null) //axe the current body content except for "From Wikisource" (siteSub) var content = document.getElementById("content") var bodyContent = document.getElementById("bodyContent") var siteSub = document.getElementById("siteSub") bodyContent.removeChild(siteSub) content.replaceChild(siteSub, bodyContent) //dump in the subpages var subpageTitles = apiRequest.responseXML.evaluate("/api/query/allpages/p/@title", apiRequest.responseXML, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) for (var i = 0; i < subpageTitles.snapshotLength; i++) {       var pageRequest = new XMLHttpRequest pageRequest.open("GET", mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + encodeURI(subpageTitles.snapshotItem(i).textContent), false) pageRequest.overrideMimeType('text/xml'); pageRequest.send(null) pageRequest.responseXML.getElementById("siteSub").style.display = "none" pageRequest.responseXML.getElementById("contentSub").style.display = "none" //pageRequest.responseXML.getElementsByClassName("printfooter")[0].style.display = "none" pageRequest.responseXML.getElementById("catlinks").style.display = "none" content.appendChild(pageRequest.responseXML.getElementById("bodyContent")) } }

function setUpTextPrint {   document.getElementById("p-tb").getElementsByTagName("div")[0].getElementsByTagName("ul")[0].innerHTML += "Print entire text" }

$(setUpTextPrint)

/* Preload Template:Header2 when adding a new text */ function preloadHeaderTemplate {   var wpTextbox1 = document.getElementById("wpTextbox1") if (wpTextbox1.value == "") {       //fill in header template var subpageDepth = 0 var isSubpage var pathToTOC = "" //typically "../" var subpageTitle var subpageTitleRegExp var rawBasePageRequest var tocPageTitle var beginningOfShortSectionTitle //for example, if tocPageTitle == "Democracy in America/Volume 2", then beginningOfShortSectionTitle == "Volume 2, " - this is used to determine the values for "previous" and "next" var rawTocPageRequest //table of contents page var rawTocPageWithoutHeader //title var wpTextbox1value = "\n\n" } }

/* Preload Template:Textinfo when starting a discussion page */ function preloadTextinfoTemplate {   var wpTextbox1 = document.getElementById("wpTextbox1") if (wpTextbox1.value == "") {       wpTextbox1.value = "\n" } }

/* Preload Template:Author when starting an author page */ function preloadAuthorTemplate {   var wpTextbox1 = document.getElementById("wpTextbox1") if (wpTextbox1.value == "") {       wpTextbox1.value = "\n\n==Works==\n\n" } }

if (wgAction == "edit") {   switch (wgNamespaceNumber) {       case 0: //main addOnloadHook(preloadHeaderTemplate) break case 1: //Talk addOnloadHook(preloadTextinfoTemplate) break case 102: //Author addOnloadHook(preloadAuthorTemplate) } } //