kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2348 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
개추콘
93. AI, 샤니마스) 카호로 짤 제작 실험
야짤
miso5
05/24 6423 32
RJ01391107 호시즈키 아스나와 음욕의 지하가-append 노모버전
요청
saks0818
05/24 3065 2
알미오시온의 의술사 1.06
미번
ashesone
05/24 23433 118
근데 왜 소미소프트지
일반
nagisa8262
05/24 2511 2
[ai번역] [Hatoya Mameshichi] 동경하던 그녀(선생님)는 치한전차에서 조교완료 되었습니다 6~8 [p.469]
동인
mybest
05/24 13614 28
던전 위드걸 NTR 요소 및 발생조건 정리해 보았음
후기 및 공략
웃흥
05/24 5985 24
비월선행록 회차 버그있는건가?
일반
o0o99
05/24 1259 0
[복구요청] [RJ157504] 시골 보건소 - 능욕당한 마을 소녀 미쿠 -
요청
packapunch
05/24 2684 1
[복구요청] (RJ01327055) 쑤셔넣기 시뮬레이터 대전집
요청
yoopung
05/24 2352 1
Ballon 번역기 번역본에서 글자 지운 흰색 안나오게 하는 설정 질문
질문
frost5
05/24 3146 1
직번) [Yamamoto Zenzen] 학원원교일기 Comix 2.5화 + 3화
동인
qlalfsla
05/24 15864 63
게임 추천 부탁드림 (양겜 중심, 임신, 네토라세)
질문
summertree
05/23 2922 -3
구매보급) 【한국어판】악마에게 씌어 있다고 믿는 후타나리 성직자 소녀
동인
GOOD
05/23 22143 139
90일, 이미지 번역) RJ141187 상복 로리타 구속 기담 미소녀 성 노예 조교
번역
ㅇㅇ
05/23 36923 280
몬블마 모드판이 좀 늘었으면
일반
villan
05/23 1700 1
고전명작은 그 이유가 있는법이구나
일반
ㅇㅇ
05/23 3420 8
그러고보니 전원 네토라레 2
질문
okjack
05/23 4322 0
[복구요청][영상] 에바네시아(스타레일)
요청
blackblgdick
05/23 3891 0
오직 소피라만
일반
ENE
05/23 2531 2
의술사 질문... 보스 두 놈을 못 찾겠어..
질문
nightknocker
05/23 2106 0
의술사 b엔딩 대체 어케 봄?
질문
응애
05/23 2855 0
[복구요청] 벌주고☆만지고 여동생짱
요청
als149
05/23 4734 2
[구매보급] RJ01634952 Taboo Spell
미번
cassett
05/23 14771 108
[요청복구] RJ01282013 LabSweeper 도로시의 비밀 연구 기록
복구
생_선
05/23 18808 49
[복구요청] RJ01232207 FHH FapHero ほいくえん
요청
whytcat
05/23 3068 0
ai) 블루아카이브 리오 / 하스미
야짤
Ghost
05/23 5908 22
[복구요청] RJ01282013 LabSweeper 도로시의 비밀 연구 기록 복구요청드립니다
요청
r01923
05/23 10123 1
[AI번역]RJ01304151 마법창녀 리스테일 ~싹트는 음란의 씨앗~
번역
gaymaster
05/23 45067 263
비월선행록 번역이 복종-불종 두개로 갈려서 좀 헷갈렸네
일반
o0o99
05/23 3211 2
스타튜 벨리 모드 적용 질문점요
질문
수집가아죠씨
05/23 3097 0