OWOT Purpleizer

Turns most OWOT messages starting with '<' purple.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         OWOT Purpleizer
// @namespace    greasyfork.org/en/users/1213777-logan-usw
// @version      1.0.0
// @description  Turns most OWOT messages starting with '<' purple.
// @author       logan.usw
// @match        https://ourworldoftext.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=ourworldoftext.com
// @license      MIT
// @grant        none
// ==/UserScript==

(() => {

function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}
// global variable for purple text
var $041db87cc4b43330$exports = {};
$041db87cc4b43330$exports = ".message__content--purple {\n  color: #825fdb;\n}\n";


window.chatPurpleText = true;
const $957b0f1b8a4ef7fc$var$purpleTextCSS = document.createElement("style");
$957b0f1b8a4ef7fc$var$purpleTextCSS.innerHTML = (0, (/*@__PURE__*/$parcel$interopDefault($041db87cc4b43330$exports)));
document.head.appendChild($957b0f1b8a4ef7fc$var$purpleTextCSS);
const $957b0f1b8a4ef7fc$var$chatWatcher = new MutationObserver($957b0f1b8a4ef7fc$var$analyzeMsgs) // mutation observer to scan new messages
;
// analyze new chat messages
function $957b0f1b8a4ef7fc$var$analyzeMsgs(mutations) {
    mutations.forEach((message)=>{
        const msgElem = message.addedNodes[0]?.lastChild, msgContent = msgElem.textContent.trim() // message without start & end spaces
        ;
        // starts with '<' = purple text except if it's possibly a html tag or haert
        if (window.chatPurpleText && msgContent.startsWith("<") && msgContent !== "<3" && !msgContent.includes('>')) msgElem.classList.add("message__content--purple");
    });
}
// start watching page & global
$957b0f1b8a4ef7fc$var$chatWatcher.observe(elm.page_chatfield, {
    attributes: false,
    childList: true,
    characterData: false,
    subtree: false
});
$957b0f1b8a4ef7fc$var$chatWatcher.observe(elm.global_chatfield, {
    attributes: false,
    childList: true,
    characterData: false,
    subtree: false
});

})();