kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2177 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
서브,게시글 차단, UI추가 유저스크립트
유틸
cloud67p
10/05/25 2666 11
카린즈 프리즌 cc모드 기계번역해옴
유틸
고추보집물
10/03/25 8727 39
무기력 천사 추가 렉 개선 패치 (a.k.a 쯔꾸르는 최적화 쓰레기가 분명하다)
유틸
erukajihx
10/02/25 6664 65
번역 플러긴용 일본 이름 정리
유틸
kumarin
10/02/25 2246 10
Aideal Helper plugin v1.0.2.0
유틸
kumarin
09/30/25 2265 10
3시간 만에 만든 방주 중복 정리기
유틸
asdf1243
09/30/25 3036 8
팔성제(八星帝) ssg 파일
유틸
hdddie
09/28/25 2878 7
다키스트던전 Deovolente 에디션
유틸
doyoulikekim
09/27/25 9683 29
[v10] 자동 소미 Auto Somi 개조판
유틸
마나난
09/26/25 14300 22
좀더! 불꽃의 시리즈 붉은화면 수정패치
유틸
adsv42
09/23/25 3733 15
도나도나 미검열 CG 오류들 수정
유틸
riel64
09/23/25 17297 77
SW_Decensor v0.7.4.1
유틸
kumarin
09/21/25 9481 38
base64 자동 디코딩 크롬 확장 프로그램 입니다.
유틸
qqwe1234
09/18/25 10012 80
내가 dl 검색할 때 귀찮아서 만든 프로그램
유틸
boya058
09/17/25 2980 10
코네 서브/게시글/댓글/유저 필터, 차단 스크립트 v1.3
유틸
공승아
09/14/25 4401 8
XUnity.AutoTranslator 5.6.1_kr 번역 플러그인 한국형 비공식 버전
유틸
kumarin
09/13/25 10952 41
게시글 제목 필터 스크립트
유틸
cloud67p
09/13/25 1810 5
후타)무표정한 후타나리는 착정 생물과의 교미에 절대 매료되지 않는다 노모패치 + 이전 작품 노모패치 복구
유틸
레가토
09/12/25 10479 26
다키스트 던전 NSFW 완전판 [Npc 리텍 / 영웅 리텍 / 이쁜이쁜 영웅 모드 / 몬스터 리텍]
유틸
삐뉴
09/10/25 17705 95
[복구] +@ 시니시스타 2 모드 모음 (1.10)
유틸
sims9876
09/10/25 13197 26
야겜아님,미번) RJ01432103 MACHINE CHILD (머신 차일드) 일본어판
유틸
AND
09/09/25 7506 25
둘만의 생활 세이브 에디터
유틸
அறியப்பட்ட🔧
09/07/25 15497 14
코네 이미지 뷰어 개선 스크립트
유틸
Ghost
09/06/25 4221 10
[버그수정용] 검은정복왕 우클릭 팅김 버그수정
유틸
Ghost
09/06/25 5844 24
히토미 시리즈를 통합시키는 프로그램을 만들어 보았습니다.
유틸
ariantganada
09/06/25 5360 11
스텔라블레이드 릴리 누드모드 복구+추가함
유틸
konekat
09/03/25 9876 19
.RPGMVP .PNG_ 파일 썸네일 제공 DLL 보안 업데이트
유틸
moomin
09/02/25 4776 22
카린즈 프리즌 Karryn's Prison 치트 모드
유틸
qpspql
09/01/25 15271 21
webp.zip 파일 자동으로 jpg 로 변환 후 재 압축 프로그램 만듬 (2025.12.10 업데이트)
유틸
noname
08/31/25 2237 12
유니티 신버전 자동번역기
유틸
김머시기
08/31/25 8597 31