kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2177 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
Sign in to comment
07/30/25
개추콘
Sign in to comment
Joiplay 1.20.611
유틸
o_o
08/30/25 6770 7
검은정복왕 공략
유틸
pqland5051
08/30/25 14366 8
제복 그녀 2.5
유틸
미스터장
08/27/25 6338 25
감옥용사 조이플 구동 패치
유틸
DASL
08/26/25 2032 7
시니시스타2 아헤모드 v3
유틸
cordial
08/24/25 25485 32
쯔꾸르 MV,MZ AI 번역 툴과 그 외 번역에 유용한 툴들 공유 및 사용법 대충 정리
유틸
미스터장
08/22/25 40849 128
시니시스타2 1.1 아헤모드 v2
유틸
cordial
08/18/25 12119 24
유저 차단 스크립트 업데이트 알림
유틸
글쓴이
08/17/25 5136 6
[스팀노모이미지만] BLACK SOULS ~검은 동화와 오마 공주~
유틸
미스터장
08/16/25 4891 17
동인메뉴판 - 동인지 관리 유틸 만들어옴
유틸
qqoro
08/15/25 24202 95
음문이 새겨진 마더 알리시아 ver.1.483 신음 소리 증폭
유틸
shdcd
08/15/25 3458 3
Auto Somi 업데이트
유틸
김머시기
08/11/25 9272 38
유니티 게임 XUnity.AutoTranslator용 폰트모음
유틸
미스터장
08/11/25 7828 12
시니시스타2 1.1 아헤모드
유틸
cordial
08/11/25 13378 30
던전앤브라이드 후기와 상세정보
유틸
positron
08/09/25 11724 13
히토미 다운로더용 케모노 다운로드 스크립트
유틸
글쓴이
08/08/25 19431 20
유니티 자동번역기 유니티6000 tmp 폰트 에셋 번들
유틸
1bvk3b6ka8
08/07/25 4835 11
DLsite 썸네일 원클릭! 다운로더 v0.2.1 (20250806) 스크립트
유틸
Legnax
08/05/25 3877 10
공식AI번역에서 추출한 마인드 류다 이미지번역파일만
유틸
미스터장
08/05/25 4759 19
시니시스타 2 모드 모음(1.10)
유틸
sims9876
08/05/25 9615 15
Joiplay 1.20.600
유틸
o_o
08/05/25 5242 7
DLsite 썸네일 원클릭! 다운로더 v0.1.1 (20250805) 스크립트
유틸
Legnax
08/05/25 3126 6
[버려짐] 던전 앤 브라이드 치트모드 1.44 업데이트 + 번역 모드 대응 버전 출시 *10/15 18:33 수정
유틸
rengester
08/05/25 29960 64
울프툴 3.625 한글화
유틸
brothers
08/03/25 3682 16
사파리 base64 디코딩 단축어
유틸
wjsrlzhs
08/03/25 1995 1
[게임 미포함] 배덕의 충동 v1.2 아랫털 추가 패치
유틸
털털털털털털털털
08/03/25 5381 14
Winlator (엑시노스 구동 가능)
유틸
o_o
08/02/25 14601 16
[버려짐] 내가 직접 만든 던전 앤 브라이드 모드 공유 *치트 기능 추가 08/04 10:03 수정
유틸
rengester
08/02/25 13464 24
update0731 DL + STEAM 미리보기 크롬 확장.
유틸
ddegul
07/30/25 3444 11
거01212155 특전 비밀번호와 수정파일
유틸
커댕이
07/30/25 3166 4