Mastodon - Auto CW opener

    @@ -6,11 +6,15 @@ * @javascript_url */ -((target, proc) => (new MutationObserver(m=>m.forEach(proc)).observe(target, {childList:1, subtree:1}), proc({target})))( +/* + .status-listをtargetとして複数降ってくることが多いので、targetをそのまま反復するのは無駄が多い。 + addedNodesを見る or mutationRecordsは無視して監視対象のコンテナからquerySelector、するのがよさそう。 +*/ +((target, proc) => (new MutationObserver(m=>m.forEach(r=>proc(r.addedNodes))).observe(target, {childList:1, subtree:1}), proc([target])))( document.querySelector('.columns-area'), - ({target}) => { + nodes => { // open CW - $(target).find('.status__content:has(> :nth-child(3)) .status__content__spoiler-link span').click(); + $(nodes).find('.status__content:has(> :nth-child(3)) .status__content__spoiler-link span').click(); // open media spoiler - // $(target).find('.media-spoiler').click(); + // $(nodes).find('.media-spoiler').click(); });
  • /*
     * @title Mastodon - Auto CW opener
     * @description CWを自動で開きます。まる。
     * @include http://*/web/*
     * @license MIT License
     * @javascript_url
     */
    
    /*
      .status-listをtargetとして複数降ってくることが多いので、targetをそのまま反復するのは無駄が多い。
      addedNodesを見る or mutationRecordsは無視して監視対象のコンテナからquerySelector、するのがよさそう。
    */
    ((target, proc) => (new MutationObserver(m=>m.forEach(r=>proc(r.addedNodes))).observe(target, {childList:1, subtree:1}), proc([target])))(
        document.querySelector('.columns-area'),
        nodes => {
            // open CW
            $(nodes).find('.status__content:has(> :nth-child(3)) .status__content__spoiler-link span').click();
            // open media spoiler
            // $(nodes).find('.media-spoiler').click();
        });
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/10/04 22:51:19 - 2018-10-04
  2. 2018/08/24 23:52:34 - 2018-08-24
  3. 2017/05/15 00:59:34 - 2017-05-15
  4. 2017/05/14 20:58:28 - 2017-05-14
  5. 2017/05/06 21:34:26 - 2017-05-06
  6. 2017/05/06 21:23:59 - 2017-05-06
  7. 2017/05/06 21:10:23 - 2017-05-06
  8. 2017/05/06 20:27:54 - 2017-05-06
  9. 2017/05/06 20:12:43 - 2017-05-06