kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2338 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
개추콘
비타퀘2 업스케일링 받은 분들 한번씩 확인 부탁! (A/S)
복구
sinbiru
05/19 18191 44
존재감 여동생은 진짜 계륵 그 자체네
일반
ㅇㅇ
05/19 4728 2
오랜만에 H 영지 할려했더니
일반
아이셔
05/19 2953 1
의술사는 한 4부작? 정도로 나올것같음
일반
ㅇㅇ
05/19 3718 0
상극의 알테르 발매일
정보
nyamberry
05/19 7417 18
똥글일수도 있는데 진짜 진지하게 소붕이들에게 궁금한거
질문
bisesdop
05/19 4679 1
내가 쓸려고 만든 DLsite 코드 검색 용
유틸
ATTAA
05/19 5985 7
[크리매니아&시모바시라] AI 성능 좋네 ㅋㅋㅋ
일반
owner123
05/19 2617 8
[복구요청] RJ424103 アゾット 아조트
요청
명붕이
05/19 4090 0
[akahon akamoto][ai번] 모음집 1,2
동인
latte
05/19 20458 54
비월선행록 질문입니다 고수행님들 헬프미
질문
탈룰라
05/19 3359 0
아득한 세레스피아 세이브파일 위치 어디인가요?
질문
폴폴구리
05/19 3730 0
이번 주말에 비타퀘 노모 도전 해봄!
일반
sinbiru
05/19 2359 15
[[요청복구]] [RJ383251] 아리사 그리모어 ver.2.00
복구
에로스테는 필수 스테는 선택
05/19 21433 124
배에 음문 생긴 여기사 이거 클리어 못하겟음....
일반
digksrj
05/19 3119 -2
[복구요청]Croove 2160p 통합본
요청
819455
05/19 2940 0
두근두근 성감마사지 이거 전작 먼저 해보는 편이 나은가요?
질문
lefrah3
05/19 2738 0
짧고 재밌는 도트겜 교배위원이 하는일
후기 및 공략
fourdragonruler
05/19 4950 2
[복구요청] [ ハリマオ] [Ai 음성] 페코마마 카운트다운 게임
요청
hahan
05/19 2317 2
짤 작가 이름이나 링크 있을까요
질문
abbbbcccc
05/19 2391 0
유니슨 코드 난이도 추천좀
질문
chronoro
05/19 2107 0
[[요청복구]] [RJ410262] Lost Chapter v2.10
복구
에로스테는 필수 스테는 선택
05/19 17390 114
비타퀘2하는 사람들 팁 주자면
정보
fhflqhwl
05/19 5712 11
[MP-7L] 모음 21gb
영상
zadvoskoi
05/19 24870 86
버섯섬 제작사) 검도장ntr 6월중순으로 출시연기
정보
머겅머겅
05/19 4124 7
아득한 세레스피아 치트상자 비밀번호
정보
르모듈러
05/19 4471 21
비월선행록 취선거문지기는 남자인가
질문
보바도사
05/19 2956 0
나히아, 리제로, 비스크돌 등등 애니캐 기반 야겜 추천 좀 해주세요
질문
너울
05/19 3413 0
U2FrdXJhIE5pZ2h0 모음집
영상
project OSY
05/19 25349 120
RJ01041019 게헨나 (ゲヘナ) 1.09 복구 요청 드립니다.
요청
mu52w
05/19 2729 1