User:Aquilosion/monobook.js

function setSearchBox { // Makes the search box into a proper OS X search box in Safari... var start = document.getElementById("searchInput").selectionStart; var end = document.getElementById("searchInput").selectionEnd; document.getElementById("searchInput").setAttribute("type","search"); document.getElementById("searchInput").setAttribute("placeholder","Search..."); document.getElementById("searchInput").setAttribute("autosave","com.wikipedia"); document.getElementById("searchInput").setAttribute("results","10"); if (document.getElementById("searchInput").value.length > 0) { document.getElementById("searchInput").focus; document.getElementById("searchInput").selectionStart = start; document.getElementById("searchInput").selectionEnd = end; }	document.getElementById("searchGoButton").style.display = "none"; document.getElementById("mw-searchButton").style.display = "none"; document.getElementById("siteNotice").style.display = "none"; }

function toggleRefs { // Hides (or unhides) references in Wikipedia pages, useful for speech... for (var i = document.getElementsByTagName("sup").length - 1; i >= 0; i--) { if (document.getElementsByTagName("sup")[i].getAttribute("class") == "reference") { document.getElementsByTagName("sup")[i].style.display = document.getElementsByTagName("sup")[i].style.display == "none" ? "" : "none"; }	} }

function addToggleRefsLink { // Adds a link to the top of the Wikipedia page, under the title, to toggle the references... document.getElementById("contentSub").innerHTML += " Toggle References"; toggleRefs; // Let's switch them off by default. }

function windowLoaded { setSearchBox; //	toggleRefs; addToggleRefsLink; } window.onload = windowLoaded;