kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2363 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
개추콘
[번역요청] [Yoshizou888] NTR 판타지 - 부패와 지배의 연쇄
미번
Ed
05/04 13590 35
Comfyui 재밋내
야짤
zerocoke
05/04 8719 17
[어린이날 기념 복구] RJ150996 마립 서큐버스 요마원 1.6
복구
blackmalangcalf
05/04 37286 68
[AI번역] 역겨운 거근 아저씨가 여자친구를 네토라레하는 이야기! 거근이 최고!
동인
gkcuwuwlltnnrra
05/04 22619 66
어린이날 기념,후원보급) meatloaf 2024/4 ~2026/4
영상
쩝냡
05/04 27302 159
(청아 gif) 나는 빵빵단인데 이거 페도임
야짤
hannanas
05/04 15998 31
염월선행록 translation-cache.log 5월10일자 갱신 마지막
유틸
보바도사
05/04 8844 39
직번)[transistor baby]성재의 처녀 아스트레이아1~4편
동인
돋돋돋돋돋
05/04 24921 86
문제가 됐던 파일 및 암호화 관련 내용
정보
미스터장
05/04 9959 53
(한글자막) 친구네 집 메이드가 너무 내 취향이라서, 내 암컷으로 만들어버렸습니다
영상
꽃사슴
05/04 28776 185
[구매보급] [AI 번역] [개조버전] 견습 모비와 순풍을 기다리는 섬 RJ01042745
번역
V
05/04 36534 219
[미번] RJ01549336 알미오시온의 의술사 アルミオシオンの医術師 v1.00
미번
핏짜허엇
05/04 37025 172
[ai딸깍번역]동경하는 스승의 복제체 상대로 하고 싶었던거 전부 하는 이야기
동인
rlans
05/04 42350 315
[구매보급] 마조 시바키 라디오 시리즈 (1~3)
소리
summer4552
05/04 8140 42
후기) 색귀, 쯔꾸르 역사상 goat.
후기 및 공략
parmisgood
05/04 9310 31
횡령을 들켜 상사가 시키는 대로 하게 되는 경리 1p
야짤
요요코코
05/04 11475 29
[복구] RJ105442 암즈 디바이서 (arms devicer) v1.4 KR
복구
meruna00
05/04 15639 60
청아, AI번역) [직번] 구축함 하츠유키 이야기 (Wancho)
동인
rapbit
05/04 10094 22
minus8) 효과음 추가
영상
rlans
05/04 21617 97
(로리/임신) 아크메시아 발매일 결정!
정보
라임무르
05/04 13944 18
90일, 미번+번역) RJ425610 마도술사 미사
복구
ㅇㅇ
05/04 21532 56
[アブジャン] 레나쇼타 ー디지케모 누나와 H한 합체ー
영상
cupapan
05/04 24229 45
90일) RJ195455 미츠루기 코토노가 변태가 되어 버린 이야기 v1.10.7z
복구
ㅇㅇ
05/04 21404 37
(구매보급,버전업)RJ01613299 음최도시 휴포니즘
미번
gkawkek23
05/04 12648 44
[직번] Nunnu) - 좋아하는 미라이가 다른 녀석 책상에서 모서리 자위라니 말도 안 돼
동인
유의
05/04 24011 150
[직번] [Yesman] 잘생긴 왕자님 스타일 여자 AV타락 인생종료편
동인
maha1004
05/04 27079 75
[구매보급] [번역요청 시크릿 바이스 ~이계의 낙원~
미번
howl17
05/04 13102 27
미번에 올라왔던 문제의 파일 구동 해봤음
정보
미스터장
05/04 11590 43
보지고등학교 야짤 시리즈 모음
야짤
berryzz
05/04 18059 84
[구매보급]신성한 발키리의 굴욕 더러운 자지 청소
소리
이름뭐하지
05/04 12042 60