zorome

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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});