5ch_chikan2

5ちゃんねるの文字列を変換する。

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        5ch_chikan2
// @namespace   https://catherine.v0cyc1pp.com/5ch_chikan2.user.js
// @include     http://*.5ch.net/*
// @include     https://*.5ch.net/*
// @author      greg10
// @run-at      document-end
// @license     GPL 3.0
// @version     2.0
// @grant       none
// @description 5ちゃんねるの文字列を変換する。
// ==/UserScript==
console.log("5ch_chikan2 start");

//================================
// Configurations
//   - 変換文字列を指定してください。
var g_list = [
    ["/変換前の文字列/", "変換後の文字列"],
    ["/ブス/", "bs"],
];
//================================



// 置換
function chikan() {
    document.querySelectorAll("span,dd,.message,.name").forEach(function(elem) {
        var str = elem.innerHTML;
        //console.log("str="+str);
        if (str == null || str == undefined) {
            str = "";
        }
        for (var i = 0; i < g_list.length; ++i) {
            var pair = g_list[i];

            var mae = pair[0];
            var ato = pair[1];

            //console.log("mae="+mae);
            //console.log("ato="+ato);

            //var obj = new RegExp( mae, "i");
            var index = str.search(eval(mae));
            if (index != -1) {
                var result = str.replace(eval(mae), ato);
                elem.innerHTML = result;
            }
        }
    });
}

function main() {
    chikan();
}


main();