kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2189 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
RJ코드 추출해서 클릭하면 바로 이동되는 파이썬 코드
유틸
siasia
04/15 8700 4
이미지 폴더 병합 & 일괄 이름 변경
유틸
noname
04/15 11549 30
RPG VX ace게임 전체화면으로 하는 꿀팁
유틸
야겜인생
04/14 11563 19
(코이카츠) Shibal 통팩
유틸
pst0025
04/14 19370 57
[노모패치] 성기사이야기 ~소녀에게 다가오는 음욕귀족~
유틸
데프픗
04/14 8667 13
[노모패치] 부유마법도시의 레이 ~직계의 마도사~
유틸
데프픗
04/14 19592 28
[노모패치] Restore
유틸
데프픗
04/14 11698 21
[노모패치] 엘프 소녀 리피아와 몽환의 미궁
유틸
데프픗
04/14 18929 23
[90일] 용병의 모험 v3.001 노모 패치
유틸
ㅇㅇ
04/13 19097 47
청아)코이카츠 미유 완성 기념 프리셋 공유
유틸
이상한 사람
04/12 11868 14
RPGM VXA 스크립트) ▼ 素材 ## 한글이름 입력 스크립트.txt
유틸
ㅇㅇ
04/11 6114 2
[복구] [유틸] DYSTHANASIA v1.0.8.1 텍스처패치 + 필터링 제거 패치
유틸
kkkkkk0909
04/11 10369 4
MV, MZ 대사 스킵 플러그인
유틸
r4gsdrg
04/11 13903 19
줄 바꿈, RPGM VXA 스크립트) ▼ シーン ## 자동 줄바꿈.txt
유틸
ㅇㅇ
04/11 8889 2
코이카츠 프리셋 히가시 통팩 보강
유틸
pst0025
04/11 11692 27
어르신들 빠알리 오세요~~~~~~~BeatMania98
유틸
a123456789
04/11 9548 9
(코이카츠) 갓 나온 따끈따끈한 프리셋
유틸
pst0025
04/10 28223 54
올려두면 누군가 개꼴리는 MMD를 뽑아주겠지
유틸
네토라레프린세스
04/09 12506 23
코이카츠 명조 캐릭터 프리셋 공유 (v3)
유틸
pst0025
04/08 22788 51
[노모패치] 미궁 거리의 그레이스
유틸
빙구론희
04/08 21533 29
코이카츠 명조 프리셋 공유 (2)
유틸
pst0025
04/07 11699 52
코이카츠 의상 공유 1
유틸
pst0025
04/07 11982 60
던전 앤 브라이드 치트엔진용 테이블
유틸
nooom
04/06 11356 24
코이카츠 프리셋 공유 ( SolityL pack )
유틸
pst0025
04/06 13545 59
파라서큐 조이플 이펙트 효과,사운드 패치
유틸
아이제이
04/06 6348 4
코이카츠 최애작가 4인 모음 (딸각 한방 패치 + 말딸캐릭터 제외 수정)
유틸
imakotou
04/05 14725 67
ㅁㅁㅁ로 깨지는 유니티 폰트 변경 방법
유틸
네토라레프린세스
04/05 5820 18
코이카츠 벽람 프리셋 공유 (개인 수정본)
유틸
pst0025
04/05 11906 30
코이카츠 아랴양 프리셋 콜렉션 공유
유틸
pst0025
04/05 9077 27
코이카츠 프리셋 공유 (히가시 통팩)
유틸
pst0025
04/05 13335 62