kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2199 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
개추콘
(보테배) riboshika 신작 1만 다운로드 감사짤
야짤
츠바키미유
05/17 8068 22
스토리나 게임성 야무진겜 추천 가능?
질문
votmvkdlsej
05/17 4290 0
[복구요청] RJ424103 アゾット 아조트
요청
명붕이
05/17 2902 0
[미번/구매보급/번역요청] 라파푸루 합본팩 (게임이름 및 번호들은 본문기재)
미번
silver
05/17 12808 27
이 게임 기억나시는 분ㅠㅠ
질문
korer
05/17 3365 0
Scarlet escape 실행오류
질문
yuhwayuhwa
05/17 3228 -1
의술사 나이프 어디서 얻음?
질문
hyun0607
05/17 3380 0
여주물에 개걸창인 겜 추천 좀 부탁드립니다
질문
zenche
05/17 5119 0
Ai소녀 쉐이더 적용하는법 아시는 분
질문
goat-joat
05/17 2001 0
좀 색다른 게임없나
질문
mkasdo
05/17 5264 1
[복구요청] (RJ01445683) 오네쇼타 RPG 유혹의 싱귤래리티 ~음란과 타락의 여신에게 노려진 소년이, 성벽이 산산조각 나면서도 끝내 유혹에 맞서는 이야기~ ver.1.11
요청
godfem
05/17 9674 2
음해의 트랜스크랩 번역 현황
작업현황
날개 로봇
05/17 9560 41
게임 이름 아시는 분?
질문
nameko1237
05/17 2769 0
3d 포르노 만들어보고 싶은데
일반
qar0010
05/17 9242 -3
...? 이거 미친놈아님?
일반
아로나
05/17 3448 5
체험판을 하면 기다리는게 더 괴로울거같은데
일반
memphis
05/17 3884 4
[복구요청] RJ01585232 여름방학, 나는 친구의 여자친구를 NTR했다 ver.26.03.14
요청
makauboy1004
05/17 4967 1
비월선행록질문있습니다.
질문
skaiqk
05/17 1514 1
개막장테크 재밌네 ㅋㅋㅋ
일반
nagisa8262
05/17 3223 2
[Homunculus/노모] 봄을 쫒다
동인
ㅇㅇ
05/17 18745 104
던전 앤 브라이드(RJ01431277) 순정버전 1회차 클리어 세이브 파일 복구
세이브
lethita
05/17 9434 7
livemaker 번역 작업 3일차
일반
아로나
05/17 1970 3
던브 이거 노움한테 청혼 어케해야됨?
질문
nagisa8262
05/17 3260 0
패전례희 아르네아 짧은 후기
후기 및 공략
qudo
05/17 9300 4
[복구요청] 米悠ch (JP) KKD 작가 영상 복구요청
요청
bane7330
05/17 10047 0
리오를 따먹었던 3년전 그날..
야짤
EPanDS
05/17 7515 12
[약스포] 타락신관 순애루트 클리어 후기
후기 및 공략
tovozsrfh
05/17 12595 4
[요청복구] 요청복구 3개
복구
illusia
05/17 24951 62
AI, 마비노기) 목욕중인 나오 소환하기
야짤
miso5
05/17 9502 58
[복구요청] RJ01378937 거유 자매( 巨乳姉妹)
요청
maronmaron
05/17 4449 0