User:Thestorm042/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 googleCustomSearchExecute { tabbedSC.execute(document.getElementById('gSearchInput').value); }; function googleCustomSearchClear { tabbedSC.clearAllResults; }; function OnLoad { var dResults = document.createElement("div"); dResults.setAttribute("id", "search_control_tabbed"); dResults.className = '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.style.width = '90%'; iQ.setAttribute("id", "gSearchInput"); var iSB = document.createElement("input"); iSB.setAttribute("name", "sa"); iSB.setAttribute("type", "button"); iSB.setAttribute("value", "Search"); iSB.setAttribute("id", "gSearchButton"); iSB.onclick = googleCustomSearchExecute; var dClear = document.createElement("span"); dClear.className = 'cse-clear-button'; dClear.setAttribute("title", "clear results"); dClear.onclick = googleCustomSearchClear; dClear.appendChild(document.createTextNode("Clear")); var fSearch = document.createElement("form"); fSearch.setAttribute("id", "searchbox_cse"); fSearch.appendChild(iQ); fSearch.appendChild(document.createElement("br")); 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.style['margin-bottom'] = '3px'; d2.style['text-align'] = 'center'; d2.style['padding'] = '0.5em 0.4em 0.4em'; d2.className = 'pBody'; d2.appendChild(fSearch); d2.appendChild(scriptB); var dSBox = document.createElement("div"); dSBox.setAttribute("id", "p-refSearch"); dSBox.className = 'generated-sidebar 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); } );