kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2303 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
개추콘
[미번/구매보급/번역요청] 비월선행록 스팀판 버전업 1.291
미번
giraffeman
05/15 40389 118
[농]거근 쥬지 두개 로 뷰지파괴 커미션
야짤
412343
05/15 11712 29
[복구] '카테니라& 머트 (수간') / '마키마 & 덴지 (체인소맨)' 영상 2개 복구
영상
브레머튼
05/15 19813 79
[ai번] 방과 후 아이 만들기 성교육 ~순수하면서 밝히는 발육 좋은 아이와 일대일 질내사정~
동인
latte
05/15 27328 125
[AI 번역][tsyatu] 관심있는 그 아이의 빗치같은 비밀
동인
히알룩스
05/15 22942 41
지금까지 해본 게임 개인적인 추천 ntr위주
후기 및 공략
tttyu
05/15 18945 32
ai)원신 스커크 선생님 참교육 2
야짤
ezmood
05/15 14408 68
[Healthyman] (청아,보테배) 이리야쨩을 완전동의 (최면) 하에 엄마로 만드는 야한 책
동인
밤하늘의신비
05/15 39898 162
[Healthyman] (청아) 그 아이는 아저씨의 여자
동인
밤하늘의신비
05/15 30768 126
ai) 움짤 몇개
야짤
Ghost
05/15 11635 33
스즈카의 고민 디테일 미쳤네
야짤
꼬냑
05/15 10572 20
[구매보급]진심사랑 프린세스 ~임신시키는 간청×유혹을 받아들인×신부 수업⇒쾌락 타락♪
소리
이름뭐하지
05/15 13998 66
(청아) 내 아내가 낳아준 아내
동인
밤하늘의신비
05/15 34732 87
어서오세요! 어린이 만들기 온천 마을 1.01 손번역 작업 이제 시작
작업현황
sjdwj
05/15 15149 66
부현 (스타레일)
영상
브레머튼
05/15 20675 65
[요청복구] My Girlfriend Advanced to the Dancer class and she buffs everybody v1.1r
복구
karuparu13
05/15 17607 31
[직번] [zonta] 내 엄마는 동급생의 젖소 노예
동인
maha1004
05/15 32856 58
[복구] 무녀나 짐승귀 관련 시리즈
복구
몬스터가아니다신이다
05/15 25117 45
ai, 찢) 야나기 부과장과 은밀한 성관계를 이어나갔다
야짤
kjh9304
05/15 7222 83
AI) GPT용 H 스테이터스 프롬프트를 더 개량했음
야짤
날개 로봇
05/15 14680 30
깐문지기 신캐구상 및 개발 방향
창작
sushi
05/15 7286 26
출시직전 신작 하나
정보
ksw112
05/15 12922 30
HC #248~268
영상
Yuzu
05/15 29929 198
원신 스커크선생님 쇼타따먹으려다 들켜서 참교육 (ai 176장 스압)
야짤
ezmood
05/15 17552 71
칸타렐라 (명조)
영상
브레머튼
05/15 15539 89
[Early Access] 힌덴부르크 (벽람항로)
영상
브레머튼
05/15 19385 108
레바테인의 욕망 (엔드필드)
영상
브레머튼
05/15 22322 81
AI) GPT로 뽑은 여주물 야겜 H 스테이터스 (프롬프트 추가)
야짤
날개 로봇
05/15 10726 28
[복구] 고전 명작 야애니 모음
영상
imakotou
05/15 21723 87
아리아드네 MZ 이식 102일 차 (주인공 디자인 및 EX 스토리 캐릭터 추가)
창작
Code_Max
05/15 12561 60