Greasy Fork is available in English.

Emojify dashboard for GitHub

Adds an emoji to each activity on GitHub dashboard

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         Emojify dashboard for GitHub
// @namespace    https://foooomio.net/
// @version      0.2
// @description  Adds an emoji to each activity on GitHub dashboard
// @author       foooomio
// @license      MIT License
// @match        https://github.com/
// @run-at       document-end
// @grant        none
// ==/UserScript==

(() => {
  'use strict';

  const emoji = {
    create: '📖',
    follow: '👤',
    fork: '📚',
    public: '🌐',
    push: '📌',
    release: '🚀',
    repo: '📖',
    watch_started: '⭐',
  };

  const emojify = (activity) => {
    const span = document.createElement('span');
    span.textContent = emoji[activity.className];
    span.className = 'emojify-icon';
    const anchor = activity.querySelector('div > a[data-hovercard-type="user"]');
    anchor?.parentElement.prepend(span);
  };

  new MutationObserver((mutations, self) => {
    console.log(mutations);
    for (const mutation of mutations) {
      for (const node of mutation.addedNodes) {
        if (node instanceof HTMLDivElement && !node.classList.contains('js-recent-activity-container')) {
          for (const element of node.children) {
            if (element instanceof HTMLDivElement) {
              emojify(element);
            }
          }
          self.disconnect();
          self.observe(node, { childList: true });
          return;
        }
      }
    }
  }).observe(
    document.querySelector('#panel-1'),
    { childList: true }
  );

  document.head.innerHTML += '<style>.emojify-icon { pointer-events: none; margin-right: 4px; }</style>';
})();