Guest User

Greasemonkey script to clean google search results ad crap

a guest
Apr 26th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        cleangoogle
  3. // @namespace   https://www.google.com/
  4. // @include     https://www.google.com/*
  5. // @include     http://www.google.com/*
  6. // @version     1.0.1
  7. // ==/UserScript==
  8.  
  9. (function () {
  10.  
  11. function getElementsById(id) {
  12.     return document.querySelectorAll("[id='" + id + "']");
  13. }
  14.  
  15.   var spam_text = 'spam'
  16.   var spam_style = "font-size: 0.5em; color: #d0d0d0; border: 1px dashed #d0d0d0;padding: 0px;"
  17.  
  18.   var center_col = document.getElementById('center_col');
  19.   if (center_col) {
  20.     center_col.setAttribute('style', 'padding-top: 0px;');
  21.   }
  22.  
  23.   // ids to hide
  24.   var hideme = new Array('tads', 'rhs_block');
  25.   for ( var x = 0; x < hideme.length; x++ ) {    // loop thru the hide id array
  26.     var ids = getElementsById(hideme[x]);
  27.     for ( var i = 0; i < ids.length; i++ ) {    // loop thru the ids
  28.       // ids[i].style['display'] = 'none';         // set the element not to show
  29.       ids[i].innerHTML = spam_text;
  30.       ids[i].setAttribute('style', ids[i].style.cssText + ";" + spam_style);
  31.     }
  32.   }
  33.  
  34. })();
Add Comment
Please, Sign In to add comment