Togetterのツイート装飾を取り除く

    
      
  • /*
     * @title Togetterのツイート装飾を取り除く
     * @include https://togetter.com/li/*
     * @license MIT License
     * @javascript_url
     */
    
    (function() {
        'use strict';
    
        const tweet_box = document.querySelector('.tweet_box');
    
        const clearDecoration = ul => {
            for (const span of ul.querySelectorAll('.tweet span')) {
                const parent = span.parentNode;
                while (span.firstChild) {
                    parent.insertBefore(span.firstChild, span);
                }
                parent.removeChild(span);
            }
        };
    
        new MutationObserver(mutations => {
            for (const mutation of mutations) {
                for (const node of mutation.addedNodes) {
                    if (node.nodeName ==='UL') {
                        clearDecoration(node);
                    }
                }
            }
        }).observe(tweet_box, {childList: true});
    
        clearDecoration(tweet_box.querySelector('ul'));
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/02/12 11:19:24 - 2017-02-12