kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2305 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
개추콘
이세계 asmr 추천
질문
amaggoto2
05/24 1394 0
전에 했던 게임인데 제목이 생각이 안나서 도움좀
질문
h8124
05/24 1554 0
이 게임 제목 아시는 분?
질문
paragino
05/24 2355 0
아이패드 구동 질문
질문
missumac
05/24 1337 0
우메마로 신작 음폭사 짧은 후기
후기 및 공략
두파루파
05/24 5619 9
픽시브 곧 차단당하나
일반
ㅇㅇ
05/24 2236 -13
RJ01634901 [Umemaro3D] Taboo Spell 영상버전(추가)
영상
ckkey
05/24 41186 252
[복구요청]옛날에 괴롭히던 양키가 나의 마사지점에 왔다
요청
sdfsdafsadfs
05/24 2199 0
[구매보급/ AI 공식 번역] 빗소리로 가득 차는 밤 1.2.0
번역
yeondooooo
05/24 46406 276
[요청복구][RJ342578] (청아) Jam packed line tale
복구
roomonfire
05/24 12662 33
[자동번역](이미지 번역 필요) 야간 버스에서 여자아이의 팬티가 흠뻑 젖을 때까지 치○ 해버렸다
번역
제로콜라라이트
05/24 39895 148
(스포)유니슨코드는 분위기는 백합인데
후기 및 공략
paddackmon
05/24 3291 3
[복구요청] [렌파이, 손번역] NewHorizon-0.4-pc
요청
하네카와 하스미
05/24 2477 4
이거 어디서 본 초식인데...
야짤
루파조아
05/24 4770 7
의술사 퀘스트 빈 퀘스트 질문좀
질문
djrmfh202
05/24 1786 1
유니슨코드 스포작 할 생각에 막막하네
일반
ENE
05/24 1789 2
게임 추천좀
질문
mkasdo
05/24 1946 0
[복구][RJ119910] 로리퀘2 ~순백~ 4.01
복구
개구리
05/24 13005 36
[요청복구] Fantasy Factory 서클작 3개 복구
복구
갈랐다고
05/24 14513 39
교만아내 정도면 SSS급 더빙인가
일반
gimku1556
05/24 1502 0
[복구요청] RJ201837 알프스와 위험한 (KR, 노모)
요청
dosirack1
05/24 2932 0
이런스토리 게임 더 없나요?
질문
enrkenrken
05/24 1739 0
[복구요청] 레이디 나이트 ~음마의 미궁~복구요청합니다
요청
ㅎㅌ 조아
05/24 2569 1
RJ341616 The Fate of Choice v1.1a 번역 오류
피드백
dsfswee
05/24 3104 0
비월선행록 정기흡수
질문
생각하는고래
05/24 2026 0
[1편+2편][구매보급]넷카페에서 옆개인실의 여고생과 교미하는 이야기
소리
이름뭐하지
05/24 6853 61
[버전업][AI][패치만] 알미오시온의 의술사 ver 1.06
번역
lovesccubus
05/24 26811 157
비월선행록 토지신 공물 퀘 질문
질문
202603110929
05/24 2486 0
잘 만든 순애물의 단점
일반
paddackmon
05/24 1519 1
검은 묵시룩 2 후기 및 회상방 및 기타 등등
후기 및 공략
60348152
05/24 2197 5