kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2402 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
개추콘
유니슨 코드 낚시 초반 질문
질문
ENE
05/21 4164 1
야겜뉴비의 매우 주관적인 게임 한 줄 평과 평점 모음 1탄
후기 및 공략
pegets
05/21 12836 32
존재감 여동생 게임중 섹스 어떻게 함?
질문
응애응애
05/21 7182 -1
던브 통합모드로 프리모드 할려하는데 초반부터 막혔는데 아는 사람 있음?
질문
ehektl12
05/21 2999 0
마권사 사라 아무도 모를사실
일반
에로스테는 필수 스테는 선택
05/21 2833 4
[청아][번역][모자파괴] 이타즈러브 - 인적 없는 공원에서 소녀와 사랑을 키우자
번역
ilillilllilil
05/21 40644 259
[복구요청] 멜티 브레이브 키툰즈 RJ01135352
요청
HHD777
05/21 3200 0
님들 쯔꾸르 하실때 스토리 전부 스킵하나요?
질문
www5555
05/21 2215 0
[Danimaru/노모] 하룻밤 재워줄래, 오타쿠 군♥
동인
ㅇㅇ
05/21 36299 261
뉴비) 나노 컨트롤 하다가 이런 오류가 발생했는데 어찌하나요..?
질문
184718474
05/21 2586 0
APK포팅된거 컨트롤러 뭐씀
질문
smalldom
05/21 2168 1
[복구요청] 홋코리 아야카시 료칸
요청
seeeezzxc
05/21 2197 0
Itch에서 폰에 야겜 깔았는데
일반
sungeun8318
05/21 2241 0
의술사 모든 엔딩 봤는데
질문
rlawjddms
05/21 5412 0
로즈 던전 탈출 중인데
질문
integritytoken
05/21 2725 1
쯔꾸르 야겜 애니메이션에서만 배속이되는데
질문
으읏하앗
05/21 2831 0
메이팅프레스 이꾸조
일반
apee
05/21 2914 6
비월선행록 독 이펙트 안없어지는거 버그임?
질문
o0o99
05/21 2090 0
여긴 주딱이 여러명임?
일반
catchme-if-you-can
05/21 3113 -2
던브 수도승 왜케 약하지?
질문
fusbriwidhei32
05/21 2811 0
비월선행록 옷장에서 오류
질문
goneni
05/21 5960 0
소식 끊기다가 몇년만에 새로 올린 서클년놈들
정보
cyberzombie
05/21 7703 13
Fallen / Brand New World 소리가 안들림
질문
arawn
05/21 3369 0
최고의 "야" 겜을 도저히 못찾겠습니다
질문
sadfghj
05/21 3718 0
손신 재밌긴 한데 개빡침;
일반
forzzal001
05/21 3517 -3
[복구요청]미번,영문버전) SAO Invisible Trap vβ5
요청
nuriggiri
05/21 2772 1
[복구요청](기번/일부손번) SAO NTR Invisible Trap II vβ4
요청
nuriggiri
05/21 3492 1
[요청복구] 최음아파트1.05
복구
okamsk15
05/21 30909 104
여성향 NTR도 있나?
일반
vcxzasdf
05/21 3008 1
RJ141187 식질 뉴비 연습
일반
ㅇㅇ
05/21 2513 4