kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2186 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
Sign in to comment
07/30/25
개추콘
Sign in to comment
조이플 오류 및 패치 + 유틸
유틸
yeppi
03/04 12024 34
야식메뉴판 Plus 만들어왔음 - 게임 방주 관리 데스크톱 앱
유틸
qqoro
03/04 15059 77
이터넘 0.9 옛날 버전 브금 모드
유틸
외않되
03/04 3855 5
RJ01389782 비밀 노출 마나카 커스텀 미션 번역2
유틸
ㅇㅇ
03/03 14264 18
렌파이 전용 언락커 ( 갤러리 언락가능 )
유틸
하이바라
03/03 5047 12
ai번역)RJ01389782 비밀 노출 마나카 모드와 미션 여러 가지
유틸
kkkktrrr
03/02 16621 45
지난번에 만든 (케모노,히토미,X,유튜브 등등 downloader gallery-dl, yt-dlp 활용) 다운로더 GUI 버전으로 만들어봄
유틸
noname
03/01 15983 56
하츠네 미쿠 (코이카츠) 프리셋 공유
유틸
pst0025
02/28 13744 32
유니티 클뜯 assetstudio 후속 animestudio
유틸
xcandle
02/28 8745 19
Sizer.7z
유틸
ㅇㅇ
02/27 8194 13
RJ01279319 네토라레 히로인 백설 1.1 백로그등 편의성 개조 파일(패치파일만)
유틸
apelzl011
02/25 6784 13
Digital Contents Library Tool 1.1.7.2 (구 DLsite 퀵 뷰어)
유틸
ll-lllllllll
02/24 92424 70
시니시스타2 1.2.1 폭유 모드
유틸
무슨소리니
02/24 19105 39
어떤 여자 상사의 비밀 마사지 가게 ver.1.0.6 DRM 해제 실행파일
유틸
미스터장
02/23 10021 11
감금된 채 딥키스 여성주도~페라 포함~ 노모패치만
유틸
미스터장
02/23 7529 6
MZ 엔진 index 치트 유틸
유틸
전적노트
02/22 7436 4
[MySonar] 소수를 위한 오디오 플레이어
유틸
hustlyn
02/22 16965 77
RJ01389782 비밀 노출 마나카 커스텀 미션 번역
유틸
ㅇㅇ
02/21 13165 25
마메32 신버전
유틸
a123456789
02/21 40128 191
RJ 미리보기 서포트 (Tempermonkey 기반)
유틸
sss-com
02/21 7920 14
복호화 밑 품번 링크 생성기 사이트
유틸
vOwOv
02/20 9263 11
nursecall 치트
유틸
nekoplug
02/20 6936 5
26.04.18, 90일, 자동 줄바꿈) RJ01540816 ver.1.0.0 js (2).7z
유틸
ㅇㅇ
02/19 22713 13
RJ01438167 여동생과 함께살자 노모 Bepinex 파일
유틸
joaja
02/18 16066 24
시니시스타2 1.2.1 Slit(가터벨트) 아웃핏 노모 모드
유틸
tongpa
02/18 17712 12
수정 Agent17 0.26.6 cheat mod 버전+ 안티치트,추가치트
유틸
a123456789
02/17 15439 10
GameDB 2
유틸
심심한개발자
02/17 13953 8
Agent17 겨울동화 삽 강화 버그 픽스
유틸
AKGH
02/17 16513 13
[후타]pernio의 후타나리 시리즈 노모패치 모음
유틸
레가토
02/17 11860 12
렌파이 공용 치트엔진+agent17 치트 쓰는 법
유틸
high-hope
02/16 27403 38