→ Show all feeds

  • /*
     * @title → Show all feeds 
     * @description Google Reader '→ Show all feeds ' Fix ver. based on http://googlereader.blogspot.com/2005/11/subscribing-to-feeds-via-little-google.html
     * @include http://*
     * @license as-is
     * @require 
     */
    
    var el = document.createElement('div');
    el.style.zIndex = 10000;
    el.style.position = 'absolute';
    el.style.padding = '2em';
    el.style.top = 0;
    el.style.backgroundColor = '#ffffcc';
    el.style.border = '1px solid #008000';
    el.style.color = '#000 !important';
    el.style.fontFamily = 'Arial, sans-serif';
    el.style.textAlign = 'left';
    el.innerHTML = 'View the following feeds in Google Reader:';
    
    var found = false;
    var links = document.getElementsByTagName('link');
    for (var i = 0, link; link = links[i]; i++) {
        var type = link.getAttribute('type');
        var rel = link.getAttribute('rel');
        var title = link.getAttribute('title');
        if (type && (type == 'application/rss+xml' || type == 'application/atom+xml') && rel && rel == 'alternate') {
            var href = link.getAttribute('href');
            if (!href.match(/^http/)) {
                var path = (href.match(/^\//)) ? '/' : location.pathname;
                href = 'http://' + location.hostname + path + href;
            }
            var previewLink = document.createElement('a');
            //previewLink.href = ' http://google.com/reader/preview/*/feed/' + href;
            previewLink.href = ' http://google.com/reader/view/feed/' + encodeURIComponent(href);
            previewLink.innerHTML = ((title) ? title : '') + ' - ' + href;
            previewLink.style.display = 'block';
            previewLink.style.color = '#00c';
            previewLink.style.textDecoration = 'underline';
            el.appendChild(previewLink);
            found = true;
            }
        }
        
        var close = document.createElement('a');
        close.innerHTML = 'Hide this box';
        close.href = '#';
        close.style.display = 'block';
        close.style.marginTop = '2em';
        close.style.color = '#00c';
        close.style.textDecoration = 'underline';
        close.onclick=function() {
            el.style.display='none';
            return false;
        };
        el.appendChild(close);
        
        function Google_AddFeedBox() {
            document.body.appendChild(el);
            y = window.scroll(0, 0);
        }
        if (!found) alert('Oops. Can\'t find any feeds for this page.');
        else void (z = Google_AddFeedBox());
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2012/01/31 03:04:49 - 2012-01-31
  2. 2012/01/31 02:54:28 - 2012-01-31
  3. 2012/01/27 08:42:20 - 2012-01-27
  4. 2011/06/27 04:22:05 - 2011-06-27