=A!

    @@ -1,64 +1,46 @@ /* - * @title A! - * @description Hatena Antenna manual force checker - * @include * - * @license MIT License https://opensource.org/licenses/MIT + * @title =A! + * @description Hatena Antenna force bulk checker + * @include http://a.hatena.ne.jp/<HATENA_ID>/checklist + * @contributor noromanba http://let.hatelabo.jp/noromanba/let/hLHUks7xoqN9 + * @license MIT License https://opensource.org/licenses/MIT * @javascript_url + * @private waiting review */ -// Hatena Antenna system malfunction c.f. -// http://h.hatena.ne.jp/noromanba/81804280707167117 -// http://h.hatena.ne.jp/noromanba/316272955840853531 -// -// http://hatena.g.hatena.ne.jp/hatenaantenna/20171225/1514168462 -// http://hatena.g.hatena.ne.jp/hatenaantenna/20171226/1514280285 -// https://twitter.com/hatenamaint/status/945585471702179840 - -// TODO bulk check on antenna list -// http://a.hatena.ne.jp/<HATENA_ID>/checklist -// NOTE must be register before checking -(() => { +// TODO +// - try-catch +// - server safe, avoid (D)DoS + +// login required +(async () => { 'use strict'; - // https://gist.github.com/noromanba/d730ccf3ae5e6916cd60 - const canonical = (document.querySelector([ - 'head meta[property="og:url"][content]' - ]) || {}).content || - (document.querySelector([ - 'head link[rel="canonical"][href]' - ]) || {}).href || - location.href; - - - // manual checker syntax; - // http://a.hatena.ne.jp/check?url=<ENCODED_URL>[&robots=1] - // min interval: 5min c.f. - // http://a.hatena.ne.jp/check?url= - const checker = new URL('http://a.hatena.ne.jp/check'); - checker.searchParams.set('url', canonical); - checker.searchParams.set('robots', 1); - - /*/ - // silent exec - // XXX can't over CSP, Mixed Content and Extensions blocking - //Object.assign(document.createElement('img'), { - // src: checker.href, - //}); - - // FIXME silent alternative, but don't work c.f. - // http://let.hatelabo.jp/noromanba/let/hLHXvenproxG - //document.body.appendChild(Object.assign(document.createElement('iframe'), { - // src: checker.href, - // sandbox: [ - // 'allow-scripts', - // 'allow-forms', - // 'allow-same-origin', - // ].join(' '), - //})); - /*/ - // blocking workaround - const result = window.open(checker.href, '_blank'); - //result.close(); - //*/ + document.body.querySelectorAll([ + 'a[href^="./editpage?cid="]', + ]).forEach(async content => { + const edit = await window.fetch(content.href, { + // use cookie + credentials: 'same-origin', + // XXX ignoring charset + headers: new Headers().set('Content-Type', 'text/html;charset=euc-jp'), + }); + const txt = await edit.text(); + // TBD DOMParser() + const url = (txt.match(/^<td><a href="(https?[^"]+)"\s+target="_blank"/m) || [])[1]; + if (!url) return; + + // manual checker syntax; + // http://a.hatena.ne.jp/check?url=<ENCODED_URL>[&robots=1] + // min interval: 5min c.f. + // http://a.hatena.ne.jp/check?url= + const checker = new URL('http://a.hatena.ne.jp/check'); + checker.searchParams.set('url', url); + + // working? + await window.fetch(checker.href, { + credentials: 'same-origin', + }); + }); })();
  • /*
     * @title =A!
     * @description Hatena Antenna force bulk checker
     * @include http://a.hatena.ne.jp/<HATENA_ID>/checklist
     * @contributor noromanba   http://let.hatelabo.jp/noromanba/let/hLHUks7xoqN9
     * @license     MIT License https://opensource.org/licenses/MIT
     * @javascript_url
     * @private waiting review
     */
    
    // TODO
    //  - try-catch
    //  - server safe, avoid (D)DoS
    
    // login required
    (async () => {
        'use strict';
    
        document.body.querySelectorAll([
            'a[href^="./editpage?cid="]',
        ]).forEach(async content => {
            const edit = await window.fetch(content.href, {
                // use cookie
                credentials: 'same-origin',
                // XXX ignoring charset
                headers: new Headers().set('Content-Type', 'text/html;charset=euc-jp'),
            });
            const txt = await edit.text();
            // TBD DOMParser()
            const url = (txt.match(/^<td><a href="(https?[^"]+)"\s+target="_blank"/m) || [])[1];
            if (!url) return;
    
            // manual checker syntax;
            //      http://a.hatena.ne.jp/check?url=<ENCODED_URL>[&robots=1]
            // min interval: 5min c.f.
            //  http://a.hatena.ne.jp/check?url=
            const checker = new URL('http://a.hatena.ne.jp/check');
            checker.searchParams.set('url', url);
    
            // working?
            await window.fetch(checker.href, {
                credentials: 'same-origin',
            });
        });
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/01/21 04:18:00 - 2018-01-21
  2. 2018/01/02 10:48:20 - 2018-01-02
  3. 2018/01/02 10:31:06 - 2018-01-02
  4. 2017/12/31 06:44:10 - 2017-12-31
  5. 2017/12/30 06:18:15 - 2017-12-30
  6. 2017/12/30 05:37:53 - 2017-12-30
  7. 2017/12/27 08:56:10 - 2017-12-27
  8. 2017/12/27 08:07:28 - 2017-12-27
  9. 2017/12/27 07:44:21 - 2017-12-27
  10. 2017/12/27 07:27:35 - 2017-12-27
  11. 2017/12/27 07:25:24 - 2017-12-27