치지직 팔로우 목록 자동 새로고침 + 자동 펼치기

팔로우 목록을 원하는 시간마다 반복 새로고침 + 팔로우 목록을 자동으로 전부 펼칩니다.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         치지직 팔로우 목록 자동 새로고침 + 자동 펼치기
// @namespace    http://tampermonkey.net/
// @version      25091101
// @description  팔로우 목록을 원하는 시간마다 반복 새로고침 + 팔로우 목록을 자동으로 전부 펼칩니다.
// @match        *://chzzk.naver.com/*
// @grant        none
// @author       Lusyeon | 루션
// @icon         https://chzzk.naver.com/favicon.ico
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    const refreshInterval = 60000; // 30초마다 새로고침 (Refresh every 30 seconds)
    const hideOffline = 0;         // 1이면 오프라인 숨김 (1 = Hide offline streamers)
    const Count = 0;               // 0이면 카운트 표시, 1이면 표시 안 함 (0 = Show count, 1 = Hide count)

    let isFirstRun = true;

    function clickRefreshButton() {
        const refreshBtn = document.querySelector('button.navigator_button__HhFim');
        if (refreshBtn) {
            refreshBtn.dispatchEvent(new MouseEvent('click', {
                bubbles: true,
                cancelable: true,
                view: window
            }));
        }
    }

    function clickAllMoreButtons(callback) {
        const moreBtn = document.querySelector('button[aria-label="더보기"][aria-expanded="false"]');
        if (moreBtn) {
            moreBtn.click();
            setTimeout(() => clickAllMoreButtons(callback), 700);
        } else {
            if (hideOffline === 1) hideOfflineItems();
            if (typeof callback === 'function') callback();
        }
    }

    function hideOfflineItems() {
        const items = document.querySelectorAll('#root aside ul > li');
        items.forEach(item => {
            const span = item.querySelector('span.blind');
            if (span?.textContent?.trim() === '오프라인') {
                item.style.display = 'none';
            }
        });
    }

function updateFollowCount() {
    if (Count === 1) return;

    const sectionTitle = [...document.querySelectorAll('strong.navigation_bar_title__1UBnx')]
        .find(el => el.textContent.includes('팔로잉 채널'));
    if (!sectionTitle) return;

    const section = sectionTitle.closest('nav');
    if (!section) return;

    const listItems = section.querySelectorAll('ul > li');

    const liveItems = [...listItems].filter(li => {
        const span = li.querySelector('span.blind');
        return span?.textContent?.trim() === 'LIVE';
    });

    const live = liveItems.length;
    const total = listItems.length;
    const totalDisplay = total >= 505 ? '505+' : total;

    let countSpan = sectionTitle.querySelector('span.follow-count');
    if (!countSpan) {
        countSpan = document.createElement('span');
        countSpan.className = 'follow-count';
        countSpan.style.marginLeft = '20px';
        countSpan.style.fontSize = '0.9em';
        countSpan.style.color = '#888';
        sectionTitle.appendChild(countSpan);
    }

    if (isFirstRun) {
        countSpan.textContent = `${live} / ${totalDisplay}`;

        if (total >= 505) {
            setTimeout(() => {
                countSpan.textContent = `${live}`;
            }, 5000);
        }

        isFirstRun = false;
    } else {
        countSpan.textContent = `${live}`;
    }
}

    function runInitial() {
        clickAllMoreButtons(updateFollowCount);
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', runInitial);
    } else {
        setTimeout(runInitial, 1500);
    }

    setInterval(() => {
        clickRefreshButton();
        setTimeout(() => clickAllMoreButtons(updateFollowCount), 2000);
    }, refreshInterval);
})();