kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2215 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
개추콘
비월선행록 간단한 팁
후기 및 공략
kimms1104
05/17 23288 15
비월선행록 rangeerror 질문
질문
robotusb
05/17 3461 0
은근 꼴리는 상황인데 잘 없는 시츄
야짤
lokai92
05/17 5721 4
(번역)(TS)나는 아이의 엄마가 되어버렸다.
동인
멕무
05/17 13998 56
PASEC이란 야겜 해본 사람?
질문
타마쿠마
05/17 3445 0
스팀 인기 검색어에 sinisitar 뭐임 ㅋㅋㅋㅋ
일반
iraseonal
05/17 4363 4
카린 타천 죄수모드 올클했다
후기 및 공략
돔마
05/17 6893 8
비월선행록 하다보니 느끼는게 중국식 한자어는 일본-한국식하고 ㅈㄴ 다르네
일반
neither
05/17 8552 0
비의괴물 그정둔가....
일반
갸갸갸갹
05/17 3562 0
ai) NTR 접대골프3
야짤
ai0098
05/17 14577 133
Stranger Maidens 이겜 왜 이러냐
일반
lavia
05/17 7246 0
비월선행록 한패 질문
질문
gosee
05/17 3611 0
시니시스타2 에네누트 원래 뒤에서 잡는 기믹 있었음?
일반
forzzal001
05/17 6368 0
[복구요청] (한글자막) 아저씨 노치원
요청
raybbit
05/17 5420 0
게임 찾아줄 수 있을까요?
질문
um030910
05/17 2740 0
펄스미스 제작서클은 어케된겨
일반
ㅇㅇ
05/17 2589 0
[복구요청] 복수자의 암거래
요청
qkdqkddl26
05/17 5582 1
린네아 (원신)
영상
브레머튼
05/17 12385 70
AI, 셀레스포니아) 아마네와 야구권 게임(가위바위보 게임)
야짤
miso5
05/17 11364 130
진짜 ai 만화 번역은 신이네
일반
skyh011
05/17 5387 0
[요청복구] RJ01107130 너에게 가르치는야한 일
복구
h-aszzcb
05/17 26472 74
트랜스퍼잇 나만 안됨?
질문
mybest
05/17 9986 1
누군가 쓸 마법의하나 マホウノハナ 0.9e 실시간 번역용 프리패쳐 파일
유틸
ㅇㅇ
05/17 7139 8
[5/17] 버니스 & 이블린 2
영상
브레머튼
05/17 23556 141
[복구요청] RJ01107130 너에게 가르치는야한 일
요청
사과체스
05/17 9480 1
ㅈㄴ 육성물 하고싶다
일반
nikefly
05/17 2752 0
야설 찾습니다
질문
jamesbutter
05/17 3705 0
언홀메 최종보스 질문
질문
mh523
05/17 7186 0
가끔 떡신 노꼴인 줄 알고 걸렀던 겜중에
일반
ㅇㅇ
05/17 6443 1
고어주의,AI) 픽시브에서 고어짤 봤는데 뭔가 웃기네ㅋㅋ
야짤
puccho
05/17 7065 6