t.um block

    @@ -28,11 +28,8 @@ ]), link => { // redirector syntax; // http://t.umblr.com/redirect?z=<ENCODED_URL>&t=<66_DIGIT_HASH>%3D%3D - let url = decodeURIComponent(new URL(link.href).search.slice(3)); - url = url.split('&'); - url.pop(); // remove "t=<66_DIGIT_HASH>%3D%3D" - - link.href = url.join('&'); + const url = (new URL(link.href).search.match(/(?:?|&)z=([^&]+?)/) || [])[1]; + link.href = decodeURIComponent(url); }); }; detox(document.body); @@ -44,3 +41,14 @@ }).observe(document.body, { childList: true, subtree: true }); })(); + +// DBG +/* +Array.from(document.querySelectorAll([ + '[href^="http://t.umblr.com/redirect?z="]', + '[src^="http://t.umblr.com/redirect?z="]' +]), link => link.tagName ).filter((val, idx, ary) => { + return ary.indexOf(val) === idx; +}); +*/ +
  • /*
     * @title t.um block
     * @description detox t.umblr.com link on tumblr.com
     * @include *://*.tumblr.com/*
     * @license CC0 Univ PD https://creativecommons.org/publicdomain/zero/1.0/legalcode
     * @javascript_url
     */
    
    // UserScript
    // https://gist.github.com/noromanba/76a3d7791cf6eaf1c94c
    
    // c.f.
    // http://ptech.g.hatena.ne.jp/noromanba/20160208/1454965267
    // https://stackoverflow.com/questions/35023389/tumblr-injecting-new-code-into-my-links
    
    // e.g.
    // http://yahoo.tumblr.com
    (() => {
        'use strict';
    
        const detox = (ctx) => {
            if (!ctx.querySelectorAll) return;
    
            Array.from(ctx.querySelectorAll([
                'a[href^="http://t.umblr.com/redirect?z="]',
                'area[href^="http://t.umblr.com/redirect?z="]'
                //'[src^="http://t.umblr.com/redirect?z="]'
            ]), link => {
                // redirector syntax;
                // http://t.umblr.com/redirect?z=<ENCODED_URL>&t=<66_DIGIT_HASH>%3D%3D
                const url = (new URL(link.href).search.match(/(?:?|&)z=([^&]+?)/) || [])[1];
                link.href = decodeURIComponent(url);
            });
        };
        detox(document.body);
    
        new MutationObserver(records => {
            records.forEach(record => {
                detox(record.target);
            });
        }).observe(document.body, { childList: true, subtree: true });
    })();
    
    
    // DBG
    /*
    Array.from(document.querySelectorAll([
        '[href^="http://t.umblr.com/redirect?z="]',
        '[src^="http://t.umblr.com/redirect?z="]'
    ]), link => link.tagName ).filter((val, idx, ary) => {
        return ary.indexOf(val) === idx;
    });
    */
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/02/12 05:20:12 - 2016-02-12
  2. 2016/02/12 05:00:14 - 2016-02-12
  3. 2016/02/12 04:58:48 - 2016-02-12
  4. 2016/02/10 07:14:20 - 2016-02-10
  5. 2016/02/09 07:07:47 - 2016-02-09
  6. 2016/02/09 06:58:31 - 2016-02-09
  7. 2016/02/09 06:16:43 - 2016-02-09
  8. 2016/02/09 04:56:04 - 2016-02-09
  9. 2016/02/09 04:55:05 - 2016-02-09
  10. 2016/02/09 04:42:41 - 2016-02-09