Omairi

  • /*
     * @title Omairi
     * @description mark omairi-ed entry on Quyo
     * @include http://quyo.hatelabo.jp/*
     * @license MIT http://opensource.org/licenses/MIT
     * @javascript_url
     */
    
    // recommend use w/ quyo random autopager(ize)
    // http://let.hatelabo.jp/yuta25/let/hJmezJuridFx
    // https://gist.github.com/vzvu3k6k/105bbfac74fe004c64b6
    
    // synergy w/ Jyobutsu
    // http://let.hatelabo.jp/noromanba/let/hJme0YXx6bYk
    
    (function () {
        if (!/^quyo\.hatelabo\.jp$/.test(location.hostname)) return;
    
        var selects = (function () {
            var slice = Array.prototype.slice,
                body = document.body;
    
            return function (query, ctx) {
                ctx = ctx || body;
                return slice.call(ctx.querySelectorAll(query));
            };
        })();
    
        var me = document.body.querySelector('.nav-user-icon a');
        if (!me || !me.href) return;
    
        var mark = function (ctx) {
            selects('article', ctx).forEach(function (article) {
                selects('.fav-user a', article).some(function (user) {
                    if (me.href === user.href) {
                        // e.g. 'cornsilk', 'floralwhite', 'linen', 'seashell'
                        article.style.backgroundColor = 'ivory';
                        return true;
                    }
                });
            });
        };
        mark();
    
        new MutationObserver(function (records) {
            records.forEach(function (record) {
                mark(record.target);
            });
        }).observe(document.body, { childList: true, subtree: true });
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/12/27 06:33:06 - 2014-12-27
  2. 2014/12/27 06:19:36 - 2014-12-27
  3. 2014/12/27 05:57:41 - 2014-12-27
  4. 2014/12/27 05:50:22 - 2014-12-27