kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2406 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
개추콘
[요청복구] [보이스코믹/음성] [한글화] 반찬당번 마치다짱
소리
acefs
05/21 14559 70
으흐흐 보빔..
일반
쩝냡
05/21 2963 2
[구매보급]【강○ 임신♪】 절대로 당신의 아이를 임신하기 싫은 메이드가 봉사를 해주는 일상
소리
이름뭐하지
05/21 12050 75
요몽원 폰으로 하는중인데 질문좀
질문
sjdifnt
05/21 3293 0
웃기지만 시니시스타 하고 후유증 와버림
일반
roomonfire
05/21 3429 6
안돼! 동거라이프 DLC 5월 상반기 현황
정보
straight6
05/21 7552 21
야겜 내용으로만 찾을 땐 어떻게하는게 좋아요?
질문
너울
05/21 5729 2
시니시스터 스팀판 나와서 처음부터 새로 하는데
일반
majimoose
05/21 4382 4
[미번/청아][ORC SOFT] DSKBJCS 도스케베 쥬시즈☆
미번
돔마
05/21 11347 23
[미번][중국어] NTR 전설 remake 0.9.2
미번
Ed
05/21 14736 42
나다 누코마진 망령
정보
karoru
05/21 4430 11
요즘 뭔가 꼴리는 겜이 없네
일반
madeinheaven
05/21 4600 1
던전앤브라이드 화면 크기 조절 따로 못함?
질문
eternalgreed
05/21 3054 0
[Tulip] 혼혈 서큐버스들의 일상
동인
1uF
05/21 22430 121
히로미(히토미 미러)에 유저 번역본 업로드하면 어떨까요?
일반
hiromi
05/21 3830 2
[Nishikawa Kou] 딸 대신에 내가 1, 2
동인
1uF
05/21 16634 64
(수정 사항3)내가 쓸려고 만든 코드 검색용 + 파일관리
유틸
ATTAA
05/21 4046 14
[Takaman] 심야의 매혹
동인
1uF
05/21 13907 71
비타민퀘스트2 번역
질문
wlskrksmsakdrh
05/21 5398 0
나도 맨날 ntr겜 소재 망상함
일반
apptr
05/21 2439 0
AI 나온지도 오래인데 AI끼리 팍팍 의견 주고받으면서 성장했으면 좋겠다
일반
chuchuruli
05/21 4772 0
에로스테 rpg겜 신작 재밌는거 없나욘??
질문
싸마
05/21 2123 -3
스포) 의술사 정신나가서 못하겠네 시발
일반
미미쨩
05/21 4662 0
[자체한글, 구매보급] [VR전용] 【VR】초만원 전철 ~역에서 발견한 귀여운 아이에게 몰래 장난~
번역
frcition
05/21 32139 140
비월선행록 봉조황성 가는법 질문
질문
스코
05/21 3091 0
와 지금까지 ballon translator 인페인트 cpu로 하고 있었네
일반
라비쉬
05/21 4959 0
존재감 여동생 신규씬 게임중 배면좌위 씬 + 거실 야한비디오 배면좌위 항섹 씬
야짤
맛보기
05/21 18556 22
Happy Island Fantasy 신규 DLC 'Sexual Bliss' 출시!
정보
네르이스
05/21 4149 12
시엔으로 올라온 아헤마루 연습짤
야짤
sorbe123
05/21 7927 12
[복구요청] [미번파일] RJ01219535 드래곤 블러드 2.12 dlc포함 1.03
요청
dkfvkzk123
05/21 2742 8