kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2185 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
Sign in to comment
07/30/25
개추콘
Sign in to comment
마나카 릴리스 모드 번역
유틸
죽지않아
02/16 11215 6
청아)시니2 하냐 컨텐츠 더 추가해줬으면
유틸
cascastu
02/16 10363 11
[요청복구] Prison Hero 감옥용사 조이플 구동패치
유틸
감비아
02/16 9068 5
SecretFlasher.VoicePack-Plus 마나카 음성모드 개인수정(로우튠 등)
유틸
leedi
02/16 24422 26
GameDB 배포
유틸
심심한개발자
02/15 8782 11
기번 너스콜 선택지 ㅁㅁㅁ로 뜨는 문제 해결 필요한사람 가져가세요
유틸
tyrocsx
02/13 10319 16
[노모패치] RJ274510 이누히메 1.07
유틸
panzer
02/13 16359 27
프린세스 시너지 전용치트
유틸
4HHHH
02/13 9643 11
안돼! 동거 라이프 세이브파일 에디트 (파이썬)
유틸
jghkk9
02/12 8269 2
[노모패치] RJ01302356 리리네와 연금술사
유틸
bubblegum
02/12 11740 9
f95에 올라온 RJ01550550 프린세스 시너지 완전 노모개조파일 있는데
유틸
pd99990
02/12 21728 34
comfyui를 이용해서 만화를 자동채색+검열제거 해보자
유틸
프로베스트캣
02/12 17450 48
시니시스타2 내 취향 가득 들어간 핑챙 자작 모드 (1.2.1 ver)
유틸
cascastu
02/11 22814 85
90일, 복구) 유니티6 번역세트.zip 갱신 26.03.21
유틸
ㅇㅇ
02/10 9376 19
유니티 기계번역 딸각툴
유틸
Ghost
02/10 9124 10
ProjectR v0.7.0.0 무검열 패치(수정)
유틸
choi-good
02/10 13769 20
프린세스 시너지 전용치트
유틸
4HHHH
02/10 11582 10
[요청복구] RJ01453643 [PlumSoftware] 네토라세에 능숙한 야마다씨 (이미지번역)
유틸
류제로
02/09 8209 9
[요청복구] RJ01511074 사쿠라코 네토라레담 타이틀 및 이미지 번역 (3차 수정_찐최종) 2026.02.09 게시물 수정함
유틸
류제로
02/06 19088 18
삼국지8 리메이크 PK 여성화 하렘 (149명 패치) 1.1.0버전용
유틸
크로우
02/05 21465 64
감옥용사 조이플 구동패치
유틸
ssddttj
02/05 8135 3
코캇 버) 프리셋 (모드포함)
유틸
pst0025
02/05 14331 29
[요청복구] [1.10으로 암호화 다시함] [이미지번역](에로스테만) RJ01522194 NTR히로인 화이트스노우
유틸
류제로
02/04 8678 14
모모 크래시 ver.1.60 (26.02.02)
유틸
미스터장
02/04 8404 5
[노모패치만] 여름의 뒤편에서
유틸
미스터장
02/03 14685 30
🔞슬레이 더 스파이어 NSFW 모드 올인원 (5.12 갱신)
유틸
Rasmodia
02/03 46927 112
터널탈출FE 0.18.0a 복호화
유틸
wqddsag
02/03 12114 6
MV 번역 이식 도구 파이썬 코드
유틸
lovesccubus
02/03 11368 5
[DLC만] 세계수의 무녀 ~거리 한복판에서 만지기 무제한 & 에로 트랩으로 갸루 겟츄~ 【H씬 전부해금 DLC】
유틸
미스터장
02/03 16730 46
차라 키우기
유틸
beplnex
02/01 7961 6