kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2364 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
개추콘
base64 자동 디코딩 크롬 확장 프로그램 입니다.
유틸
qqwe1234
09/18/25 10012 80
XUnity.AutoTranslator 5.6.1_kr 번역 플러그인 한국형 비공식 버전
유틸
kumarin
09/13/25 10952 41
후타)무표정한 후타나리는 착정 생물과의 교미에 절대 매료되지 않는다 노모패치 + 이전 작품 노모패치 복구
유틸
레가토
09/12/25 10627 26
다키스트 던전 NSFW 완전판 [Npc 리텍 / 영웅 리텍 / 이쁜이쁜 영웅 모드 / 몬스터 리텍]
유틸
삐뉴
09/10/25 17705 95
[복구] +@ 시니시스타 2 모드 모음 (1.10)
유틸
sims9876
09/10/25 13200 26
야겜아님,미번) RJ01432103 MACHINE CHILD (머신 차일드) 일본어판
유틸
AND
09/09/25 7506 25
[버그수정용] 검은정복왕 우클릭 팅김 버그수정
유틸
Ghost
09/06/25 5844 24
스텔라블레이드 릴리 누드모드 복구+추가함
유틸
konekat
09/03/25 9876 19
.RPGMVP .PNG_ 파일 썸네일 제공 DLL 보안 업데이트
유틸
moomin
09/02/25 4846 22
카린즈 프리즌 Karryn's Prison 치트 모드
유틸
qpspql
09/01/25 15343 21
유니티 신버전 자동번역기
유틸
김머시기
08/31/25 8597 31
제복 그녀 2.5
유틸
미스터장
08/27/25 6338 25
시니시스타2 아헤모드 v3
유틸
cordial
08/24/25 25485 32
쯔꾸르 MV,MZ AI 번역 툴과 그 외 번역에 유용한 툴들 공유 및 사용법 대충 정리
유틸
미스터장
08/22/25 40849 128
시니시스타2 1.1 아헤모드 v2
유틸
cordial
08/18/25 12217 24
[스팀노모이미지만] BLACK SOULS ~검은 동화와 오마 공주~
유틸
미스터장
08/16/25 4918 17
동인메뉴판 - 동인지 관리 유틸 만들어옴
유틸
qqoro
08/15/25 24202 95
Auto Somi 업데이트
유틸
김머시기
08/11/25 9272 38
시니시스타2 1.1 아헤모드
유틸
cordial
08/11/25 13512 30
히토미 다운로더용 케모노 다운로드 스크립트
유틸
글쓴이
08/08/25 19431 20
공식AI번역에서 추출한 마인드 류다 이미지번역파일만
유틸
미스터장
08/05/25 4759 19
시니시스타 2 모드 모음(1.10)
유틸
sims9876
08/05/25 9704 15
[버려짐] 던전 앤 브라이드 치트모드 1.44 업데이트 + 번역 모드 대응 버전 출시 *10/15 18:33 수정
유틸
rengester
08/05/25 30060 64
울프툴 3.625 한글화
유틸
brothers
08/03/25 3682 16
Winlator (엑시노스 구동 가능)
유틸
o_o
08/02/25 14711 16
[버려짐] 내가 직접 만든 던전 앤 브라이드 모드 공유 *치트 기능 추가 08/04 10:03 수정
유틸
rengester
08/02/25 13464 24
다키스트 던전 Anaertailin 몬스터 컬렉션/NPC NSFW 모음
유틸
삐뉴
07/28/25 10991 27
Base64 링크 자동번역 확장 프로그램
유틸
blacklink
07/25/25 6094 15
카린 전용치트 Karryn's Prison 전용치트 ver1.4d
유틸
4HHHH
07/22/25 18525 22
이제 다운받은 망가도 히토미를 보듯이!
유틸
blacklink
07/21/25 8366 17