InstaSynchP Emote Names

Show emote names when hovering over the image

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        InstaSynchP Emote Names
// @namespace   InstaSynchP
// @description Show emote names when hovering over the image

// @version     1.0.5
// @author      Zod-
// @source      https://github.com/Zod-/InstaSynchP-Emote-Names
// @license     MIT

// @include     *://instasync.com/r/*
// @include     *://*.instasync.com/r/*
// @grant       none
// @run-at      document-start

// @require     https://greasyfork.org/scripts/5647-instasynchp-library/code/InstaSynchP%20Library.js?version=37716
// ==/UserScript==

function EmoteNames(version) {
  "use strict";
  this.version = version;
  this.name = 'InstaSynchP Emote Names';
}

EmoteNames.prototype.executeOnce = function () {
  "use strict";
  events.on(this, 'AddMessage', function () {
    //check all <img> in case there can be more in the future
    $('#chat_messages > :last-child > span.message > img').each(function () {
      var emote;
      for (emote in window.$codes) {
        if (window.$codes.hasOwnProperty(emote) &&
          window.$codes[emote].contains($(this).attr('src'))) {
          $(this).attr('title', emote);
          break;
        }
      }
    });
  });
};

window.plugins = window.plugins || {};
window.plugins.emoteNames = new EmoteNames('1.0.5');