Last active
January 3, 2019 15:30
-
-
Save pacochi/0c98064dd8fdac78a1f1f7da362dc2e1 to your computer and use it in GitHub Desktop.
Mastodon のユーザ TL を開いた時にヘッダと固定トゥートを飛ばします。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name [Mastodon] scroll to latest toot | |
// @namespace hen.acho.co | |
// @include /^https?:\/\/[^\/]+\/(?:@|users\/)\w+(?:\/[a-z_]+)?(?:\?.+)?$/ | |
// @version 1.190104 | |
// @description skip header and pinned toots | |
// @downloadURL https://gist.github.com/pacochi/0c98064dd8fdac78a1f1f7da362dc2e1/raw/mastodon_scroll_to_latest.user.js | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
'use strict'; | |
const pin = [...document.querySelectorAll('.fa-thumb-tack')].pop(); | |
const latestToot = pin ? pin.parentNode.parentNode.parentNode.nextElementSibling | |
: document.querySelector('.entry, .card-grid'); | |
if (latestToot) latestToot.scrollIntoView(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment