kone
소미소프트

소미소프트

댓글 자동확장 개선 스크립트

05/31/2025, 08:06:09
유틸
2302 views · 6 likes

https://kone.gg/s/somisoft/b3Kid-M_YjOKD_kofh5zyb

여기 이분 스크립트에서 챗지피티로 댓글 확장 코드만 추출 후 개선한 스크립트입니다. 문제시 글삭함

원본 작성자가 삭제 요청시 글내림(허락받음ㅎ). 오류 생기면 스크립트 삭제 추천


1

원본 댓글 확장은 대댓 확장만 자동이고 댓글 더 불러오기는 자동이 아니라서 추가했습니다.


1
1

템퍼몽키 확장프로그램 받으시고 새 스크립트 만들기 > 안에 내용 지우고 스크립트 복붙 > 파일 저장


아래는 스크립트입니다.

// ==UserScript==
// @name         kone 댓글 자동 확장 + 더 불러오기
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  kone.gg에서 댓글을 자동으로 확장하고 '댓글 더 불러오기'도 자동 클릭합니다.
// @author       김머시기
// @match        https://kone.gg/*
// @grant        none
// @license      MIT
// @run-at       document-idle
// ==/UserScript==

(function () {
    'use strict';

    function clickAllExpandButtons() {
        const expandButtons = document.querySelectorAll('button');
        let clickedAny = false;

        expandButtons.forEach(button => {
            try {
                const text = button.textContent.trim();
                const isCommentExpand = /^\d+개의 댓글$/.test(text);
                const isLoadMore = text === '댓글 더 불러오기';

                if ((isCommentExpand || isLoadMore) && button.offsetParent !== null) {
                    button.click();
                    clickedAny = true;
                }
            } catch (e) {
                // 무시
            }
        });

        if (clickedAny) {
            // 여전히 확장할 수 있는 버튼이 남아있을 수 있으므로 재귀 호출
            setTimeout(clickAllExpandButtons, 500);
        }
    }

    function updateGlobalStyles() {
        const styleFix = document.createElement('style');
        styleFix.textContent = `
            .comment-wrapper,
            .comment-wrapper .overflow-x-auto,
            .comment-wrapper .overflow-hidden,
            .thread-body-content .overflow-hidden {
                overflow: visible !important;
                max-height: none !important;
            }
        `;
        document.head.appendChild(styleFix);
    }

    function runCommentFix() {
        clickAllExpandButtons();
        updateGlobalStyles();
    }

    const observer = new MutationObserver(() => {
        clearTimeout(commentFixTimer);
        commentFixTimer = setTimeout(runCommentFix, 100);
    });

    let commentFixTimer = null;

    observer.observe(document.body, { childList: true, subtree: true });
    observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });

    function observeURLChange() {
        let lastUrl = location.href;

        const urlChangeHandler = () => {
            if (location.href !== lastUrl && location.href.includes('/s/')) {
                lastUrl = location.href;
                setTimeout(runCommentFix, 500);
            }
        };

        const urlObserver = new MutationObserver(urlChangeHandler);
        urlObserver.observe(document.body, { childList: true, subtree: true });

        const originalPush = history.pushState;
        history.pushState = function () {
            originalPush.apply(this, arguments);
            urlChangeHandler();
        };

        window.addEventListener('popstate', urlChangeHandler);
    }

    const init = () => {
        runCommentFix();
        observeURLChange();
    };

    if (document.readyState === 'complete' || document.readyState === 'interactive') {
        init();
    } else {
        document.addEventListener('DOMContentLoaded', init);
    }
})();
6
1 comment
07/30/25
개추콘
MV, MZ 대사 스킵 플러그인
유틸
r4gsdrg
04/11 13920 19
코이카츠 프리셋 히가시 통팩 보강
유틸
pst0025
04/11 11692 27
(코이카츠) 갓 나온 따끈따끈한 프리셋
유틸
pst0025
04/10 28239 54
올려두면 누군가 개꼴리는 MMD를 뽑아주겠지
유틸
네토라레프린세스
04/09 12506 23
코이카츠 명조 캐릭터 프리셋 공유 (v3)
유틸
pst0025
04/08 22800 51
[노모패치] 미궁 거리의 그레이스
유틸
빙구론희
04/08 21658 29
코이카츠 명조 프리셋 공유 (2)
유틸
pst0025
04/07 11699 52
코이카츠 의상 공유 1
유틸
pst0025
04/07 11982 60
던전 앤 브라이드 치트엔진용 테이블
유틸
nooom
04/06 11358 24
코이카츠 프리셋 공유 ( SolityL pack )
유틸
pst0025
04/06 13547 59
코이카츠 최애작가 4인 모음 (딸각 한방 패치 + 말딸캐릭터 제외 수정)
유틸
imakotou
04/05 14726 67
ㅁㅁㅁ로 깨지는 유니티 폰트 변경 방법
유틸
네토라레프린세스
04/05 5820 18
코이카츠 벽람 프리셋 공유 (개인 수정본)
유틸
pst0025
04/05 11908 30
코이카츠 아랴양 프리셋 콜렉션 공유
유틸
pst0025
04/05 9078 27
코이카츠 프리셋 공유 (히가시 통팩)
유틸
pst0025
04/05 13335 62
로컬LLM(Ollama) 이용한 파이썬 MV 번역 코드
유틸
샤쿠
04/04 21874 21
[RJ01389782] [AI 번역] 비밀 노출 마나카 커스텀 미션 번역 [SekiMissions 8.5]
유틸
bunta_expert
04/04 11401 21
자동소미 해적판
유틸
buttercookie
04/03 7765 21
kio transfer 비번 자동입력
유틸
20250508
04/03 5171 22
코이카츠 버튜버 캐릭터 공유(v2)
유틸
pst0025
04/02 11993 53
눈동자 다운로더 GUI (아마도 최신버전)
유틸
하이바라
04/02 6119 16
코이카츠 야스씬 공유 - (홍차)
유틸
pst0025
04/01 13535 37
코이카츠 벽람 프리셋 공유(v2)
유틸
pst0025
04/01 15317 46
코이카츠 (?) 프리셋 공유
유틸
pst0025
04/01 16026 33
디코드 클릭하기 귀찮아서 만든 확장프로그램
유틸
20250508
03/31 10904 57
(빅파이 개조만) 평범한 현실 남매 IN 섹스하지 않으면 나올 수 없는 방.[RJ01332822]
유틸
123551
03/29 8480 15
Base 64 Encode Decode 확장 프로그램 만들어 봤습니다.
유틸
shinyiro18
03/28 6555 18
아오이짱 BepInEx 번역플러그인 잘리던거 해결봤다...
유틸
lalalala000
03/28 24227 59
(코이카츠) 시니시스타2 캐릭터 공유 - [리리아]
유틸
pst0025
03/27 19966 40
(코이카츠) 원신 캐릭터 공유
유틸
pst0025
03/27 10241 33