zorome

ふたクロ使用時連番の投稿Noを強調表示する

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         zorome
// @namespace    https://www.2chan.net/
// @version      1.11
// @description  ふたクロ使用時連番の投稿Noを強調表示する
// @author       toniste
// @match        http://*.2chan.net/b/res/*
// @grant        none
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
// ==/UserScript==

function renban(){
    $(".no_quote").each(function(){
        let idArray = $(this).html().slice(3).split("");
        let id = "";
        let counter = 0;
        for(let i = 1; i < idArray.length; i++){
            if(idArray[idArray.length - i] == idArray[idArray.length - i - 1]){
                counter = i;
            } else if(counter == 0){
                break;
            } else {
                for(let j = 0; j < idArray.length - counter - 1; j++){
                    id = id + idArray[j];
                }
                id = "No." + id + "<font color='red'>"
                for(let j = idArray.length - counter - 1; j < idArray.length; j++){
                    id = id + idArray[j];
                }
                id = id + "</font>";
                $(this).html(id);
                break;
            }
        }
    });
}

(function() {
    renban();
})();


let refleshObserver = new MutationObserver(function(mutationRecords, _observer){
    renban();
});
refleshObserver.observe($('body').get(0), {childList:true, subtree:true});