kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2210 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
개추콘
던브 중층7층 어케가요?
질문
adash21
05/17 2638 0
리코의 이상한심부름 폰구동하는거 질문있어요
질문
iris1212
05/17 9652 1
아 쉬바 언홀메 모드하려다 세이브 날렸다
일반
ntr-masterpeace
05/17 4323 0
요즘 영상퀄들 지리네요..
일반
arghi
05/17 3167 0
나는 왜 ㅅㅂ 집는것마다 이러냐
야짤
5dk2io1
05/17 13309 53
급합 의술사 발간초 효과좀
질문
god4all
05/17 3490 -1
[구매보급][한국어 자막판]당신을 엄청 좋아하는 초변태 폭유 상사와 후배가 아양 떨며 마구 구애하는 알콩달콩 임신 하렘
소리
이름뭐하지
05/17 15849 130
인게임 스샷 단 하나! 뭘까 이 게임..
질문
lovemycookie
05/17 4136 0
크로네의 곁(クロネのとなり) 이거 레이패쳐 써서 기번해보려는데 막힘
질문
trswefft5
05/17 7274 0
[복구요청] [미번파일] RJ01219535 드래곤 블러드 2.12 dlc포함 1.03
요청
raybbit
05/17 4250 3
[구매보급/버전업] RJ01584572 여동생 H –짧은 하루– Ver1.0.2
번역
사과체스
05/17 38945 134
ntl 백합을 즐겨야 할 때는...
소리
gansik
05/17 13493 61
[복구요청] [번역] 착정 알라우네의 미지근한 촉수 코키로 오친포 시코시코 게임 (오나사포)
요청
tbvjxlah69
05/17 4861 0
[구매보급][미번] ダストロンガー RJ01615574 バレー部の可愛い後輩がセクハラ教師にNTRれる話
동인
riden
05/17 9349 9
님들 유부녀,밀프물 게임 추천점여
일반
hitomi
05/17 3071 0
[번역] 재미삼아 폐허에 갔다가 귀신이 붙은 JK
동인
마법우엉
05/17 24106 89
비월)방어구 강화,돌파
질문
ㅇㅁㄷㄱㅈㄷㄱㄷㅇ
05/17 2799 -2
[번역]사고 물건에서 며칠을 보내야 유령을 만날 수 있어!? 일주일 도전 방송
동인
마법우엉
05/17 22735 89
[번역]유령에게 만져지며 방송하는 스트리머
동인
마법우엉
05/17 18767 63
의술사 퀘 질문
질문
rummy
05/17 2764 -1
색귀는 하루만에 다깼는데
일반
코니아이
05/17 3583 0
와 쌰갈 ravager 존나 대격변했네
일반
kaelthas
05/17 3554 0
의술사 질문좀
질문
qazplm3444
05/17 3699 0
국산작가건 보면 바로 받아야겠네
일반
asdqweasdd
05/17 3633 0
[요청 복구] Succubus Temptation 2.0.0
복구
okviewer
05/17 24927 72
부계에 잠든 왕녀의 아바돈 치트 없음?
질문
sosiji
05/17 8328 -2
순애 펨돔같은 게임 있을까요
질문
sachunzzapagetti
05/17 2372 -1
[복구요청] RJ134905 退魔巫女物語+おまけ (퇴마무녀 이야기)
요청
konenne4235
05/17 5656 0
[버전업] [구매보급] RJ01214867 둘만의 생활_ver1.671 (26.05.05)
미번
gkqisq
05/17 11399 52
AI번역, Takurowo) 건방진 갸루를 서큐버스화 시켜서 혼내줬던 건 05
동인
sexe1
05/17 20661 117