User:Coopuser/monobook.js

document.write(' '); var crefDomain = "googlecustomsearch.appspot.com/wikipedia/domain_spec.do?url=" + encodeURIComponent(window.location.href); var crefUrl = "googlecustomsearch.appspot.com/wikipedia/spec.do?url=" + encodeURIComponent(window.location.href); var tabbedSC; function OnLoad { var dResults = document.createElement("div"); dResults.setAttribute("id", "search_control_tabbed"); dResults.setAttribute("class", "search-control"); var bodyContent = document.getElementById("bodyContent"); if (bodyContent.hasChildNodes) { var children = bodyContent.childNodes; var found = false; var foundi = 0; for (var i = 0; i < children.length && !found; i++) { found = "p" == children.item(i).nodeName || "P" == children.item(i).nodeName; foundi = i;       } if (found) { bodyContent.insertBefore(dResults, children.item(foundi)); }else{ bodyContent.insertBefore(dResults, children.item(0)); }   }else{ bodyContent.appendChild(dResults); }   var iQ = document.createElement("input"); iQ.setAttribute("name", "q"); iQ.setAttribute("type", "text"); iQ.setAttribute("size", 18); var iSB = document.createElement("input"); iSB.setAttribute("name", "sa"); iSB.setAttribute("type", "submit"); iSB.setAttribute("value", "Search"); iSB.setAttribute("id", "gSearchButton"); var dClear = document.createElement("div"); dClear.setAttribute("class", "cse-clear-button"); dClear.setAttribute("title", "clear results"); dClear.setAttribute("onclick", "window.tabbedSC.clearAllResults"); dClear.appendChild(document.createTextNode("Clear")); var fSearch = document.createElement("form"); fSearch.setAttribute("id", "searchbox_cse"); fSearch.setAttribute("action", "javascript(return(false))"); fSearch.setAttribute("onsubmit", "window.tabbedSC.execute(this.q.value); return(false)"); fSearch.appendChild(iQ); fSearch.appendChild(iSB); fSearch.appendChild(dClear); var scriptB = document.createElement("script"); scriptB.setAttribute("type", "text/javascript"); scriptB.setAttribute("src", "http://www.google.com/coop/cse/brand?form=searchbox_cse"); var h = document.createElement("h5"); h.appendChild(document.createTextNode("search")); var d2 = document.createElement("div"); d2.setAttribute("style", "margin-bottom:3px; text-align:center;padding:0.5em 0.4em 0.4em;"); d2.setAttribute("class", "pBody"); d2.appendChild(fSearch); d2.appendChild(scriptB); var dSBox = document.createElement("div"); dSBox.setAttribute("id", "p-refSearch"); dSBox.setAttribute("class", "portlet"); dSBox.appendChild(h); dSBox.appendChild(d2); var searchdiv = document.getElementById("p-search"); var columndiv = document.getElementById("column-one"); //replace the default search box with custom search columndiv.replaceChild(dSBox,searchdiv); // create a tabbed mode search control tabbedSC = new GSearchControl; // Site Restrict to CSE ID   var searcher = new GwebSearch; searcher.setSiteRestriction({crefUrl : crefDomain}, null, null); searcher.setUserDefinedLabel("All Wikipedia pages"); tabbedSC.addSearcher(searcher); searcher = new GwebSearch; searcher.setSiteRestriction({crefUrl : crefUrl}, "internal", null); searcher.setUserDefinedLabel("Linked Wikipedia pages"); tabbedSC.addSearcher(searcher); searcher = new GwebSearch; searcher.setSiteRestriction({crefUrl : crefUrl}, "external", null); searcher.setUserDefinedLabel("Linked non-Wikipedia pages"); tabbedSC.addSearcher(searcher); tabbedSC.setResultSetSize(GSearch.LARGE_RESULTSET); // draw in tabbed layout mode var drawOptions = new GdrawOptions; drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED); tabbedSC.draw(document.getElementById("search_control_tabbed"), drawOptions); // Preload crefs function appendCSECrefPreloadImage(parent, url) { var preload_base = 'http://www.google.com/'; var preload_path = 'cse/tools/ping?cref='; var img = document.createElement('img'); img.src = preload_base + preload_path + encodeURIComponent(url); parent.appendChild(img); }   var cse_preloader = document.createElement('div'); cse_preloader.id = 'cse_cref_preloader'; cse_preloader.style.display = 'none'; appendCSECrefPreloadImage(cse_preloader, crefDomain); appendCSECrefPreloadImage(cse_preloader, crefUrl); document.getElementById('footer').appendChild(cse_preloader); } addOnloadHook( function {   GSearch.setOnLoadCallback(OnLoad); } );