kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2182 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
포레스티아 1.3.2 회상룸 강제 개방
유틸
how-72
01/30 8426 6
RPG MV 실시간 번역기 설치가이드
유틸
mrpls
01/30 19655 17
RPG MV/MZ 실시간 번역기 1.6 - 프린세스 시너지 업데이트
유틸
mrpls
01/30 22429 34
엄크 방지 프로그램
유틸
cloud
01/29 23740 42
MVZ 플러그인) DarkPlasma_AutoLineBreak.js + MPP_MessageEX_AutoLineBreak_Patch.js + VisuMZ_1_MessageCore.js
유틸
ㅇㅇ
01/29 6340 5
[수정2] 안 돼! 동거 라이프 v1.11 치트파일
유틸
kts
01/29 13747 24
시니시스타 2 1.2.1 모드 총집편 + 추가 노모화
유틸
sims9876
01/28 29850 79
동거라이프 스테이터스 창 안닫히는거 우회
유틸
kts
01/27 8130 14
EZ + Ehnd 미포함) MVZ 자동 번역 + EZ서버(+ 기본 파일) + 언팩 툴
유틸
ㅇㅇ
01/25 19745 18
SEED OF THE DEAD 2 모자이크 제거패치+본편 진행도100% 세이브
유틸
귤뽁
01/24 22826 34
master 폴더 개선) RJ01144461 [むねにくたべたい] 폐급 스트리머 미라이짱~엣치한 코멘트 접수중~
유틸
ㅇㅇ
01/22 11986 10
RJ01209336 반찬 어플 소문 메모 버그 수정
유틸
daraaa
01/22 7147 9
RJ01168428 초보 가출 소녀와 나【다국어 버전】 RunawayGirl-Ver1.06 (일부노모)
유틸
류제로
01/21 15228 45
MVMZ 정규식으로 필요한 파일 위치 찾기(공통 이벤트, 변수)
유틸
ㅇㅇ
01/20 5103 3
방주 RJ중복 찾기
유틸
봇치
01/20 6621 11
MV 플러그인: ParallaxLayerMap.js
유틸
ㅇㅇ
01/19 6185 6
던전 위드 걸 1.1.3 AI 노모
유틸
물크스
01/19 17561 63
홍련사주 퓨어 엘레멘츠 치트 플러그인 적용 방법
유틸
sucksucke
01/19 8823 11
MV 플러그인: TemplateEvent.js
유틸
ㅇㅇ
01/18 4917 2
MV 플러그인: HIME_GameOverEvents.js
유틸
ㅇㅇ
01/18 7114 4
RJ01154724 이세계 환생 매지컬 자지 완전판 노모패치(DLC포함)
유틸
류제로
01/17 27878 83
MV 플러그인: HalfMove.js
유틸
ㅇㅇ
01/17 7602 4
요청 개조) RJ01509483 아스테라 사가 체력바 추가 플러그인.7z
유틸
ㅇㅇ
01/15 4254 12
RPG-Maker-MV-MZ-Cheat 에서 숫자가 잘 안먹힐 때에 (예시: 언홀리 메이든)
유틸
cybuster
01/15 10187 25
MV 플러그인: MPP_ChoiceEX.js
유틸
ㅇㅇ
01/14 3902 5
RPG MV/MZ 치트 플러그인 개조 버전 v3.0
유틸
4HHHH
01/13 12800 20
🔞슬레이 더 스파이어 NSFW 아이언클래드 및 기타 카드
유틸
Rasmodia
01/12 33588 34
참고용 ai 프롬프트(이미지) 모음
유틸
urakan915
01/11 12214 18
개조를 위한 모음(img, battlebacks1, enemies, Picture)
유틸
ㅇㅇ
01/10 5797 7
🔞 슬레이 더 스파이어 NSFW 이벤트 및 휴식 리텍스쳐
유틸
Rasmodia
01/09 14025 37