2006-11-10-Fri ぐりもん
Google Readerでfaviconを表示
programming | |
![]()
Google Readerを使い始めました。まだまだなイマイチなところはあるけれど、Labs入りなのでお試し中ですね。
で、
にインスパイアされて、Google Readerでfaviconを表示させるGreasemonkeyスクリプトを作りました。
faviconwithgooglereader.user.jsをインストール
『ARRAY(0x262b8fb0)』の改良 - ドレッシングのようなを参考に、faviconが無い場合にデフォルトアイコンを表示できるようにもしました。
var showBlankIcon = true;
にしてください。
上記の3名様、Google Reader開発者、Greasemonkey開発者、Firefox開発者、そしてすべてのひとに感謝を。
いちおソースは以下。コピペがばれます。
更新
.com以外のドメインにも対応しました.Yasimaさんありがとうございます。
更新
表示を修正しました。id:turipatさんありがとうございます。
// ==UserScript== // @name Favicon with Google Reader // @namespace http://libelabo.jp/ // @description A script to add favicons next to links on Google Reader // @include http://www.google.tld/reader/view/* // @include https://www.google.tld/reader/view/* // ==/UserScript== (function() { var showBlankIcon = false; var timerID = null; function findNode(root, xpath) { var result = document.evaluate(xpath, root, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); if (! result.snapshotLength) return null; return result.snapshotItem(0); } function addFaviconToNode(link,node) { var favicon = document.createElement('img'); favicon.setAttribute('class', 'entry-favicon'); favicon.src = "http://" + link.hostname + "/favicon.ico"; favicon.width = 16; favicon.alt = ""; favicon.style.border = "0"; favicon.align = "top"; if( showBlankIcon ){ var g = link.parentNode; var favicon_container = document.createElement('div'); favicon_container.style.cssFloat = 'left'; favicon_container.style.minWidth = '16px'; favicon_container.style.minHeight = '16px'; favicon_container.style.backgroundImage = 'url("chrome://global/skin/icons/folder-item.png")'; favicon_container.appendChild(favicon); node.parentNode.insertBefore(favicon_container,node); } else{ favicon.style.marginRight = "1ex"; node.parentNode.insertBefore(favicon,node); } } function getFaviconImg(node){ return findNode(node,'.//img[@class="entry-favicon"]'); } function addFavicons() { var entries = document.getElementById('entries'); for (var i=0; i< entries.childNodes.length; i++) { var entry = entries.childNodes[i]; var collapsedTitle = findNode(entry, './/div[@class="collapsed"]//h2'); var entryContainerTitle = findNode(entry, './/div[@class="entry-container"]//h2'); var link = null; var title = null; if (entryContainerTitle != null) { link = entryContainerTitle.firstChild; title = link.firstChild.textContent; } else if (collapsedTitle != null) { link = collapsedTitle.parentNode.parentNode.firstChild; title = collapsedTitle.textContent; } if ( link != null ){ if ( entryContainerTitle != null && getFaviconImg(entryContainerTitle) == null ){ addFaviconToNode(link,link.firstChild); } else if (collapsedTitle != null && getFaviconImg(link.parentNode) == null){ addFaviconToNode(link,collapsedTitle); } } } } timerID = setInterval(addFavicons, 3000); })();
トラックバック - http://d.hatena.ne.jp/kei-s/20061110/1163182451
- http://d.hatena.ne.jp/nozom/20061113
- Web型RSSリーダ カスタマイズまとめ
- http://d.hatena.ne.jp/nozom/20061113
- http://d.hatena.ne.jp/jiangh/20061205
- http://d.hatena.ne.jp/cubism/20070402
- http://d.hatena.ne.jp/cubism/20070307
- 方向性∞ - Greasemonkey×はてな×Favicon×Google Reader[f:id:NT...
- Google Reader Full Feed + autoload 使いてぇ。。
- 光陰矢の如しだから - また少しずつ重くなる
- 続・教えて!Turing先生 - Google Reader を読むのに便利な Firefox...
- かずめも ラジカル - Debianのある生活 - - RSS Reader
- 思いつきブログ2 - Googleリーダーに登録したGreasemonkey3つ
リンク元
- 3037 http://antarespc.com/web-browser/google-reader-greasemonkey.html
- 1199 http://d.hatena.ne.jp/nozom/20061113/1163372094
- 1051 http://kengo.preston-net.com/archives/002948.shtml
- 827 http://watch.s22.xrea.com/blog/archives/0801290027.html
- 335 http://watch.s22.xrea.com/blog/archives/0611132052.html
- 309 http://userscripts.org/scripts/show/27739
- 303 http://www.kagitaku.com/diary
- 175 http://fxwiki.blog63.fc2.com/blog-entry-116.html
- 157 http://blog.rimikcolor.com/archives/638
- 128 http://www.sprouthead.com/blog/firefox/firefox_google_reader.html







ところで、現行のデザインだとレイアウトが微妙に崩れてしまうようです。
16 行目あたりに
favicon.align = "top";
を追加することで当方の環境では回避できました。報告まで。