[mastodon]いいねブーストした人を可視化

    @@ -1,14 +1,11 @@ // @title [mastodon]いいねブーストした人を可視化 // @description トゥートの個別ページでいいね・ブーストした人のアイコンを表示します。 // @include https://*/users/*/updates/* +// @include https://*/users/*/statuses/* // @include https://*/@*/* // @license MIT License // @javascript_url -/* -friends.nico は "アクセストークンが無効です。" ってエラー返ってくるからまた今度 -*/ - ((d = document, l, u, f) => { l = [...d.querySelectorAll('a.detailed-status__datetime, .detailed-status__meta>span')];
  • // @title [mastodon]いいねブーストした人を可視化
    // @description トゥートの個別ページでいいね・ブーストした人のアイコンを表示します。
    // @include https://*/users/*/updates/*
    // @include https://*/users/*/statuses/*
    // @include https://*/@*/*
    // @license MIT License
    // @javascript_url
    
    ((d = document, l, u, f) => {
    
    	l = [...d.querySelectorAll('a.detailed-status__datetime, .detailed-status__meta>span')];
    	if (l.length != 3) return;
    	u = l.shift().href.match(/^(.+?\/)@.+?(\/\d+)/);
    	if (!u) return;
    	/*
    	https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#statuses
    	<https://pawoo.net/api/v1/statuses/1271694/favourited_by?max_id=910177>; rel="next", <https://pawoo.net/api/v1/statuses/1271694/favourited_by?since_id=1646996>; rel="prev"
    	知らない形式の文字列が HTTP Header の Link についてた
    	*/
    	f = (n, t, c, s = u[1] + 'api/v1/statuses' + u[2] + t + (c > 40 ? '?limit=80' : '')) => (
    		c > 0 && fetch(s).then((r, h) => ((
    			r.headers.has('Link')
    			 && (h = r.headers.get('Link').match(/<(.+?)>; rel="next"/))
    			 && f(n, t, c, h[1])
    		), r.json())).then(j => (j.forEach ? j : []).forEach(a => 
    			n.appendChild(Object.assign(d.createElement('a'), {
    			 href: a.url, title: a.display_name
    			}))
    			.appendChild(Object.assign(d.createElement('img'), {
    			 src: a.avatar, style: 'width: 20px; height: 20px; margin: 0 2px;'
    			}))
    		))
    	);
    
    	l.forEach((n, i) => f(n, ['/reblogged_by', '/favourited_by'][i], n.textContent));
    
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/03/31 00:02:16 - 2018-03-31
  2. 2017/09/10 16:41:00 - 2017-09-10
  3. 2017/05/07 23:02:42 - 2017-05-07
  4. 2017/05/07 17:04:04 - 2017-05-07
  5. 2017/05/07 17:01:58 - 2017-05-07
  6. 2017/05/07 16:15:23 - 2017-05-07