Greasy Fork is available in English.

VK: Hide Typing

look @name

Pada tanggal 26 April 2021. Lihat %(latest_version_link).

// ==UserScript==
// @name           VK: Hide Typing
// @name:ru        ВК: Скрыть набор текста
// @description    look @name
// @description:ru Смотри @name:ru
// @namespace      hidetyping.user.js
// @version        0.4
// @match          https://*.vk.com/*
// @exclude        https://im.vk.com/*
// @noframes
// ==/UserScript==

'use strict';

const PROXY = {
  'vk.com': () => {
    const _XMLHttpRequest = XMLHttpRequest.prototype;
    _XMLHttpRequest.send = new Proxy(_XMLHttpRequest.send, {
      apply(target, thisArg, argumentsList) {
        const [ query ] = argumentsList;
        if (/typing|audiomessage/.test(query)) return null;
        return Reflect.apply(target, thisArg, argumentsList);
      },
    });
  },
  'm.vk.com': () => {
    const _fetch = window.fetch;
    window.fetch = (input, init = {}) => {
      const _input = input.clone();
      return input
        .formData()
        .then((x) => [...x.values()].includes('typing'))
        .then((isTyping) =>
          isTyping ? new Promise(() => null) : _fetch(_input, init)
        );
    };
  },
};

const { host } = location;

const script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.textContent = `(${PROXY[host].toString()})()`;
document.head.append(script);