kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2248 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
개추콘
[복구요청]이상한 형무소와 음욕의 지하 미궁 ~빈틈투성이인 나나의 H한 프리즌 브레이크~ 1.1.0
요청
ㅇㅇ
05/25 5248 2
[요청복구] [RJ282703] 출동! 전라풍기위원회
복구
ㅇㅇ
05/25 11726 26
왜 점점 조이플 오류가 재밌지
일반
fkfnebwk
05/25 1596 1
태양의 기사 에리카 0.1.9.1 ) 버그로 인해 1장까지 한 공략글
후기 및 공략
베르베르사막
05/25 3938 12
900GB 3D VR영상 방주 공유
영상
ㅇㅇ
05/25 17028 76
fortune bride 내일 마저 할겸 중간정산
후기 및 공략
시민07
05/25 2755 3
[ 세이브파일 ] 고블린 워커( RJ212641 ) ALL클리어 파일
세이브
kkkkkk0909
05/25 3152 6
야겜초보인데 조이플구동되면서 잼는겜 없을까
질문
siksikii
05/25 1540 0
고블린 워커(RJ212641) 후기
후기 및 공략
kkkkkk0909
05/25 3472 5
얘넨 전에도 그러더니만 또 나눠서 내네
야짤
앨리스
05/25 3612 1
학원 생활 노출 RPG NAKED HIGHSCHOOL 공략좀 알려줄 사람?
질문
dewq31313
05/25 2147 0
청아) [atage] 편리한 오나홀로 길들이는 방법 1/5
동인
HJY
05/25 38569 206
[ai 번역] [Usagi Nagomu] The Everlasting Elf of the Evening - 유구의 창 엘프 1~6 [p.216]
동인
mybest
05/25 14269 57
관문지기 msg 작업 현황 - 5
작업현황
fin768
05/25 4703 29
오 폴리우레탄 아줌마 신간 나오네 ㅋㅋ
야짤
kjalar
05/25 4756 8
[해결됨] 혹시 던전 앤 브라이드 대사 .... 문제 해결법 있을까요?
질문
laskokoi
05/25 1512 0
Star Knightess Aura 미번 및 오류 보고
피드백
티아나
05/25 2461 0
의술사 왜 h씬 넘긴다는지 이제야 느낌ㅋㅋㅋ
후기 및 공략
paddackmon
05/25 4446 3
[미번/번역요청] [kobaji] leveling unleash
동인
lumineon184
05/25 7610 10
에이전트 시리우스 DLC 네토라레 태그 있길래
질문
rtn
05/25 3256 0
셀레스포니아를 왜 이제 알았을까?
일반
amehurashi
05/25 2564 0
스즈카의 고민 이거 선생 어케해야 나오는 거임
질문
happy0212
05/25 2646 0
[복구요청] 에로검열관 all 세이브파일 복구 요청
요청
aemeath
05/25 3265 2
[AI번역] [패치파일만] RJ224282 Spiral Legend V 1.51 수정v2
번역
dadskey
05/25 14516 57
dlsite 등지에서 받은 게임 다른컴퓨터에서할때 세이브파일 쉽게 옮기는법 있음?
질문
익명
05/25 1554 1
태양의 기사 에리카 질문좀
질문
wkqduddj
05/25 2271 -2
분명 어릴땐 로리물이 꼴렸는데
일반
han123
05/25 2704 1
[후기 겸 짧은 공략] RJ01175469 천재마법소녀가 불합리하게 존엄 파괴당하는 이야기
후기 및 공략
knightofcydonia
05/25 4264 4
댓글에 게임 이야기는 없고 꾸꾸까까콘만 많은거 개웃기네
일반
세이버
05/25 2279 -4
[ai 번역][Usagi Nagomu] 황혼의 창 엘프 7~9 [p.118]
동인
mybest
05/25 13322 64