Skip to content

Instantly share code, notes, and snippets.

@pacochi
Last active August 3, 2020 18:56
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/d1a8e019fdfc02235df7686af62d9895 to your computer and use it in GitHub Desktop.
Save pacochi/d1a8e019fdfc02235df7686af62d9895 to your computer and use it in GitHub Desktop.
Mastodon の静的ページで絵文字を動かします。
// ==UserScript==
// @name [Mastodon] animate emoji on static pages
// @namespace hen.acho.co
// @include /^https?:\/\/[^\/]+\/(?:@\w+|users\/\w+\/(?:statuses|updates))\/\d+/
// @version 1.200804
// @description We can 👀 animated emoji without logging in!
// @downloadURL https://gist.github.com/pacochi/d1a8e019fdfc02235df7686af62d9895/raw/mastodon_animate_emoji.user.js
// @run-at document-idle
// @grant none
// ==/UserScript==
{
document.querySelectorAll('img.emojione[alt^=":"]').forEach(cemoji => {
if (cemoji.dataset.static) return(cemoji.src = cemoji.dataset.static = cemoji.dataset.original);
const orig = cemoji.src;
cemoji.addEventListener('error', e => e.target.src = orig, { once: true });
cemoji.src = cemoji.src.replace(/\/static(\/.+\.png)/, '/original$1');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment