kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2250 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
개추콘
복구요청 공원장난시뮬레이터
요청
mtname
05/25 2208 -4
유부녀 세리아의 타락과 배덕 발매일 확정
정보
wouwouer
05/25 7468 34
공포+"야"겜 인거 추천해줄 수 있음?
질문
애널
05/25 1844 0
귀갓길-연이은 밤- 엔딩 후기
후기 및 공략
Nate Higgerson
05/25 3094 12
아부라소바 서클 새게임 나왔네
일반
ryyyyyn
05/25 2392 0
게임 이름이 기억이 안나네요
질문
hhtty
05/25 1249 0
(수정)이것과 비슷한 게임을 찾는데요;; 찾았습니다 관심에 감사드립니다^^
질문
hwucs
05/25 2377 1
의술사 버전업 질문
질문
nghj7722
05/25 2324 0
봉음동굴 에로네스트 해보신분들
질문
jiyee
05/25 2847 0
의술사 다리 어캐놓아요?
질문
lunee
05/25 1775 0
존재감 여동생 1.1 모바일은 아직 없는건가?
질문
rice-eating
05/25 1278 0
[구매보급] RJ01271506 フォレスティア~ちいさな町の牧場ライフ~ 1.41 + 음성DLC 적용합본
미번
fbrpdlawm
05/25 21879 163
음습의 카쿠리요 마을 이게임 ntr게임들중에 top임??
질문
pouz123
05/25 2423 -1
망가하나 찾습니다
질문
k97k98
05/25 1736 0
오나서포 mp3? 이거는 다 일어인데
질문
bestviewg
05/25 2402 0
눈을 떠보니 목이 잘려 있는 여주인공
일반
mowajelly
05/25 6677 26
고전 만화 하나를 찾고 있읍니다...
질문
aicxvmwn
05/25 3077 0
[복구요청] RJ01299483 RiNaTest
요청
porsent
05/25 3091 0
클리어 후기 : [강화버전]달인 퇴마사는 촉수요마 따위에 굴하지 않아_v260523
후기 및 공략
우흥
05/25 3433 5
아득한 세레스피아 세이브없음?
질문
르모듈러
05/25 2104 0
색귀 WASD 오류
질문
liamayril
05/25 2312 0
비월선행록 개조판 정기획득 됨?
질문
o0o99
05/25 2518 0
복구 부탁드립니다.
요청
sa-ba-chan
05/25 3944 0
[복구요청] 대마관 아폴로의 쾌감조교
요청
인디게임보지맨
05/25 1876 0
의술사 패치했더니 주인공 세졌네...
일반
happy3
05/25 2859 0
House of shinobi 게임은 정말
질문
두파루파
05/25 2009 2
이터넘 질문
질문
dfgtewkwg
05/25 1191 1
[ai 번역][Usagi Nagomu] 황혼의 창 엘프 총집편 에일린 파트 1 [p.137]
동인
mybest
05/25 16195 69
뭐지 메가 서버 터졌나?
일반
mdabedlehm
05/25 1710 -2
청아)zzz망상병 집단과 파티
영상
gal-joa
05/25 27018 87