View All Posts. MiCHiLU.com powered by Django ;-)

[ECMAScript]: LDRに はてスタ をつけるGreasemonkey

livedoor readerに はてなスター をつける。Safariで動くのが見つからなかったので。 何を監視すればいいのかわからず、てけとうに3秒待って表示。 便利だね、Greasemonkeyって。

ldr_with_hatenaster.user.js

// ==UserScript==
// @name        LDR with Hatena Star
// @namespace   http://michilu.com/
// @include     http://reader.livedoor.com/reader/*
// @version     0.1
// ==/UserScript==

// based on http://la.ma.la/blog/diary_200707121316.htm
// based on http://d.hatena.ne.jp/KGA/20070929/1190993663
// based on http://michilu.com/blog/posts/123/

(function(){
    var j = document.createElement('script');
    j.src = 'http://s.hatena.ne.jp/js/HatenaStar.js';
    j.charset = 'utf-8';
    document.body.appendChild(j);
    var w = typeof unsafeWindow != "undefined" ? unsafeWindow : window;
    var i = setInterval(function(){
            if (w.Hatena) {
                    clearInterval(i); i = null;
                    var s = w.Hatena.Star;
                    (function(){
                            s.SiteConfig = {
                                    entryNodes: {
                                            'div.item': {
                                                    uri: 'h2.item_title a',
                                                    title: 'h2.item_title',
                                                    container: 'h2.item_title'
                                            }
                                    }
                            };
                            w.channel_widgets.add('hatena_star', function(){
                                    var t = setTimeout(function(){
                                            clearTimeout(t); t = null;
                                            var e = s.EntryLoader;
                                            var entries = e.entries;
                                            e.entries = null;
                                            new e();
                                            if (entries) {
                                                    e.entries = Array.concat(entries, e.entries);
                                            };
                                    }, 3000);
                            });
                    })();
            };
    }, 100);
})();

livedoor readerにいろいろつける http://la.ma.la/blog/diary_200703221812.htm

Thu, 25 Oct 2007 16:07:23 +0900 source edit
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.1 Japan License.
View All Posts. MiCHiLU.com powered by Django ;-)