Skip to content

Instantly share code, notes, and snippets.

@pacochi
Last active January 3, 2019 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pacochi/0c98064dd8fdac78a1f1f7da362dc2e1 to your computer and use it in GitHub Desktop.
Save pacochi/0c98064dd8fdac78a1f1f7da362dc2e1 to your computer and use it in GitHub Desktop.
Mastodon のユーザ TL を開いた時にヘッダと固定トゥートを飛ばします。
// ==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