kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2371 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
개추콘
의술사 이거 존나 재밌네
일반
Noel
05/20 2322 0
ai, 붕스) 스파클이 자꾸 유혹해서 마구 질내사정 해줬다
야짤
kjh9304
05/20 9888 116
알미오시온 의술사 질문 드립니다
질문
aaaaa1242
05/20 3324 0
판티아 왜 그러냐
일반
dtgft6
05/19 1866 0
오늘 예비군이다...
일반
겜믈리에
05/19 3227 3
AI번) (역NTR) 좋아하는 남자를 엄마에게 뺏긴 여자
동인
latte
05/19 17440 99
타락신관 대사 안 보이게 하는 거 없나요
질문
sra22
05/19 2702 1
방주 정리하면서 나도 모르게 삭제한게 좀 있나보네
일반
toung
05/19 3897 1
[AI번역][Gya-tei] 전학 온 갸루 서큐버스의 진수성찬은 나 혼자 2
동인
allooww
05/19 15620 63
(스포)Lost chapter 이거 감정선이 좀 이상한데
일반
paddackmon
05/19 3436 0
태양모양 솔라 스크립트 전체화면 단축키
정보
qee1231eqw
05/19 5958 -3
Lynea - Intergalactia Segs
영상
굴라그의죄수
05/19 17694 110
샤코리와 타락한 도시 save
세이브
rkdrkdtnf1212
05/19 6613 14
게임샀다
일반
페비
05/19 3218 4
のっふん 원〇 애니메이션 모음 BOX
영상
하누마 마코마코
05/19 29751 185
판티아도 지랄났네
일반
페비
05/19 3011 10
아무도 낚시 안했는데 혼자 제목낚시당함...
일반
발바닥
05/19 2351 1
[요청 번역작-cg집] [ai작품-ai번역] [Bleachmama] NTS Kr○nii after (v2) <p.255>
동인
mybest
05/19 26540 80
펄스미스2 배분이 왜 이러지
일반
un1542
05/19 3790 1
x 미디어 한번에 다운로드 할 수 있는 프로그램 있을까요?
질문
gigi-murin
05/19 2199 -3
[복구요청] 귀신감독과 내 여자친구 ~여배우 지망생이 귀신감독과 육체관계를 맺은 이유~
요청
아름답고창조적인해산물
05/19 2608 1
성행위 실습은 아빠와 번역 누락
피드백
ㅇㅇ
05/19 4193 0
던브 개인적인 팁
후기 및 공략
hacom
05/19 4401 11
케모노 뒤진거 안타깝네
일반
페로로질라
05/19 4742 0
[식질요청] RJ141187 상복 로리타 긴박 기담 미소녀 성 노예 조교
미번
ilillilllilil
05/19 21242 48
명조 에이메스 BBC
동인
굴라그의죄수
05/19 21190 57
던브 마법사도 간단하게 마법스킬 쓰는 방법이 있었네요
질문
fusbriwidhei32
05/19 4336 1
후속작 떡밥 있는 야겜이 너무 무섭딘
일반
부탄가스
05/19 2030 0
ntr을 너무 즐겨보니까 좀 이상해짐
일반
ikusa-1
05/19 2792 0
의술사 보스 질문좀 너무 어려움
질문
ahukj
05/19 7249 -1