kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2405 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
개추콘
헤르미온느 길들이기는 dl 에 냈으면 얼마나 팔렸을까
일반
하이바라
05/20 5235 0
자러갈께.
일반
아이기스맘
05/20 1974 6
dlsite에서 겜 어떤 툴로 만들어졌는지 확인할 수 있음?
질문
ahnhyunmin
05/20 5432 0
따끈따끈한 타케다 신규 낙서장 (나데시코)
동인
riden
05/20 26790 48
blendy 모음집 복구 요청드려도 될까요
요청
dudqhrcl
05/20 6012 0
ai) 큰 가슴 사이로 총알이 쓩~~
야짤
Ghost
05/20 10201 37
뫼엥 fantia가 검열로 컷당하다니
야짤
강철검
05/20 6039 10
ai) MMM 모음집
야짤
Ghost
05/20 9627 21
비타퀘는 조이플로 안되나보네
일반
chdodnd
05/20 3827 0
[[요청복구]] [RJ340568] 상태이상 1 〜음문 금서 기생충편〜
복구
에로스테는 필수 스테는 선택
05/20 19273 122
비월선행록 선발대에게 플레이-오류 질문좀
질문
o0o99
05/20 2641 0
ai) ----스압-----아이마스 계열...?
야짤
Ghost
05/20 5391 19
Yutsuki Tsuzuri-쓰레기 현자 이야기 2
동인
k8625
05/20 20992 41
갑자기 화가난다.
일반
아즈칼
05/20 2728 2
미캉의 여름방학 클리닉 어떻게 열음?
질문
jaemyunglee
05/20 3128 0
비타퀘2 창관파트 선물 질문
질문
부탄가스
05/20 2074 1
의술사 3회차 후기
후기 및 공략
llll-llll
05/20 5260 5
Eco Heeky-엉덩이로 여자를 구분할 수 있는 내가 여상사의 약점을 잡았다 1
동인
k8625
05/20 29556 189
Eco Heeky-엉덩이로 여자를 구분할 수 있는 내가 여상사의 약점을 잡았다 2
동인
k8625
05/20 37733 284
[직번] [kuroinu] 악몽의 학원 생활 위원장의 운명
동인
maha1004
05/20 20810 76
[손번역][2차번역본] RJ01526327 어서오세요! 어린이 만들기 온천 마을 1.01
번역
sjdwj
05/20 55097 271
ntr물은 말그대로 심장을 떨리게 하는 꼴림이 있다
일반
인생좆망함
05/20 2267 0
[[요청복구]] [RJ422316] 전투에로 RPG ~음욕의 마탑~
복구
에로스테는 필수 스테는 선택
05/20 28972 250
[기계번역/자동번역] Yaradiel’s Crown [v0.7.1]
번역
karuparu13
05/20 30465 65
야겜하면서 제일 힘든거
일반
Kikio
05/20 3276 1
Grimgrim-goat짱모음
동인
k8625
05/20 17784 125
가끔 보일때마다 너무 폭력적임
일반
ㅇㅇ
05/20 3397 0
[복구요청] (이미지 번역) [RJ01274529] 하루우리 카드 게이머즈 메뉴, 스토리 제목 번역
요청
dream
05/20 3401 0
의술사가 왜 신선한지 생각해봤는데
일반
ㅇㅇ
05/20 2986 0
복구 관련 질문 드립니다
질문
arquivity
05/20 2474 0