kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2394 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
개추콘
Nekoshoko-레이프 합법화~아나운서 가슴 일기예보!
동인
k8625
05/20 29981 120
잘생긴 소붕이만 들어와라
일반
아이기스맘
05/20 2320 0
비월선행록 0.35올라옴
일반
보바도사
05/20 2123 0
Nekoshoko-거유로리소녀 모음
동인
k8625
05/20 29190 155
판티아때문에 시엔이주ㅈㄴ많네
일반
여동생킬러
05/20 2136 1
Raidon-화내지마 호시카와 1~3
동인
k8625
05/20 20832 153
예비군 근황...
일반
겜믈리에
05/20 4313 3
셀레녹시아 귀엽농
일반
쩝냡
05/20 2491 6
판티아 검열때매 작가들 근황...
야짤
duckuu12
05/20 7214 12
태그검열하는 곳이 점점 생기네
일반
블랙패킷
05/20 3151 2
의술사 ex엔딩 막보 어케잡음?
질문
simya1557
05/20 2122 0
너무 힘들다
일반
이상한 사람
05/20 2827 0
게임 추천 받아요
질문
hakkrn
05/20 3284 0
꿈에서 찝찝한 근친물 봤음
일반
antarctica
05/20 3141 2
여성인권 신장을 위해 왜 맨날 투디만 잡냐 ㅠㅠ
일반
렐루
05/20 3059 0
모니에 (명조)
영상
브레머튼
05/20 20973 96
ㅁㅊ.. 나 Nas 망가지면 꿈도 미래도없네
일반
아로나
05/20 2828 -1
약간 스포) 사타니 카스미는 당신이 없으면 살아갈 수 없어 121일차 후기
후기 및 공략
Nate Higgerson
05/20 8245 15
이와라 막힌이후로 들어가려면
질문
샤이네스
05/20 2677 0
[구매 보급] Re:IA 모음집
영상
bluescreen
05/20 39544 327
비타퀘2 업스케일판 이미지 깨짐
피드백
catarisk
05/20 11549 5
ai 아카메가 벤다)잠입작전중 포획당해 감금조교당하는 첼시
야짤
ezmood
05/20 11595 69
판티아가 일본계 후원 사이트 중에서 제일 기능 구린 곳이었는데
일반
날개 로봇
05/20 5599 2
[후타주의] 귤복복 & 의현 (ZZZ)
영상
브레머튼
05/20 24392 106
왜 판티아 알림 메일이 줄줄이 올라오나 했더니
일반
번거
05/20 2609 1
AI) GPT로 뽑는 H 스테이터스 화면에 회상 시스템 비슷한 걸 구현함
야짤
날개 로봇
05/20 10436 31
펨돔물 게임 추천 부탁드려요
질문
rrrrrrrrrrrrrr
05/20 4757 0
판티아 단순하게 모자이크 더 강화하라는 건 줄 알았는데
일반
단또
05/20 2390 0
이러면 판티아 쓸 이유가 있나?
일반
notmyark
05/20 2882 0
jellfish 주문하신 아스나입니다.
동인
굴라그의죄수
05/20 18174 31