Google Readerの購読ブックマークレット 改

公式のブックマークレットだと同一画面でReader画面に飛ばされてしまうので新規画面に飛ばすように書き換えてみた。

javascript:(function(){var b=document.body;var GR________bookmarklet_domain='http://www.google.com';if(b&&!document.xmlVersion){var c=false,e="/reader/view/";var h=this;Math.floor(Math.random()*2147483648).toString(36);function i(a,b){return a.indexOf(b)!=-1}(Date.now||function(){return+new Date;})();var j,l,m,n,p;function q(){return h.navigator?h.navigator.userAgent:null}function r(){return h.navigator}(function(){p=n=m=l=j=c;var a;if(a=q()){var b=r();j=a.indexOf("Opera")==0;l=!j&&a.indexOf("MSIE")!=-1;n=(m=!j&&a.indexOf("WebKit")!=-1)&&a.indexOf("Mobile")!=-1;p=!j&&!m&&b.product=="Gecko"}})();var u=j,v=l,w=p,x=m,y=function(){var a=r();return a&&a.platform||""}();(function(){i(y,"Mac");i(y,"Win");i(y,"Linux");r()&&i(r().appVersion||"","X11")})();(function(){var a="",b;if(u&&h.opera){a=h.opera.version;a=typeof a=="function"?a():a}else{if(w){b=/rv\:([^\);]+)(\)|;)/;}else if(v){b=/MSIE\s+([^\);]+)(\)|;)/;}else if(x){b=/WebKit\/(\S+)/;}if(b){a=(a=b.exec(q()))?a[1]:"";}}return a;})();var z;(function(){(z="ScriptEngine"in h&&h.ScriptEngine()=="JScript")&&h.ScriptEngineMajorVersion()+"."+h.ScriptEngineMinorVersion()+"."+h.ScriptEngineBuildVersion();})();function A(){function a(f){return f&&f.match(/[\+\/]xml$/)}function b(f){var g=f,o=window.document.location;if(f.indexOf("/")!=0){g=o.pathname.split("/");g[g.length-1]=f;g=g.join("/")}return o.protocol+"//"+o.hostname+g}for(var d=c,B=document.getElementsByTagName("link"),s=0,k;k=B[s];s++){var C=k.getAttribute("type"),t=k.getAttribute("rel");if(a(C)&&t&&t=="alternate"){d=k.getAttribute("href");if(d.indexOf("http")!=0){d=b(d);}window.open("http://www.google.com"+e+"feed/"+encodeURIComponent(d));d=true;break}}d||alert("Oops.Can't find a feed.")}A();}else{window.open('http://www.google.com/reader/view/feed/'+encodeURIComponent(location.href));}})()

見やすくすると、こういう事をしている

var b = document.body;
var GR________bookmarklet_domain = 'http://www.google.com';
if (b && !document.xmlVersion)
{
    var c = false, e = "/reader/view/";
    var h = this;
    Math.floor(Math.random() * 2147483648).toString(36);
    function i(a, b) 
    {
        return a.indexOf(b) !=- 1 
    }
    (Date.now || function () 
    {
        return + new Date;
    })();
    var j, l, m, n, p;
    function q() 
    {
        return h.navigator ? h.navigator.userAgent : null 
    }
    function r() 
    {
        return h.navigator 
    }
    (function () 
    {
        p = n = m = l = j = c;
        var a;
        if (a = q()) 
        {
            var b = r();
            j = a.indexOf("Opera") == 0;
            l = !j && a.indexOf("MSIE") !=- 1;
            n = (m = !j && a.indexOf("WebKit") !=- 1) && a.indexOf("Mobile") !=- 1;
            p = !j && !m && b.product == "Gecko" 
        }
    })();
    var u = j, v = l, w = p, x = m, y = function () 
    {
        var a = r();
        return a && a.platform || "" 
    }();
    (function () 
    {
        i(y, "Mac");
        i(y, "Win");
        i(y, "Linux");
        r() && i(r().appVersion || "", "X11") 
    })();
    (function () 
    {
        var a = "", b;
        if (u && h.opera) {
            a = h.opera.version;
            a = typeof a == "function" ? a() : a 
        }
        else 
        {
            if (w) {
                b = /rv\:([^\);]+)(\)|;)/;
            }
            else if (v) {
                b = /MSIE\s+([^\);]+)(\)|;)/;
            }
            else if (x) {
                b = /WebKit\/(\S+)/;
            }
            if (b) {
                a = (a = b.exec(q())) ? a[1] : "";
            }
        }
        return a;
    })();
    var z;
    (function () 
    {
        (z = "ScriptEngine"in h && h.ScriptEngine() == "JScript") && h.ScriptEngineMajorVersion() + "." + h.ScriptEngineMinorVersion() + "." + h.ScriptEngineBuildVersion();
    })();
    function A() 
    {
        function a(f) 
        {
            return f && f.match(/[\+\/]xml$/) 
        }
        function b(f) 
        {
            var g = f, o = window.document.location;
            if (f.indexOf("/") != 0) {
                g = o.pathname.split("/");
                g[g.length - 1] = f;
                g = g.join("/") 
            }
            return o.protocol + "//" + o.hostname + g 
        }
        for (var d = c, B = document.getElementsByTagName("link"), s = 0, k; k = B[s]; s++) 
        {
            var C = k.getAttribute("type"), t = k.getAttribute("rel");
            if (a(C) && t && t == "alternate") 
            {
                d = k.getAttribute("href");
                if (d.indexOf("http") != 0) {
                    d = b(d);
                }
                window.open( "http://www.google.com" + e + "feed/" + encodeURIComponent(d));
                d = true;
                break 
            }
        }
        d || alert("Oops. Can't find a feed.") 
    }
    A();
}
else
{
    window.open('http://www.google.com/reader/view/feed/' + encodeURIComponent(location.href));
}