「ご使用のネットワークから大量のリクエストを受信したため中断しました。」for はてなアンテナ

    @@ -2,10 +2,63 @@ * @title 「ご使用のネットワークから大量のリクエストを受信したため中断しました。」 * @description http://cache.gyazo.com/fcbe33583beb6ac5dd0c6df5249c83bb.png * @include http://a.hatena.ne.jp/* - * @license MIT License - * @require https://gist.github.com/cho45/3238/raw/dollarX.js */ $X('descendant::text()[contains(self::text(), "ご使用のネットワークから大量のリクエストを受信したため中断しました。")]/../..').forEach(function (n) { - n.style.display = "none"; -}) + n.style.display = "none"; +}) + +// https://gist.github.com/cho45/3238 +// extend version of $X +// $X(exp); +// $X(exp, context); +// $X(exp, type); +// $X(exp, context, type); + + +function $X(exp, context, type /* want type */ ) { + if (typeof context == "function") { + type = context; + context = null; + } + if (!context) context = document; + exp = (context.ownerDocument || context).createExpression(exp, function(prefix) { + var o = document.createNSResolver(context)(prefix); + if (o) return o; + return (document.contentType == "application/xhtml+xml") ? "http://www.w3.org/1999/xhtml" : ""; + }); + + switch (type) { + case String: + return exp.evaluate(context, XPathResult.STRING_TYPE, null).stringValue; + case Number: + return exp.evaluate(context, XPathResult.NUMBER_TYPE, null).numberValue; + case Boolean: + return exp.evaluate(context, XPathResult.BOOLEAN_TYPE, null).booleanValue; + case Array: + var result = exp.evaluate(context, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var ret = [], i = 0, len = result.snapshotLength; i < len; i++) { + ret.push(result.snapshotItem(i)); + } + return ret; + case undefined: + var result = exp.evaluate(context, XPathResult.ANY_TYPE, null); + switch (result.resultType) { + case XPathResult.STRING_TYPE: + return result.stringValue; + case XPathResult.NUMBER_TYPE: + return result.numberValue; + case XPathResult.BOOLEAN_TYPE: + return result.booleanValue; + case XPathResult.UNORDERED_NODE_ITERATOR_TYPE: + // not ensure the order. + var ret = [], + i = null; + while ((i = result.iterateNext())) ret.push(i); + return ret; + } + return null; + default: + throw (TypeError("$X: specified type is not valid type.")); + } +}
  • /*
     * @title 「ご使用のネットワークから大量のリクエストを受信したため中断しました。」
     * @description http://cache.gyazo.com/fcbe33583beb6ac5dd0c6df5249c83bb.png
     * @include http://a.hatena.ne.jp/*
     */
    
    $X('descendant::text()[contains(self::text(), "ご使用のネットワークから大量のリクエストを受信したため中断しました。")]/../..').forEach(function (n) {
        n.style.display = "none";
    })
    
    // https://gist.github.com/cho45/3238
    // extend version of $X
    // $X(exp);
    // $X(exp, context);
    // $X(exp, type);
    // $X(exp, context, type);
    
    
    function $X(exp, context, type /* want type */ ) {
        if (typeof context == "function") {
            type = context;
            context = null;
        }
        if (!context) context = document;
        exp = (context.ownerDocument || context).createExpression(exp, function(prefix) {
            var o = document.createNSResolver(context)(prefix);
            if (o) return o;
            return (document.contentType == "application/xhtml+xml") ? "http://www.w3.org/1999/xhtml" : "";
        });
    
        switch (type) {
        case String:
            return exp.evaluate(context, XPathResult.STRING_TYPE, null).stringValue;
        case Number:
            return exp.evaluate(context, XPathResult.NUMBER_TYPE, null).numberValue;
        case Boolean:
            return exp.evaluate(context, XPathResult.BOOLEAN_TYPE, null).booleanValue;
        case Array:
            var result = exp.evaluate(context, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
            for (var ret = [], i = 0, len = result.snapshotLength; i < len; i++) {
                ret.push(result.snapshotItem(i));
            }
            return ret;
        case undefined:
            var result = exp.evaluate(context, XPathResult.ANY_TYPE, null);
            switch (result.resultType) {
            case XPathResult.STRING_TYPE:
                return result.stringValue;
            case XPathResult.NUMBER_TYPE:
                return result.numberValue;
            case XPathResult.BOOLEAN_TYPE:
                return result.booleanValue;
            case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
                // not ensure the order.
                var ret = [],
                    i = null;
                while ((i = result.iterateNext())) ret.push(i);
                return ret;
            }
            return null;
        default:
            throw (TypeError("$X: specified type is not valid type."));
        }
    }
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/03/12 17:31:30 - 2013-03-12
  2. 2013/03/04 23:54:38 - 2013-03-04
  3. 2013/02/28 18:24:06 - 2013-02-28
  4. 2013/02/28 18:21:24 - 2013-02-28
  5. 2013/02/28 18:16:34 - 2013-02-28