User:JimTittsler/googlesearch.js

/* createGoogleSearch */ addOnloadHook(function {    var g = document.getElementById('searchform');    var output = document.createElement('div');    output.innerHTML = '   ';    g.appendChild(output);    if (skin == 'vector') {        var p = document.getElementById('p-search');        p.style.marginTop = '-1.5em';        var s = document.styleSheets;        for(i=s.length-1; i>=0; i--) {            var rules = s[i].cssRules ? s[i].cssRules : s[i].rules; for(j=0; j<rules.length; j++) { if(rules[j].selectorText && rules[j].selectorText.toLowerCase.indexOf('#p-search form') != -1) { rules[j].style.margin='0.25em 0 0'; i = 0; break; }           }        }    } });

/* showGoogleResults */ addOnloadHook(function {  if (wgPageName == "WikiEducator:Google_Search") {    var g = document.getElementsByTagName("head")[0];    var inlscript = document.createElement('script');    inlscript.type = 'text/javascript';    inlscript.innerHTML = 'var googleSearchIframeName = "cse-search-results";var googleSearchFormName = "cse-search-box";var googleSearchFrameWidth = 600;var googleSearchDomain = "www.google.com";var googleSearchPath = "/cse";';    g.appendChild(inlscript);    var resscript = document.createElement('script');    resscript.type = 'text/javascript';    resscript.src = "http://www.google.com/afsonline/show_afs_search.js";    g.appendChild(resscript);    g = document.getElementById('catlinks');    if (g) {      g.style.display = 'none';    }  } });