ZOVspeak

Makes every webpage go full ZOV

Verze ze dne 22. 11. 2023. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name            ZOVspeak
// @name:ru         ZOVspeak
// @namespace       Violentmonkey Scripts
// @match           *://*/*
// @grant           none
// @version         1.0
// @author          -
// @description     Makes every webpage go full ZOV
// @description:ru  Этот скрипт сделает любую веб-страницу чуточку уютнее и роднее, если Vы пOнимаете, O чём я.
// @license MIT
// ==/UserScript==

const replaceZOVString = (s) => {
  return s
    .replace(/[Зз]/g, 'Z')
    .replace(/[Вв]/g, 'V')
    .replace(/[Оо]/g, 'O');
}

const replaceZOVHTML = (element) => {
  element.childNodes.forEach((node) => replaceZOVHTML(node));
  if (element.nodeType == Node.TEXT_NODE) {
    const newValue = replaceZOVString(element.nodeValue);
    if (element.nodeValue !== newValue) {
      element.nodeValue = newValue;
    }
  }
}

const observer = new MutationObserver(
  (mutationList, observer) => {
    for (const mutation of mutationList) {
      switch (mutation.type) {
        case 'childList':
          mutation.addedNodes.forEach(replaceZOVHTML);
          break;
        case 'attributes':
          break;
        case 'characterData':
          replaceZOVHTML(mutation.target);
          break;
        case 'subtree':
          break;
      }
    }
  }
);

observer.observe(document, {
  childList: true,
  // attributes: true,
  characterData: true,
  subtree: true
});

const onLoad = () => {
  replaceZOVHTML(document.getElementsByTagName('html')[0]);
}

window.addEventListener('load', onLoad, false);