kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2190 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
미끼치한수사관 리나 꼭지 맞추기 게임 개선(?) 모드 v0.2.1
유틸
ltony
05/13 10620 12
(수정 기능 추가) 동인지 볼 때 쓰려고 만든 자동 스크롤 뷰어???
유틸
ATTAA
05/12 15777 6
비월선행록 CommonEvents.js 누락 수정 패치
유틸
kangjang
05/12 10435 14
QW1wbGVjdGVk 블렌더 파일 공유 두번째 4.72GB
유틸
hannanas
05/12 9203 13
QW1wbGVjdGVk 블렌더 파일 공유 첫번째 9.74GB
유틸
hannanas
05/12 15595 21
이미지 다운로더 만들어봄
유틸
lordofcinder
05/11 7856 34
[LM Studio + RPG Maker MVMZ] LMTranslator [쯔꾸르 다국어 번역기]
유틸
전적노트
05/11 13988 9
코캇 명조 히유키 프리셋 2종류
유틸
pst0025
05/09 15937 24
(코이카츠) 씬 카드 공유
유틸
pst0025
05/09 9179 44
시니시스타2 안대 금발녀 모드 1.2.1 ver
유틸
cascastu
05/08 14386 37
[후타]pernio의 후타나리 시리즈 노모패치 모음(요청복구)
유틸
레가토
05/07 4583 6
자동소미 해적판X2 1.0.4업데이트 알림
유틸
스눕제이크
05/07 6455 18
[★추천] 무료 망가 번역기★
유틸
mybest
05/07 27759 127
(코이카츠) 소전 캐릭 2명 프리셋
유틸
pst0025
05/06 6791 21
(코이카츠) 명조 신캐 둘 프리셋
유틸
pst0025
05/06 6352 37
미끼 치한 수사관 리나 유저 모드 (직접 만듬)
유틸
a2343212
05/06 8076 14
Unity Texture Changer v1.0
유틸
kumarin
05/05 7569 34
90일) VX, VXA 개선용 스크립트 +@
유틸
ㅇㅇ
05/05 3861 8
(코이카츠) 버튜버 프리셋 공유
유틸
pst0025
05/05 16995 79
염월선행록 translation-cache.log 5월10일자 갱신 마지막
유틸
보바도사
05/04 8843 39
배덕의 달콤함에 물든 마나카 FansChat 마개조 및 번역 모드 WIP Manaka
유틸
sco0815
05/04 12033 57
파일 구글 or LM 번역기) AI_kr_tr_9.pyw, AI_kr_tr_8.pyw
유틸
ㅇㅇ
05/03 11490 20
⚠️⚠️멀웨어 탐지 스크립트 (신종 RAT) - 260502⚠️⚠️
유틸
moomin
05/02 17459 103
RPG Maker MV/MZ 실시간 번역기 3.1 (구동휘정3 대응 -3)
유틸
mrpls
04/30 17217 36
[오류패치] 섬홍의 아리에스 1.21 db 오류에 대한 패치 (패치만 있음)
유틸
aquapre
04/30 4391 12
게임을 윈도우 샌드박스 안에서 실행하는 스크립트 (악성코드 대책)
유틸
mrpls
04/30 7229 19
[노모파일, AI] 파치몬 -8bit MONSTER-
유틸
soxocel777
04/29 20411 56
동음 폴더 정리기
유틸
안리체
04/28 7084 7
자동 소미 해적판의 해적판의 해적판 (260503 13:58 v1.3.5 업데이트)
유틸
bellbell
04/28 13533 38
사신상관 치트앤진 치트 테이블(수정3)
유틸
ㅇㅇ
04/28 10743 7