// ######################### A Greasemonkey script that restores // # Google Cleanup Script # Google's "classic" user interface to // ######################### its former glory. // // -------------------------------------------------------------------- // Copyright © 2011 Alexander Rosenberg. All Rights Reserved // -------------------------------------------------------------------- // // This is a Greasemonkey user script. To install this script, you // need Greasemonkey version 0.3 or later. To get Greasemonkey, or // for more information go to http://greasemonkey.mozdev.org/ // Greasemonkey is a Mozilla Firefox add-on that allows users to // make on-the-fly changes to HTML web page content through the use // of JavaScript. Greasemonkey scripts can add new functions to web // pages, fix rendering bugs, combine data from multiple webpages, // or perform numerous other functions. // // -------------------------------------------------------------------- // // ## Greasemonkey Metadata ########################################### // ==UserScript== // @name Google Cleanup Script // @namespace http://myjumbledweb.com/ // @description Restore Google's "classic" user interface. // @include http*://google.*/* // @include http*://*.google.*/* // @exclude // @version 1.7g // @history 1.7g Critical Bugfix: fixed footer code that caused entire script to fail // @history 1.7g Minor Revision: corrected color of "cached" and "similar" links // @history 1.7f Addition: put back the "cached" and "similar" links // @history 1.7e Bugfix/Revision: fixed layout issues in Google Images // @history 1.7e Revision: extended Google service detection // @history 1.7d Bugfix/Revision: updated detection of the homepage logo // @history 1.7c Bugfix/Revision: corrected result page layout issues // @history 1.7b Minor Bugfix: fixed the search results page google logo // @history 1.7 Revision: script now restores the icons to the sidebar // @history 1.7 Bugfix: removed empty space below search box on search results page // @history 1.7 Revision: extended/broadened site compatibility with Google services // @history 1.7 Revision: added multilingual support for Google service detection // @history 1.7 Bugfix/Revision: Instant hp layout now used on local Google sites // @history 1.7 Revision: for some results, URLs would remain above excerpt text // @history 1.6i Minor Bugfix: corrected the appearance of the blue search button // @history 1.6h Bugfix: corrected error from revision 1.6g with homepage layout // @history 1.6g Bugfix/Revision: use standard hp layout for special Google logos // @history 1.6f Minor Revision: fixed spacing below search form on results page // @history 1.6e Bugfix/Revision: fixed compatibility with www.google.com.au // @history 1.6d Minor Bugfix: fixed Advanced Search link on search results page // @history 1.6c Revision: search results page no longer has centered layout // @history 1.6c Bugfix: search suggestions were sometimes offset downward // @history 1.6c Minor Bugfix: corrected positioning of Advanced Search link // @history 1.6c Minor Bugfix: hp search buttons would loose border on hover // @history 1.6b Bugfix: result URLs no longer switch back and forth // @history 1.6a Minor Revisions: Pre-release code-cleanup // @history 1.6 Major Revisions: code substancially rewritten // @history 1.6 Major Bufixes: fixed numerous bugs & errors // @history 1.6 Major Bufix: introduced workaround for bug #1320 // @history 1.5e Minor Revision: adjusted homepage layout spacing // @history 1.5d Bugfix: corrected an error with the homepage layout code // @history 1.5c Bugfix/Revision: fixed homepage layout with special logos // @history 1.5b Bugfix: script failed with different Google logo // @history 1.5a Pre-release code-cleanup, corrections, and bugfixes // @history 1.5 Bugfix/Revision: XMLHttpRequest readystate detection // @history 1.5 Minor Addition: adjust spacing of search results // @history 1.5 Bugfix: script failed on some pages with thumbnails // @history 1.5 Minor Addition: adjust search result page logo // @history 1.5 Minor Addition: correct navbar menu's list-item spacing // @history 1.5 Minor Addition: correct spacing of sidbar search options // @history 1.4d Minor Bugfixes: fixed footer + corrected hp logo spacing // @history 1.4c Bugfix: Google UK homepage now displays properly // @history 1.4b Minor Addition: restore the search-box border-colors // @history 1.4a Pre-release code-cleanup, minor corrections, and bugfixes // @history 1.4 Major Bugfix: script now works properly with Google Instant // @history 1.3b Bugfix: script failed on some pages with advertisements // @history 1.3 Revision: partially fixed compatability with Google Instant // @history 1.2c Bugfix: script failed on some pages with thumbnails // @history 1.2b Minor Revision: adjusted border color // @history 1.2 New Feature: restore colorful sidebar icons // @history 1.1 Integrated navbar restoration script. // @history 1.00 Initial release // ==/UserScript== // #################################################################### if (typeof(GM_log) == "function") {GM_log('Google Cleanup GreaseMonkey Script Loaded');} /* Uncomment the following line to make this script work in GreaseKit for Safari */ // if (typeof(unsafeWindow)!="object") {var unsafeWindow = window;} function log(msg,level) { if (typeof(GM_log) == "function") { GM_msg = '[Google Cleanup]: '+msg; if (level == 'info') { GM_log(GM_msg,0); } else if (level == 'warn') { GM_log(GM_msg,1); } else if (level == 'error' | level == 'exception') { GM_log(GM_msg,2); } else if (typeof(level) == "string") { GM_log(level+' '+GM_msg); } else {GM_log(GM_msg);} } else if (typeof(console) == "object") { if (level == 'debug') { console.debug(msg); } else if (level == 'info') { console.info(msg); } else if (level == 'warn') { console.warn(msg); } else if (level == 'error') { console.error(msg); } else if (level == 'exception') { console.exception(msg); } else if (typeof(level) == "string") { console.log(level+': '+msg); } else {console.log(msg);} } } function getElementsByClassName(classname,node) { if (node == null) {node = document;} // use native implementation if available if (node.getElementsByClassName) {return node.getElementsByClassName(classname);} else { return ( // Dustin Diaz method function getElementsByClass(searchClass,node) { var classElements = [], // same as: new Array() els = node.getElementsByTagName("*"), pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i=0, j=0; i<els.length; i++) { if (pattern.test(els[i].className)) {classElements[j] = els[i]; j++;} } return classElements; } )(classname,node); } } function hasHash() { // (added in 1.7) return (document.location.hash != ""); } function parseGetVars(qString) { var getVars = new Array(); var pairs = qString.split(/\&/); for (var i in pairs) { var nameVal = pairs[i].split(/\=/); getVars[nameVal[0].toLowerCase()] = nameVal[1]; } return getVars; } function addStyle(newStyle) { if (typeof(GM_addStyle) == "function") { GM_addStyle(newStyle); return; } var styleElement = document.getElementById('style_js'); if (!styleElement) { styleElement = document.createElement('style'); styleElement.type = 'text/css'; styleElement.id = 'style_js'; document.getElementsByTagName('head')[0].appendChild(styleElement); } styleElement.appendChild(document.createTextNode(newStyle)); } function nextElem(node) { return (node.nextSibling) ? ( (node.nextSibling.nodeType != 1) ? nextElem(node.nextSibling) : node.nextSibling ) : null; } function prevElem(node) { return (node.previousSibling) ? ( (node.previousSibling.nodeType != 1) ? prevElem(node.previousSibling) : node.previousSibling ) : null; } function firstSubElem(node) { return (node.firstChild) ? ( (node.firstChild.nodeType != 1) ? nextElem(node.firstChild) : node.firstChild ) : null; } function hasClassName(className,node) { return node.className.split(/\s/).indexOf(className) >= 0; } function isSet(expr) {return (typeof(expr)!="undefined" && expr!=null);} /*** Restore the Navbar (http://userscripts.org/scripts/show/105768) ***/ addStyle( '#gbi5 {' + ' background: url("//ssl.gstatic.com/gb/images/b_8d5afc09.png") repeat scroll -6px -22px transparent;' + ' height: 17px;' + ' width: 16px;' + '}' + '.gbz0l .gbtb2 {' + ' border-top-color: #1A54E1 !important;' + '}' + '#gbz .gbzt, #gbz .gbgt, #gbg .gbgt {' + ' color: #3366CC !important;' + '}' + '.gbz0l .gbts {' + ' color: #363636;' + '}' + '.gbzt-hvr, .gbzt:focus, .gbgt-hvr, .gbgt:focus {' + ' background-color: transparent;' + ' background-image: url("//ssl.gstatic.com/gb/images/b_8d5afc09.png");' + ' background-position: 0 -102px;' + ' background-repeat: repeat-x;' + '}' + '#gbx3, #gbx4 {' + ' background-color: #FFFFFF;' + ' background-image: url("//ssl.gstatic.com/gb/images/b_8d5afc09.png");' + ' background-position: 0 -138px;' + ' background-repeat: repeat-x;' + ' border-bottom: 1px solid #EDEDED;' + '}' + '#mngb #gbx4 {' + ' border-bottom: 1px solid #EDEDED;' + '}' + '.gbtb .gbts {' + ' background: url("//ssl.gstatic.com/gb/images/b_8d5afc09.png") repeat scroll 0 -22px transparent;' + ' padding: 29px 0 0;' + ' width: 1px;' + '}' ); /*** Restore Search Box Border Colors ***/ addStyle( '#lst-ib:hover, #lst-ib.lst-d-f, #lst-ib.lst-d-f:hover, .lst-d-f .lst-tbb,' + '.lst-d-f.lst-tbb, #sftab:hover .lst-tbb, #sftab.lst-d-f:hover .lst-tbb {' + ' border-color: #C0C0C0 #D9D9D9 #D9D9D9 #D9D9D9 !important;' + '}' ); // Correct Navbar Menu's List-Item Spacing addStyle( '.gbmt {' + ' padding: 0px 12px 0px 8px;' + '}' + '.gbmc {' + ' padding: 3px 0px;' + '}' + '.gbmh {' + ' margin: 3px 0px;' + '}' ); // Restore Link Styles addStyle( '.a, cite, cite a:link, cite a:visited, .cite, .cite:link, #mbEnd cite b, #tads cite b, #tadsto cite b, #ans > i, .bc a:link {' + ' color: #0E774A;' // Restore Cite Color + ' font-style: normal;' + '}' + '#gsr a:active, #srp a:active, a.fl:active, .fl a:active, .gl a:active {' + ' color: #CC1111;' // Restore Active Link Color + '}' + 'a.fl:link, .fl a, .flt, a.flt, .gl a:link, a.mblink, .mblink b, .f span.vshid a {' + ' color: #1122CC;' + '}' + '.osl a, .gl a, #tsf a, a.mblink, a.gl, a.fl, .slk a, .bc a, .flt, a.flt u,' + '.oslk a, #tads .ac a, #rhs .ac a, .blg a, #appbar a, span.vshid a {' + ' text-decoration: none;' + '}' ); // Restore the "cached" and "similar" links addStyle( 'ol#rso span.vshid {' + ' display: inline;' + '}' + 'ol#rso span.vshid:before {' + ' content: "\\00A0-\\00A0";' + '}' ); // Change hover color of Google Search Suggestions addStyle( '#gac_scont .gac_b, #gac_scont .gac_b td.gac_c, #gac_scont .gac_b td.gac_d, tr.gssb_i {' + ' background: none repeat scroll 0 0 #EFF3FB;' + '}' ); // hide google appbar addStyle( 'div#subform_ctrl {' + ' display: none;' + '}' + 'div#appbar {' + ' font-size: 11px;' + ' max-width: 695px;' + ' min-height: 26px;' + ' height: auto;' + ' border-bottom: none;' + ' margin-left: 176px;' + ' margin-right: 272px;' + ' padding-top: 3px;' + '}' + 'div#appbar div#ab_name {' + ' display: none;' + '}' + 'div#appbar div#sbfrm_l {' + '' + '}' + 'div#appbar div div#resultStats {' + ' color: #000000;' + ' font-size: 11px;' + ' margin-left: 0px;' + ' overflow: hidden;' + ' position: static;' + ' top: auto;' + ' white-space: nowrap;' + '}' + 'div#appbar ol#ab_ctls {' + ' display: none;' + '}' + 'div#appbar_b {' + ' display: none;' + '}' ); var url = window.location.href; var getVars = parseGetVars(unescape(url).substring(unescape(url).indexOf('?')+1)); // query string var hashVars = parseGetVars(unescape(url).substring(unescape(url).indexOf('#')+1)); // fragment identifier var host = window.location.hostname; var subdomain = host.substring(0,host.lastIndexOf('.',host.lastIndexOf('.')-1)); /* determine the current mode */ var gb = document.getElementById('gb'); // Google Navbar var gbz0l = (isSet(gb))?getElementsByClassName('gbz0l',gb)[0]:null; var m = (isSet(gbz0l))?nextElem(firstSubElem(gbz0l)).innerHTML.toLowerCase():null; var mode; /* Check the Subdomain */ if ((mode = (subdomain=='') ? null : ((subdomain=='www') ? null : ((subdomain=='images') ? 'images' : ((subdomain=='video') ? 'videos' : ((subdomain=='news') ? 'news' : ((subdomain=='maps') ? 'maps' : ((subdomain=='mail') ? 'gmail' : ((subdomain=='books') ? ((/\/ebooks/).test(url) ? 'ebookstore' : 'books') : ((subdomain=='patents') ? 'patents' : ((subdomain=='checkout') ? 'checkout' : ((subdomain=='scholar') ? 'scholar' : ((subdomain=='blogsearch') ? 'blogs' : ((subdomain=='sites') ? 'sites' : ((subdomain=='groups') ? 'groups' : ((subdomain=='earth') ? 'earth' : ((subdomain=='voice') ? 'voice' : ((subdomain=='talk') ? 'talk' : ((subdomain=='accounts') ? 'accounts' : ((subdomain=='sketchup') ? 'sketchup' : ((subdomain=='picasaweb') ? 'picasa' : ((subdomain=='knol') ? 'knol' : ((subdomain=='support') ? 'enterprise support' : ((subdomain=='code') ? 'code' : ((subdomain=='labs') ? 'labs' : null))))))))))))))))))))))) ) && isSet(mode)) {log('location detected from subdomain','debug');} else if ( /* Check the URL */ (mode = (/\/webhp/).test(url) ? 'web' : ((/\/imghp/).test(url) ? 'images' : ((/\/nwshp/).test(url) ? 'news' : ((/\/maps/).test(url) ? 'maps' : ((/\/prdhp/).test(url) ? 'shopping' : // Product Search ((/\/mail\//).test(url) ? 'gmail' : ((/\/bkshp/).test(url) ? 'books' : ((/\/finance/).test(url) ? 'finance' : ((/\/schhp/).test(url) ? 'scholar' : ((/\/blogsearch/).test(url) ? 'blogs' : ((/\/sites\//).test(url) ? 'sites' : ((/\/alerts/).test(url) ? 'alerts' : ((/\/grphp/).test(url) ? 'groups' : ((/\/checkout\//).test(url) ? 'checkout' : ((/\/earth\//).test(url) ? 'earth' : ((/\/latitude\//).test(url) ? 'latitude' : ((/\/fusiontables\//).test(url) ? 'fusion tables' : ((/\/trends/).test(url) ? 'trends' : ((/\/voice\//).test(url) ? 'voice' : ((/\/talk\//).test(url) ? 'talk' : ((/\/language_tools/).test(url) ? 'language tools' : ((/\/cse/).test(url) ? 'custom search' : ((/\/sitesearch\//).test(url) ? 'site search' : ((/\/commercesearch\//).test(url) ? 'commerce search' : ((/\/accounts\//).test(url) ? ((/\/ServiceLogin/).test(url) ? 'service sign-in' : 'accounts') : ((/\/support\//).test(url) ? 'help center' : ((/\/webmasters\//).test(url) ? 'webmaster tools' : ((/\/mapmaker/).test(url) ? 'mapmaker' : ((/\/adsense\//).test(url) ? 'adsense' : ((/\/apis\//).test(url) ? 'code' : null))))))))))))))))))))))))))))) ) && isSet(mode)) {log('location detected from url');} else if (((tbm = hashVars['tbm']) || (tbm = getVars['tbm'])) && isSet(tbm) && ( /* Tab Mode */ mode = (tbm=='isch' ) ? 'images' : ((tbm=='vid' ) ? 'videos' : ((tbm=='nws' ) ? 'news' : ((tbm=='shop' ) ? 'shopping' : ((tbm=='bks' ) ? 'blogs' : ((tbm=='blg' ) ? 'blogs' : ((tbm=='rcp' ) ? 'recipes' : ((tbm=='pts' ) ? 'patents' : null))))))) ) && isSet(mode)) {log('location detected from tbm parameter');} else if (isSet(m) && ( /* check selected tab in Google Bar (minified to conserve space) */ mode = (m=='web'||m=='la web'||m=='nettet'||m=='ウェブ')?'web':((m=='images'||m=='imágenes'||m=='immagini'||m=='bilder'||m=='billeder'|| m=='obrázky'||m=='画像')?'images':((m=='videos'||m=='video'||m=='vídeos'||m=='vidéos'||m=='videa'||m=='動画')?'videos':((m=='maps'|| m=='mapy'||m=='kort'||m=='地図')?'maps':((m=='news'||m=='noticias'||m=='actualités'||m=='zprávy'||m=='ニュース')?'news':((m=='shopping' ||m=='ショッピング')?'shopping':((m=='translate'||m=='traductor'||m=='traduttore'||m=='traduction'||m=='oversæt'||m=='übersetzer'|| m=='překladač'||m=='翻訳')?'translate':((m=='books'||m=='libros'||m=='livres'||m=='libri'||m=='bücher'||m=='knihy'||m=='書籍')?'books' :((m=='gmail'||m=='google mail')?'gmail':((m=='scholar'||m=='google scholar'||m=='académico')?'scholar':m))))))))) ) && isSet(mode)) {log('location detected from selected tab in navbar');} else if (((tab = hashVars['tab']) || (tab = getVars['tab'])) && isSet(tab) && tab.length==2) { /* Check the Query String "Tab" Parameter * the tab parameter consists of two letters: * first: indicates previous location; referring google service * second: indicates the current location/service */ var tab_mode = tab.charAt(1).toLowerCase(); mode = (tab_mode == 'w') ? 'web' : // web, patents ((tab_mode == 'i') ? 'images' : ((tab_mode == 'v') ? 'videos' : ((tab_mode == 'l') ? 'maps' : ((tab_mode == 'n') ? 'news' : ((tab_mode == 'f') ? 'shopping' : // frogle ((tab_mode == 't') ? 'translate' : ((tab_mode == 'p') ? 'books' : ((tab_mode == 'e') ? 'finance' : ((tab_mode == 's') ? 'scholar' : ((tab_mode == 'b') ? 'blogs' : ((tab_mode == '1') ? 'youtube' : ((tab_mode == 'c') ? 'calendar' : ((tab_mode == 'q') ? 'photos' : ((tab_mode == 'o') ? 'documents' : ((tab_mode == 'y') ? 'reader' : ((tab_mode == '3') ? 'sites' : ((tab_mode == 'g') ? 'groups' : ((tab_mode == 'x') ? '+you' : null)))))))))))))))))); log('location detected via tab parameter'); } if (!isSet(mode)) {log('Unknown Google Service','error');} else {log('Location is Google '+((mode=='web') ? 'Web Search' : mode),'info');} var hplogo = document.getElementById('hplogo'); log(hplogo ? 'hplogo was detected' : 'hplogo was not found','info'); var lga = document.getElementById('lga'); var searchform = document.getElementById('searchform'); var tsf = document.getElementById('tsf'); var instant = ((isSet(lga) && (lga.nextSibling.tagName.toLowerCase() == 'div' || (isSet(nextElem(lga)) && nextElem(lga).tagName.toLowerCase() == 'form' && nextElem(lga).name.toLowerCase() == 'f'))) || (isSet(searchform) && prevElem(searchform).innerHTML.indexOf('turn off Google Instant') != -1) || (isSet(tsf) && tsf.name == 'f')); log(instant ? 'Google instant is enabled' : 'Google instant is disabled','info'); var jhp = getElementsByClassName('jhp')[0]; var lst_ib = document.getElementById('lst-ib'); var hp_instant_layout = (isSet(lst_ib) && (lst_ib.parentNode.className!='ds') && (hasClassName('gsfi',lst_ib) || (hasClassName('gsib_a',lst_ib.parentNode.parentNode) || lst_ib.getAttribute('title')=='Search' && lst_ib.size=='41') || (lst_ib.style.borderStyle=="none") || (isSet(jhp) && (jhp.id=='searchform' || jhp.tagName=='div')))); log((hp_instant_layout) ? 'detected the hp instant layout' : 'did not detect the hp instant layout','info'); if (hplogo) // If the homepage is loaded (main logo is present) { /* Customize Homepage */ // Correct Logo and Search Box Spacing lga.removeAttribute('style'); if (firstSubElem(lga).tagName.toLowerCase() == 'div') {firstSubElem(lga).style.padding = '0px';} if (hplogo) { hplogo.style.padding = '28px 0pt 14px 0pt'; hplogo.style.backgroundPosition = '0% 28px'; } if (!instant) { // Correct the Search-Box's Padding addStyle('.lst {padding: 1px 7px !important;}'); } else { /* Correct the hompage layout */ var logocont = document.getElementById('logocont'); var tsf_p = getElementsByClassName('tsf-p')[0]; if (isSet(tsf_p)) {tsf_p.style.padding = '0px';} // Use standard page layout when Google uses a different logo var hplogo_bg = hplogo.style.backgroundImage; if ( !((hplogo.width=='275' && hplogo.height=='95') || (hplogo.style.width=='275' && hplogo.style.height=='95')) && !( (/\/images\/srpr\/logo\dw\.(png|gif)/).test(hplogo.src) || (/\/images\/srpr\/logo\dw\.(png|gif)/).test(hplogo_bg) || (/\/logos\/201\d\/logo-hp\.(png|gif)/).test(hplogo.src) || (/\/logos\/201\d\/logo-hp\.(png|gif)/).test(hplogo_bg) )) { if (!(/as_qdr=all/).test(document.location.href)) { if ((/\?(.*)=(.*)/).test(document.location.href)) { window.location.replace(window.location+"&as_qdr=all"); } else {window.location.replace(window.location+"?as_qdr=all");} } } // Position the tsf (Top Search Form) else if (isSet(tsf) && tsf.name == 'f') { addStyle( '#als, #prm br {display: none;}' + 'div#searchform.jhp form#tsf {' + ' height: 0px; overflow: visible;' + '}' ); tsf.style.width = 'auto'; tsf.style.minWidth = '817px'; tsf.style.maxWidth = '1181px'; tsf.style.position = 'relative'; tsf.style.top = '-92px'; tsf.style.padding = '0px'; } } // Remove the "Advanced Search" and "Translation Tools" entries from the pull-down menu var adv_srch = nextElem(nextElem(firstSubElem(firstSubElem(firstSubElem(document.getElementById('gbd5')))))); var trans_tool = nextElem(adv_srch); adv_srch.parentNode.removeChild(adv_srch); trans_tool.parentNode.removeChild(trans_tool); // Restore the "Advanced Search" and "Translation Tools" links to the right of the search box if (hp_instant_layout) { var sb_table = firstSubElem(nextElem(logocont)); var sb_table_firstElem = firstSubElem(sb_table); } var ctr_td = (!hp_instant_layout) ? document.getElementsByName('source')[0].parentNode : ( (sb_table_firstElem.tagName == 'tbody') ? firstSubElem(firstSubElem(firstSubElem(sb_table_firstElem))) : firstSubElem(firstSubElem(sb_table_firstElem)) ); var ltd = document.createElement('td'); var rtd = document.createElement('td'); if (hp_instant_layout) {ctr_td.removeAttribute('width');} ltd.id = 'ltd'; ltd.setAttribute('width','25%'); ltd.innerHTML = ' '; rtd.id = 'rtd'; rtd.className = 'fl sblc'; rtd.width ='25%'; rtd.align = 'left'; rtd.setAttribute('nowrap','') rtd.innerHTML = '<a href="/advanced_search?hl=en">Advanced search</a><a href="/language_tools?hl=en">Language tools</a>'; ctr_td.parentNode.insertBefore(ltd,ctr_td); ctr_td.parentNode.appendChild(rtd); addStyle('.ctr-p {margin: 0 auto; min-width: 817px;}'); // Style the search buttons addStyle( 'span.lsbb input.lsb {' + ' border: medium none;' + ' margin: 0px;' + '}' + 'span.lsbb input.lsb, div.jsb center input[type="submit"],' + '.jhp input[type="submit"], .gssb_c input, .gac_bt input {' + ' background: url("/images/srpr/nav_logo73.png") repeat scroll center bottom transparent;' + ' color: #000000;' + ' cursor: pointer;' + ' font: 15px arial,sans-serif;' + ' height: 30px;' + ' outline: 0px none;' + ' vertical-align: top;' + '}' + 'input[type="submit"].lsb:hover {' + ' border: 0px none;' + '}' + 'div.jsb center input[type="submit"],' + '.jhp input[type="submit"], .gssb_c input, .gac_bt input {' + ' border-color: #CCCCCC #999999 #999999 #CCCCCC;' + ' border-style: solid;' + ' border-width: 1px;' + ' height: 30px;' + ' margin: 7px 5px;' + '}' + 'form {' + ' margin: 0px;' + '}' + 'form[name="f"] {' + ' margin-bottom: 20px;' + ' margin-top: 18px;' + '}' ); /*** Correct Footer ***/ var footer = document.getElementById('footer'); var footer_contents = footer.innerHTML; footer.innerHTML = ""; var fctr = document.createElement('center'); fctr.setAttribute('id','fctr'); fctr.innerHTML = footer_contents; footer.appendChild(fctr); if (firstSubElem(fctr).tagName.toLowerCase() != 'div') { nextElem(firstSubElem(fctr)).style.cssText = 'font-size: 10pt;'; } else { firstSubElem(fctr).style.cssText = 'font-size: 10pt;'; } var fll = document.getElementById('fll'); fll.parentNode.style.width = '100%'; if (fll.nextSibling.className!='ftl') {fll.parentNode.removeChild(fll.nextSibling);} var privacy = fll.nextSibling; privacy.removeAttribute('class'); var ftr_p = document.createElement('p'); ftr_p.appendChild(document.createTextNode('© 2011 - ')); ftr_p.appendChild(privacy); ftr_p.style.cssText = 'margin-top: 0px; color: rgb(118, 118, 118); font-size: 8pt;'; fctr.appendChild(ftr_p); addStyle( '#footer a {' + ' color: #2200C1;' + ' margin: 0px;' + '}' + '.ftl, #fll a {' + ' display: inline-block;' + ' margin: 0px 12px;' + '}' + '#fll {' + ' display: block;' + '}' + '#ftby a#cp-sol {' + ' overflow-y: visible;' + ' height: 0px;' ); } var reposition_tsf = function (e,r,u,d) { if (u) { var key = (e.which) ? e.which : e.keyCode; if (!(key==8 || key==13 || key==32 || key==46 || (key>=48 && key<=57) || key==59 || (key>=65 && key<=90) || (key>=96 && key<=111) || (key>=186 && key<=192) || (key>=219 && key<=223) || key==226)) {if((!r && key!=27) || r) {return false;}} } if (r) { try { var ltd = document.getElementById('ltd'); var rtd = document.getElementById('rtd'); if(isSet(ltd)) ltd.parentNode.removeChild(ltd); if(isSet(rtd)) rtd.parentNode.removeChild(rtd); // Position the tsf (Top Search Form) var tsf = document.getElementById('tsf'); var searchform = (document.getElementById('searchform')) ? document.getElementById('searchform') : document.getElementById('sfcnt'); var subform_ctrl = document.getElementById('subform_ctrl'); // contains result-stats var sfbg = getElementsByClassName('sfbg nojsv')[0]; // search-form gray bg var logocont = document.getElementById('logocont'); var srch_bx_cnt = nextElem(logocont); var srch_bx = firstSubElem(srch_bx_cnt); var sftab = document.getElementById('sftab'); var main = document.getElementById('main'); main.style.maxWidth = '1219px'; searchform.style.margin = '17px 0px 0px 0px'; searchform.style.maxWidth = '1219px'; searchform.style.minWidth = '780px'; searchform.style.position = 'static'; if (isSet(sfbg)) {sfbg.parentNode.removeChild(sfbg);} // remove the search form's gray background logocont.style.float = 'left'; logocont.style.margin = '-7px 0px 0px 0px'; logocont.style.padding = '0px 18px 0px 12px'; srch_bx_cnt.id = 'qbc'; // query box container srch_bx_cnt.style.padding = '0px 0px 2px 0px'; srch_bx_cnt.style.margin = '0px 272px 2px 168px'; srch_bx_cnt.style.maxWidth = '711px'; srch_bx.style.padding = '8px 0px 0px 0px'; tsf.style.width = 'auto'; tsf.position = 'static'; tsf.style.top = 'auto'; tsf.style.maxWidth = '1144px'; tsf.style.minWidth = '910px'; if (mode!='images') { tsf.style.margin = '0px auto'; } sftab.parentNode.parentNode.parentNode.style.borderBottom = '0px none'; getElementsByClassName('tsf-p')[0].style.padding = '0px'; document.getElementById('sblsbb').style.margin = '0px'; if (isSet(subform_ctrl) && isSet(subform_ctrl.firstChild.nextSibling)) { subform_ctrl.style.display = 'block'; if (mode=='images') { subform_ctrl.style.marginRight = '269px'; subform_ctrl.style.minWidth = '469px'; subform_ctrl.style.minHeight = '0px'; subform_ctrl.style.height = '0px'; subform_ctrl.style.overflow = 'visible'; } } window.scrollTo(0,0); } catch(e) {log(e,'warn'); log('endGroup'); return false;} } if (typeof(d)=="number" && d>0) { // delay window.setTimeout(hide_sform,200); window.setTimeout(adjust_sidebar,d); window.setTimeout(relocate_url,d); } else { hide_sform(); adjust_sidebar(); relocate_url(); } return true; }; if (mode=='images') { addStyle( + '.sfbgg {' + ' background: none repeat scroll 0 0 #FFFFFF;' + ' border-bottom: 0px none;' + ' height: 71px;' + '}' ); if (getVars['sout']=='1') { addStyle( 'html body {' + ' max-width: 1219px;' + '}' + 'table#mn {' + ' margin: 0px auto;' + ' max-width: 1144px;' + ' min-width: 780px;' + ' width: auto;' + ' table-layout: auto;' + '}' + 'table#mn > tbody > tr > td, table#mn > tr > td {' + ' width: auto;' + '}' + 'form#tsf, div#subform_ctrl {' + ' max-width: 711px;' + '}' + 'table#mn div#subform_ctrl {' + ' display:block;' + '}' + 'table#mn #leftnav {' + ' margin-left: 0px;' + ' width: 151px !important;' + ' padding-left: 4px;' + ' padding-top: 3px;' + '}' + '.mitem {' + ' width: 143px;' + '}' + 'a.fl, .flc a {' + ' white-space: nowrap;' + '}' ); } } if (instant && (mode == 'web' || mode=='images' || mode == 'videos' || mode == 'news' || mode=='recipes' || mode=='shopping')) { var XMLHttpRequest = (isSet(unsafeWindow.XMLHttpRequest.prototype)) ? unsafeWindow.XMLHttpRequest /* else if (!isSet(unsafeWindow.XMLHttpRequest.prototype)) */ : unsafeWindow.XMLHttpRequest.wrappedJSObject; // track Google's XMLHttpRequests to determine when results have loaded (function(open) { XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { this.addEventListener("readystatechange", function() { if (this.readyState == 4 && this.status == 200) { log('this.readyState == 4 && this.status == 200 => true','success'); window.setTimeout(hide_sform,200); window.setTimeout(relocate_url,500); window.setTimeout(adjust_sidebar,100); } }, false); if (async == undefined) {async = true;} open.call(this, method, url, async, user, pass); }; })(XMLHttpRequest.prototype.open); if (mode != 'shopping') { var lst_ib = document.getElementById('lst-ib'); // Input-Bar if (!lst_ib) {log('lst-ib was not found','error');} if (typeof(lst_ib.addEventListener) == "function") { if (!hp_instant_layout && instant) { lst_ib.addEventListener('keydown',function (e) { var key = (e.which) ? e.which : e.keyCode; if (key==13) { window.setTimeout(function(){reposition_tsf(0,1,0,500)},500); lst_ib.addEventListener('keydown',function (e) { var key = (e.which) ? e.which : e.keyCode; if (key==13) {reposition_tsf(0,0,0,200);} },false); this.removeEventListener('keydown',arguments.callee,false); } },false); } else { lst_ib.addEventListener('keydown',function (e) { if (reposition_tsf(e,1,1,500)) { lst_ib.addEventListener('keydown',function (e) { var key = (e.which) ? e.which : e.keyCode; if (key==13) {reposition_tsf(0,0,0,200);} },false); this.removeEventListener('keydown',arguments.callee,false); } },false); } } else {log('event listener could not be attached','error');} } var count = 0; window.setTimeout(function tsf_fix() { if (!isSet(document.getElementById('hplogo'))) {count = undefined; reposition_tsf(0,1,0);} else if (!(count>3)) {count++; window.setTimeout(tsf_fix,450);} },150); } else if (isSet(tsf) && mode=='images' && !(getVars['sout']=='1' && mode=='images')) { var XMLHttpRequest = (isSet(unsafeWindow.XMLHttpRequest.prototype)) ? unsafeWindow.XMLHttpRequest /* else if (!isSet(unsafeWindow.XMLHttpRequest.prototype)) */ : unsafeWindow.XMLHttpRequest.wrappedJSObject; // track Google's XMLHttpRequests to determine when results have loaded (function(open) { XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { if ((/\/search\?/).test(url)) { log('(/\/search\?/).test(url) => true; attaching \'readystatechange\' event listener to XMLHttpRequest call','debug'); this.addEventListener("readystatechange", function() { if (this.readyState == 4 && this.status == 200) { log('this.readyState==4 && this.status==200 => true','success'); reposition_tsf(0,1,0); gsr_logo_fix(); } }, false); } if (async == undefined) {async = true;} open.call(this, method, url, async, user, pass); }; })(XMLHttpRequest.prototype.open); } if ((!hplogo || instant) && !(getVars['sout']=='1' && mode=='images')) { // Remove the search form's grey background var sfbg = getElementsByClassName('sfbg nojsv')[0]; if (sfbg) {sfbg.parentNode.removeChild(sfbg);} addStyle('#logo img {background: none transparent;} #logo {font-size: 0; color: transparent;}'); if (mode=='web' || mode=='images' || mode=='videos' || mode=='news' || mode=='shopping' || mode=='recipes' || mode=='patents') { var sform = document.getElementById('sform'); // remaining legacy search-form element if (isSet(sform) && !isSet(sform.firstChild.nextSibling)) { addStyle('#sform {display: none;}'); } function hide_sform() { var sform = document.getElementById('sform'); // remaining legacy search-form element return (isSet(sform) && !isSet(sform.firstChild.nextSibling) && (sform.style.display='none')=='none'); } // Fix the pages's layout spacing addStyle( '#arcntc {' + ' margin-bottom: 0px;' + '}' + '.ksfcccl {' + ' min-height: 0.01%;' + ' min-width: 910px;' + ' width: auto;' + '}' + '.ksfccl {' + ' margin-right: 265px;' + ' z-index: 200;' + '}' + 'div.sfcc {' + ' width: auto;' + ' max-width: none;' + '}' + '#subform_ctrl {' + ' font-size: 11px;' + ' margin-left: 176px;' + ' margin-right: 269px;' + ' max-width: 703px;' + ' min-height: 26px;' + ' padding-top: 1px;' + '}' + '#leftnav {' + ' margin-left: 0px;' + ' width: 151px !important;' + ' padding-left: 4px;' + ' padding-top: 3px;' + ' position: absolute !important;' + ' top: 0px !important;' + '}' + '#center_col {' + ' border-left: 1px solid #D3E1F9;' + ' clear: both;' + '}' + '#center_col, #foot {' + ' margin-left: 159px;' + ' padding: 0 8px;' + '}' + '#main #cnt, #cnt {' + ' margin: 0 auto;' + ' max-width: 1144px;' + ' min-width: 780px;' + ' padding-top: 0px;' + '}' ); if (mode=='images' && getVars['sout']!='1') { addStyle('#rcnt {margin-top: 35px;}'); } else { addStyle('#rcnt {margin-top: 0px;}'); } } function gsr_logo_fix() { // Adjust the search-results-page logo var logo = document.getElementById('logo'); if (logo != null) { var logo_img = firstSubElem(logo); if (logo_img != null && logo_img.tagName.toLowerCase() == 'img' && logo_img.src.search(/nav_logo\d\d.png/i) != -1) { logo_img.src = 'http://www.google.com/images/srpr/nav_logo73.png'; logo_img.width = '167'; logo_img.height = '288'; logo_img.style.position = 'absolute'; logo_img.style.left = '0px'; logo_img.style.top = '-41px'; logo.style.height = '49px'; logo.style.width = '137px'; addStyle('#logo {margin: 9px 0px 0px 0px;}'); } } } gsr_logo_fix(); // Restore the sidebar's colorful icons addStyle( '.tbos, .tbots, .tbotu {' + ' color: #000000;' + '}' + '.msel {' // Selected Mode + ' color: #FFFFFF;' + ' font-weight: bold;' + ' background-color: #3366fe;' + '}' + '.mitem {' // Mode Items + ' margin-bottom: 2px;' + '}' + '.mitem, #showmodes {' + ' font-size: 15px;' + ' line-height: 25px;' + '}' + '.mitem.msel:hover {' + ' background-color: #1A54E1;' + '}' + '.mitem:hover, #showmodes:hover, #showmodes:hover {' + ' background-color: #EFF3FB;' + '}' + '#leftnav h2 {' + ' color: #000000;' + ' font-weight: bold;' + '}' + '.mitem > .kl, #ms > .kl {' + ' color: #2200C1;' + '}' + '.mitem > .kl, #ms > .kl, .msel {' + ' font-size: 15px;' + '}' + '#lc a, .tbou > a.q, #tbpi, #tbtro,' + '#swr a, #set_location_section a,' + '#prc_opt, .tbtctlabel, .tbt label {' + ' color: #2200C1;' + '}' + '.micon {' // Mode Icons + ' background-image: url("http://www.google.com/images/srpr/nav_logo73.png");' + ' float: left;' + ' height: 19px;' + ' margin-right: 6px;' + ' margin-top: 2px;' + ' outline: none;' + ' width: 19px;' + '}' + '#showmodes .micon {' // Show More Modes Icon + ' background-position: -150px -114px;' + '}' + '.open #showmodes .micon {' + ' background-position: -131px -114px;' + '}' ); /*** Correct the left margin of the sidbar's modes and search options ***/ addStyle( 'div.lhshdr {' + ' left: auto !important;' + '}' + '.mitem, #showmodes {' // Mode Items, Show More Modes Link + ' padding-left: 8px !important;' + '}' + '#showmodes .micon {' // Show More Modes Icon + ' height: 17px;' + ' margin-left: 1px;' + ' margin-right: 7px;' + ' width: 17px;' + '}' + '.lnsep {' // Line Seperator + ' margin: 14px 4px 14px 0px;' + ' border-bottom: 1px solid #C9D7F1;' + '}' + '#lc {' // Location Container + ' margin-left: 0px !important;' + '}' + '.tbt {' + ' margin-left: 0px;' + '}' + '#tbpi {' + ' margin-left: 8px !important;' + '}' ); addStyle( '#showmodes span#showmodes_icon {' + ' display: block;' + ' background-position: -150px -114px;' + ' background-image: url("http://www.google.com/images/srpr/nav_logo73.png");' + '}' + '.open #showmodes span#showmodes_icon {' + ' background-position: -131px -114px;' + '}' + '#showmodes .micon {' + ' display: none;' + '}' ); function adjust_sidebar() { var lc = document.getElementById('lc'); // "Location" Section var swr = document.getElementById('swr'); // "Something Different" Section var tbpi = document.getElementById('tbpi'); var tbt = getElementsByClassName('tbt',document.getElementById('tbd')); // Toolbelt Sections if (lc) {lc.style.marginLeft = '25px';} if (tbpi) {tbpi.style.marginLeft = '33px';} if (swr) { prevElem(swr).style.color = '#000000'; prevElem(swr).style.marginLeft = '0px'; swr.style.marginLeft = '8px'; } // Restore the sidebar's icons log('now restoring the sidebar icons','info'); var mitems = getElementsByClassName('mitem',document.getElementById('ms')); // mode items var showmodes = document.getElementById('showmodes'); if (isSet(showmodes) && !isSet(document.getElementById('showmodes_icon'))) { var micon = document.createElement('span'); micon.id = 'showmodes_icon'; micon.className = 'micon'; showmodes.insertBefore(micon,firstSubElem(showmodes)); } var maps_icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuw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7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAARtJREFUeNqs1DFLw1AUBeCA0MnJSSh0KgScHM8g9AcUCp0KrsKZ+gNcnZyETl2dBH+AIHR1cip0EgpynAShk1AQCnF5gcvzvryUOrwh3JsvyT2XFKCKA04JagGqArU+BLoA9R2gCtT7f0EVqNu62AX1AmoGahKu94GWoI7rhllUrEB9gHoENQV1ZqCtA52AKmrsymmKz6YJslgBqgfqIQMmoRizM1lmoHUMpTD76Z8J7M27pwkbZOZ42hYbtAjk0sNGoIZmtzxo5ezW3MN2puGrIf5r5wF/sDmonxbxd0KKdW2XWo2+s2Ne/MOoZ9QUwNg0vibCeTI9N7k0n0PjFtSRU++bOd/lsHPTXCbebpJaDe/ch5mV+/znfgcAVvitmo1naBQAAAAASUVORK5CYII="; for (m=0; m<mitems.length; m++) { if (hasClassName('msel',mitems[m])) { var mitem_text = mitems[m].innerHTML; // mode link text var icon = // mode icon ((mitem_text == 'Everything' ) ? '<span style="background-position: -20px -132px;" class="micon"></span>' : ((mitem_text == 'Images' ) ? '<span style="background-position: -60px -132px;" class="micon"></span>' : ((mitem_text == 'Maps' ) ? '<span style="background-image:url(\''+maps_icon+'\'); background-position: 0px 0px" class="micon"></span>' : ((mitem_text == 'Videos' ) ? '<span style="background-position: -100px -132px;" class="micon"></span>' : ((mitem_text == 'News' ) ? '<span style="background-position: -140px -132px;" class="micon"></span>' : ((mitem_text == 'Shopping' ) ? '<span style="background-position: -140px -152px;" class="micon"></span>' : ((mitem_text == 'Books' ) ? '<span style="background-position: -60px -152px;" class="micon"></span>' : ((mitem_text == 'Places' ) ? '<span style="background-position: -100px -152px;" class="micon"></span>' : ((mitem_text == 'Blogs' ) ? '<span style="background-position: -20px -152px;" class="micon"></span>' : ((mitem_text == 'Realtime' ) ? '<span style="background-position: -60px -172px;" class="micon"></span>' : ((mitem_text == 'Discussions' ) ? '<span style="background-position: -20px -172px;" class="micon"></span>' : ((mitem_text == 'Flights' ) ? '<span style="background-image:url(\''+flights_icon+'\'); background-position: 0px 0px" class="micon"></span>' : ((mitem_text == 'Recipes' ) ? '<span style="background-position: -140px -172px;" class="micon"></span>' : ((mitem_text == 'Patents' ) ? '<span style="background:url(\'http://www.google.com/images/srpr/icons/patents.png\') -20px 0px;" class="micon"></span>' : '')))))))))))))); if (mitem_text=='') {log('mode link text did not match','warn');} mitems[m].innerHTML = icon + mitem_text; // Place the icon in the mode item } else { var childElem = firstSubElem(mitems[m]); if (isSet(childElem) && childElem.tagName.toLowerCase()=='a' && childElem.className.toLowerCase()=='kl') { var kl_text = childElem.innerHTML; // mode link text var icon = // mode icon ((kl_text == 'Everything' ) ? '<span style="background-position: 0px -132px;" class="micon"></span>' : ((kl_text == 'Images' ) ? '<span style="background-position: -40px -132px;" class="micon"></span>' : ((kl_text == 'Maps' ) ? '<span style="background-image:url(\''+maps_icon+'\'); background-position: 0px 0px" class="micon"></span>' : ((kl_text == 'Videos' ) ? '<span style="background-position: -80px -132px;" class="micon"></span>' : ((kl_text == 'News' ) ? '<span style="background-position: -120px -132px;" class="micon"></span>' : ((kl_text == 'Shopping' ) ? '<span style="background-position: -120px -152px;" class="micon"></span>' : ((kl_text == 'Books' ) ? '<span style="background-position: -40px -152px;" class="micon"></span>' : ((kl_text == 'Places' ) ? '<span style="background-position: -80px -152px;" class="micon"></span>' : ((kl_text == 'Blogs' ) ? '<span style="background-position: 0px -152px;" class="micon"></span>' : ((kl_text == 'Realtime' ) ? '<span style="background-position: -40px -172px;" class="micon"></span>' : ((kl_text == 'Discussions' ) ? '<span style="background-position: 0px -172px;" class="micon"></span>' : ((kl_text == 'Flights' ) ? '<span style="background-image:url(\''+flights_icon+'\'); background-position: 0px 0px" class="micon"></span>' : ((kl_text == 'Recipes' ) ? '<span style="background-position: -120px -172px;" class="micon"></span>' : ((kl_text == 'Patents' ) ? '<span style="background:url(\'http://www.google.com/images/srpr/icons/patents.png\') 0px 0px;" class="micon"></span>' : '')))))))))))))); if (kl_text=='') {log('mode link text did not match','warn');} childElem.innerHTML = icon + kl_text; // Place the icon in the mode item } else {log('mitem child element did not match','warn')}; } } // Change the color of the Toolbelt Option Section's Header-text for (s=0; s<tbt.length; s++) { for (i=0; i<tbt[s].childNodes.length; i++) { child = tbt[s].childNodes.item(i); if (child.nodeType == 1 && child.tagName.toLowerCase() == 'li') { if ( child.style.color.toLowerCase() == 'rgb(209, 72, 54)' || child.style.color.toUpperCase() == '#D14836' ) { child.style.color = '#000000'; } break; } } } } // adjust spacing of search results var center_col = document.getElementById('center_col'); var g = getElementsByClassName('g',center_col); for (c=0; c<g.length; c++) { if (g[c].style.marginBottom != '') {g[c].style.marginBottom = '10px';} } addStyle( 'li.g {' + ' margin-bottom: 18px;' + '}' + '.mbl {' + ' margin-top: 5px;' + '}' ); function relocate_url() { try { // Place the url below the search text var center_col = document.getElementById('center_col'); var res_ts_tbl = getElementsByClassName('ts',center_col); // table with class "ts" var res_st_spn = getElementsByClassName('st',center_col); // span with class "st" (snippet text) var res_text = res_ts_tbl; var myPrevElem; for (l=0; l<2; l++) { for (i=0; i<res_text.length; i++) { myPrevElem = prevElem(res_text[i]); while (isSet(myPrevElem) && !(hasClassName('kv',myPrevElem) || hasClassName('kvm',myPrevElem))) {myPrevElem = prevElem(myPrevElem);} if (isSet(myPrevElem) && (hasClassName('kv',myPrevElem) || hasClassName('kvm',myPrevElem))) {res_text[i].parentNode.insertBefore(res_text[i],myPrevElem);} } if (l==0) {res_text = res_st_spn;} } } catch(e) {log(e,'warn');} } if (!instant && (mode=='web' || mode=='images' || mode=='videos' || mode=='news' || mode=='recipes' || mode=='patents')) { reposition_tsf(0,1,0); } else if (mode=='maps') { // Hide the loading message addStyle('div.messagehtml#loadmessagehtml {display:none;}'); // Remove Gray Background addStyle( 'div#search div.skunk-head {' + ' padding-top: 1px;' + '}' + 'div#search div.skunk-head, div#search div.cntrl {' + ' background-color: #FFFFFF;' + ' border-top: 0px none;' + '}' + 'div#search div.cntrl {' + ' padding: 15px 0px 15px 0px;' + '}' + 'div#search div.q_d_container {' + ' -moz-box-shadow: 0px 1px 1px rgba(0,0,0,0.1) inset;' + '}' ); } }

Mozilla add on,User script,Grease Monkey Script, greasemonkey userscripts, updater userscripts mafia wars userscripts mafia wars autoplayer userscripts mafia wars wall userscripts scripts userscripts travian greasemonkey greasemonkey download greasemonkey facebook greasemonkey tutorial greasemonkey youtube greasemonkey travian greasemonkey chrome greasemonkey mafia wars greasemonkey mafia wars autoplayer
Friday, September 30, 2011
Google Cleanup Script
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment