[Niko] Hide Custom Ranking Ads

2025年版ニコニコ カスタムランキングの広告行を非表示化

// ==UserScript==
// @name         [Niko] Hide Custom Ranking Ads
// @namespace    http://tampermonkey.net/
// @version      2025.06.06
// @description  2025年版ニコニコ カスタムランキングの広告行を非表示化
// @author       anonymous
// @match        https://www.nicovideo.jp/ranking/custom
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nicovideo.jp
// @grant        none
// @license      MIT
// ==/UserScript==

(async function() {
    'use strict';

    function hideAdRow()
    {
        let rows = document.querySelectorAll('.d_flex.gap_x1_5');

        // i=2からランキング行
        for(let i=2; i<rows.length; i++){
            let row = rows[i];
            let rank = row.querySelector('.w_x5')

            if (rank.children.length > 0) {
                //console.log('要素が含まれています');
            } else {

                row.style.display='none'
            }
        }
    }

    //--------------------------------
    hideAdRow();

    // 変化があったらとにかく消す
    const observer = new MutationObserver((mutations) => {
        Array.from(mutations).some((mutation) => {
                Array.from(mutation.addedNodes).some((node) => {
                    hideAdRow();
                });
            });
    });
    observer.observe(document.body, { childList: true, subtree: true });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址