kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2242 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
개추콘
PrincessElicia 오류
피드백
솔라셀
05/26 1796 2
오늘부터 금딸목표
일반
oimasage
05/26 2247 0
신작은 확실히 나오고 따끈따끈할 때 해야돼
일반
kalbin
05/26 2312 0
시니시스타2 하는데.... z키 x키 이거 나만 불편해? 변경 하는법 있음?..
질문
sinbiru
05/26 1680 0
파라다이스 서큐버스 드디어 다 깼다
일반
latham
05/26 1716 1
프로넌트 심포니 질문
질문
assa3223
05/26 1249 1
규정위반일지도 모르지만 규정위반이면 지우겠긔
일반
negativ
05/26 1886 0
ai 랜덤)after sex room
야짤
ezmood
05/26 6800 28
비월선행록 질문 몇가지
질문
geraltroll
05/26 1434 0
시니시스터2 1.3.1 버전업 됬던데 기존 (1.2.1)거랑 차이 있음?
질문
sinbiru
05/26 1070 0
[복구 요청] 네토리 용사 ~친구의 엄마를 임신시키면 즉시 클리어 ver 1.0
요청
qzmp310
05/26 2290 5
vp세레나 막혔는데 질문점
질문
won0817
05/26 2142 0
항상 최신겜 트랜드 정보 감사
일반
mybest
05/26 1802 0
알몸으로 스토리 보는 편이 더 웃기네
일반
ENE
05/26 2076 1
의술사, 스포) 크롯 바인드 R 이거 어디서 구하나요
질문
borneo
05/26 1203 0
시니시스타2 해보려고 하는데 꼭 1 해야함?
질문
sinbiru
05/26 1684 0
날이 갈수록 덥다
일반
mybest
05/26 1800 -3
Umemaro 우메마로영상 RJ01059074, RJ01399859
영상
ckkey
05/26 24692 227
7월 라무네 애니 7화 에반데
일반
jhgvh
05/26 2532 0
펨돔류 게임 추천 있음?
질문
satam1212
05/26 2464 0
찾아요 부탁드립니다 🙏
질문
seohb5403
05/26 1954 1
[스포]Bastian's Family Secret - K드라마 같은 렌파이
후기 및 공략
delkin424
05/26 3619 6
의술사 영주 만나도됨?
질문
sjh5758
05/26 2036 1
[복구 요청] 천국 등반 자위 서포트 타워 요청드립니다.
요청
satara333
05/26 2047 -1
화이트피치 서클 신작 연기
정보
sorbe123
05/26 2223 5
태양의 기사 에리카 길이 어디냐;;
질문
elke5058
05/26 1630 0
(징징 장문글) 돈 쓴다는데 세상이 날 억까한다
일반
신창섭
05/26 3370 1
[요청복구] RJ01299483 RiNaTest (ai번역)
복구
retanya
05/26 9596 15
아기만들기 온천 개쩌네
일반
98kpl
05/26 1870 5
ai, 블아) 키사키와 잔뜩 아기 만들기 섹스했다
야짤
kjh9304
05/26 12153 126