kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2237 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
개추콘
던브 안 한 뇌가 던브를 해보려 하는데
질문
단또
05/26 2036 1
키오스크 애드블락 예외 설정해도 광고 뜨는거 원래 그런건가?
질문
teQe42
05/26 1692 0
ㅗㅜㅑ시니시스타 또 신박한 모드 발견
야짤
roomonfire
05/26 13007 39
혼욕탕씬 나오는 게임 있나?
질문
satam1212
05/26 2381 0
마나카 이거 해금한 스킬 어케 씀?
질문
으악아니야
05/26 1136 0
추남&NTR 좋아하는 인간의 후기 겸 게임 추천 받기 (스포)
후기 및 공략
ptiosdgo
05/26 4539 12
태양의 오르골 언제나옴
일반
fjeif2
05/26 1239 0
unholy maiden seed of profanity모드 1.4
유틸
leessss25
05/26 2074 13
게임 심사가 왤케 오래걸리냐
일반
ksw112
05/26 1924 1
존재감 여동생 한달 버티기 퀘 보상 뭔가요?
질문
rice-eating
05/26 2061 0
[복구]섹타듀벨리 모드팩
유틸
continuereset
05/26 5099 20
의술사하면서 스토리보며 느낀점
일반
소하
05/26 1306 0
[그냥복구/본체없음] 배덕의 달콤함에 물든 마나카. 여기서 받은 모드팩
유틸
루파조아
05/26 2974 9
조이 플레이 쓰는데 어떡합?
질문
abc456
05/26 2112 -2
최근에 아오이짱 겜 재밌게했는데
질문
qwqqqq
05/26 1988 1
드래곤 콩키스타 < 이 겜 사람간의 임신은 없음?
질문
everywhere
05/26 2047 0
이런게임 있을까요?
질문
mkmkil
05/26 1746 1
[요청복구] [한국어자막판] 퇴마관 미야비의 음옥생환보고
소리
9ya
05/26 7676 54
[미번/번역요청]우리들! 성교육 위원회 만화판
동인
아돌
05/26 12255 30
마나카 질문 있음
질문
으악아니야
05/26 2115 0
[복구 요청] RJ01326857 음흉하고 한결같은 깡촌 오라버니와, 예스럽고 병약한 여동생 + Append 1~5
요청
napulnapul
05/26 1790 0
게임 제목 좀 찾아주세요
질문
kotori97
05/26 1311 0
포레스티아 공식 한글 설마 2.0인가
일반
tleni
05/26 2627 0
[단편](약깜놀) 자각몽 섹스로 귀신 제령시도 하는 이야기
창작
깡통기사
05/26 5098 44
시니시스타2 1.3 리볼의 육벽은 어떻게 부숴요?
질문
powwa
05/26 1342 0
여주가 점점 걸레 되는 게임 있나
질문
carahil
05/26 1861 1
(구매보급,번역요청) 챔버게임 1.1 업데이트
미번
12532748912
05/26 5951 23
[천재 퇴마사는 촉수요마 따위에 굴하지 않아]개조 진행 중..
작업현황
dmol2279
05/26 1918 5
[이미지번역]RJ01354109 에이전트 엘레나 이미지 번역
번역
ommkamb
05/26 33816 139
어떤 분의 댓글을 위한 작성 글(노모 관련인데 머리 아퍼지니 보시는 거 비추드림)
정보
지나가던허접a
05/26 2633 11