kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2275 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
개추콘
슬슬 7회차 가야지
일반
Wicker Man
05/18 2190 3
아니 근데 존재감 여동생 좀있으면 1.1 완성된다며...
일반
pajama
05/18 2302 2
오늘도 번역했어,
작업현황
아이기스맘
05/18 6187 17
님들 ai 창작 어떻게합니까
질문
wdakdk
05/18 2458 -1
급처) 10종 복구
복구
ziririri123
05/18 48051 145
[AI번역][미검수]마녀의 유산 외 2개 + 요코시마 피트니스 클럽 버전업, 요코시마 수행 마을 수정 알림
번역
솔라셀
05/18 32809 148
Ai로 게임 번역하면서 알게된 몇가지 사실
일반
아로나
05/18 1911 3
게임 찾습니다
질문
kirayo
05/18 7883 0
[복구요청] RJ160355 아모르 마법학원
요청
park0202
05/18 2702 0
오크마사지
질문
hjk123
05/18 3335 0
돈쓸데가 많을테지만
일반
ㅇㅇ
05/18 3297 0
줏어온거 2개
영상
FRENESIA
05/18 24594 66
*스포주의 알미오시온의 의술사 후기
후기 및 공략
kimrak
05/18 13891 30
의술사 ex엔딩 스포좀 해주세요....
질문
pataya
05/18 3018 0
언제봐도 여기 서클은 필력 개미쳤음ㅋㅋㅋㅋㅋ
후기 및 공략
BroadRight
05/18 6452 1
5월말에 방주한번 더 풀듯
일반
RED LOTUS
05/18 3222 5
겜 추천좀 해주세요
질문
스피넬
05/18 2313 0
[복구요청][スタジオシロッコ] RJ378848 내 여자친구는 절대 네토라레 당하지 않아 (NTR주의)
요청
qwdpkjqw
05/18 9881 0
사신상관 ㅈㅈ다 시발 얼마나 우려먹는거야
일반
해피호건
05/18 2346 0
극도무뢰 EX: 여경 아유카와 히카리 -- 처녀가 변태로 변하는 갈림길 6/5 발매 예고(?)
정보
wouwouer
05/18 9777 38
의술사 진엔딩 조건이 뭐임??
질문
pataya
05/18 2217 0
RJ410262 Lost Chapter v2.10
요청
레드슬라임
05/18 3307 -8
レトリアの大冒険 아직 초반이긴 한데
후기 및 공략
네토라레프린세스
05/18 3840 1
떡인지 하나 기억이 안나네
질문
pwuwhs
05/18 3692 0
ㅍㄹ 모음집
영상
darkunicorn
05/18 19799 94
[그냥복구] 괜찮았던 세뇌타락물 2종 nowhere to run, 신애전희 핑크하트
복구
kimoring
05/18 20586 49
조이플 필요하네...
일반
갍횳늶쥯옖늙쉻뇽
05/18 1866 0
아니 ㅋㅋㅋㅋ 요즘 ai 근데 검열 꽤 약해진건가?
일반
ajqjajqkqa
05/18 3612 0
최면성지도 칼라미번
동인
무이이야
05/18 17628 18
청아, 직번) 줄무늬 그림책(Wancho 일러집)
야짤
rapbit
05/18 6235 11