// ==UserScript==
// @name           Google personal blocklist
// @namespace      curipha
// @description    Remove sites from Google search results
// @include        http://www.google.tld/search?*
// @include        https://www.google.tld/search?*
// @version        0.2.0
// @grant          none
// ==/UserScript==

(function(){
  var block = [
    // General doorways
    'ceron.jp/', 'page2rss.com/', 'zenback.itmedia.co.jp/', '([^/]+.)?tweetbuzz.jp/',

    // Application doorways
    '[^/]+.softonic.jp/', 'www.freewarelovers.com/', 'www.appbrain.com/', '([^/]+.)?filehippo.com/',
    'www.altech-ads.com/',

    // SNS doorways
    '([^/]+.)?tweettunnel.com/', 'favstar.fm/', 'twtrp.jp/', 'twtrland.com/',

    // Knowledge communities
    '([^/]+.)?chiebukuro(.travel)?.yahoo.co.jp/', '([^/]+.)?okwave.jp/', 'questionbox.jp.msn.com/',
    'ziddy.japan.zdnet.com/', 'oshiete.goo.ne.jp/', 'soudan1.biglobe.ne.jp/', 'qanda.rakuten.ne.jp/',
    'www.itmedia.co.jp/qa/',

    // EC
    '(e?search|item).rakuten.co.jp/',

    // Anime leakers
    '([^/]*(anime|youtube)[^/]*|mvnavian).blog[0-9]*.(fc2.com|fc2blog.us)/',
    'anime.dougasouko.com/',

    // Torrents
    '([^/]+.)?nyaa.se',

    // Dll listing
    'systemexplorer.net/',

    // Mobile pages
    'www.amazon.co.jp/gp/aw/'
  ];

  var opacity = 0.2;
  var pattern = new RegExp('^https?:\/\/(?:' + block.join('|').replace(/([.\/])/g, '\\$1') + ')', 'i');
  var googler = /^https?:\/\/www\.google\.com\/url\?/i;
  var t = 0;

  var blocker =function() {
    if (t) return;
    ｔ = setTimeout(function() {
      var result = document.querySelectorAll('li.g');
      for (var li of result) {
        var a = li.querySelector('h3 a');
        if (typeof(a.href) !== 'string') continue;

        if (googler.test(a.href)) {
          var alturi = li.querySelector('cite._Rm').textContent;
          if (typeof(alturi) !== 'string') continue;

          var uri = /^https?:\/\//.test(uri) ? alturi : 'http://' + alturi;
        }
        else {
          var uri = a.href;
        }

        if (pattern.test(uri)) li.style.opacity = opacity;
      }

      t = 0;
    }, 240);
  };

  blocker();

  var mo = new MutationObserver(blocker);
  mo.observe(document.body, { childList: true, subtree: true });
})();

@@ -266,17 +266,17 @@
     0.2.
-0
+1
 %0A// @gra
@@ -1504,59 +1504,9 @@
 er =
-function() %7B%0A    if (t) return;%0A    %EF%BD%94 = setTimeout(
+ 
 func
@@ -1510,26 +1510,24 @@
 unction() %7B%0A
-  
     var resu
@@ -1570,18 +1570,16 @@
 ');%0A    
- 
- 
 for (var
@@ -1591,26 +1591,24 @@
 f result) %7B%0A
-  
       var a 
@@ -1633,24 +1633,46 @@
 ('h3 a');%0A  
+    if (!a) continue;%0A
       if (ty
@@ -1711,26 +1711,24 @@
 nue;%0A%0A      
-  
 if (googler.
@@ -1747,26 +1747,24 @@
 ) %7B%0A        
- 
- 
 var alturi =
@@ -1810,26 +1810,24 @@
 nt;%0A        
-  
 if (typeof(a
@@ -1856,24 +1856,77 @@
 ontinue;%0A%0A  
+      alturi = alturi.replace(/%5Cs+%5Cu203A%5Cs+/g, '/');%0A
         var 
@@ -1997,14 +1997,10 @@
     
-  %7D%0A  
+%7D%0A
     
@@ -2008,18 +2008,16 @@
  else %7B%0A
-  
         
@@ -2036,26 +2036,24 @@
 href;%0A      
-  
 %7D%0A%0A        i
@@ -2045,26 +2045,24 @@
    %7D%0A%0A      
- 
- 
 if (pattern.
@@ -2100,28 +2100,132 @@
 pacity;%0A    
+%7D%0A
   %7D
-%0A
+;%0A  var blocker_wrap = function() %7B%0A    if (t) return;%0A    %EF%BD%94 = setTimeout(function() %7B%0A      blocker();
 %0A      t = 0
@@ -2237,10 +2237,10 @@
  %7D, 
+1
 2
-4
 0);%0A
@@ -2298,16 +2298,21 @@
 (blocker
+_wrap
 );%0A  mo.

Improve stability