Enable custom reacts fb messenger

Enable custom reacts fb mesg

目前為 2021-07-25 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Enable custom reacts fb messenger 
// @namespace    https://www.xda-developers.com
// @version      0.1
// @description  Enable custom reacts fb mesg
// @author       Adam Conway
// @match        https://www.messenger.com/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  const heart = '\u2764';
  const clown = '\u{1F921}';

  const heartEncoded = encodeURIComponent(heart);
  const clownEncoded = encodeURIComponent(clown);

  const promptText = `React with:
1: ${heart} (Heart),
2: ${clown} (Clown)`;


  const oldOpen = XMLHttpRequest.prototype.open;

  XMLHttpRequest.prototype.open = function() {
      const query = arguments[1];

      // Catch heart react specifically
      if (query.includes('ADD_REACTION') && query.includes(heartEncoded)) {
      // Get replacement reaction
      const new_reaction = Number.parseInt(prompt(promptText, '2'));

      // Replacing queries
      if (1 === new_reaction) {
        arguments[1] = query.replace(heartEncoded, heartEncoded);
      } else if (2 === new_reaction) {
        arguments[1] = query.replace(heartEncoded, clown);
      }
    }

    // Send
    oldOpen.apply(this, arguments);
  }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址