kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2398 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
개추콘
[구매보급] [버전업] RJ01616268 종말의 얼터에고이즘 dlc만 2.02
미번
gkqisq
05/20 11442 31
[요청복구] 딸 납치하고 최면순애
복구
doritori
05/20 28523 81
의술사 후속작 너무 기대된다...
일반
ballongdoor555
05/20 3504 0
가슴이 찢어진다
일반
milim0
05/20 2817 0
역간 취향 입장에서 역간+공포 조합이 참 미식임
일반
rnqhsgur0316
05/20 2301 1
[복구요청]Hasshaku-sama 외 모음집
요청
sungdobi
05/20 3808 0
의술사)이거 버그인가요?
질문
sadlozi
05/20 2597 0
야겜 찾아요(사진추가)
질문
xownd3417
05/20 3755 0
이거 체험판 해보는데 자체한글이네
일반
그거아님
05/20 5574 0
[복구요청] [한글자막] 뉴 짱, 완전 타락 2편 ~이거, 네『원래』인격이야~ (0편~6편)
요청
iiiiinnnnniiiii
05/20 5920 0
[복구요청] RJ01051963 딸 납치하고 최면순애
요청
henry
05/20 7500 1
세레스피아 진짜 재밌네 ㅋㅋㅋㅋㅋ
일반
mandolin
05/20 3074 2
미검수, AI역식) [Sage joh] 숨겨진 사연이 있는 엑소시스트와 환생악마의 치명적인 사랑
동인
sexe1
05/20 13195 57
마인드류다 2번째 유적 입구열쇠 어디서 얻어?
질문
1ad124
05/20 2516 1
[구매보급]【오호 성교미 특화】 강아지와 성활♡ 1+2+3편
소리
이름뭐하지
05/20 16106 81
요즘들어 자꾸 사이트 검열인지 막히네..
일반
glepdytl
05/20 5468 1
역간물 겜 추천좀
질문
jon
05/20 2746 1
(AI 번역 노모) [Onaka] 性愛カンケイ / 육체적 관계
동인
macross7
05/20 18611 51
복구요청)엘리스 리젤라의 눈물 복구 부탁드립니다
요청
bsgpedmgc
05/20 2839 -1
Sinisistar2 키가 왜 아무것도 안먹히지...
질문
mei-0725
05/20 2289 0
던브) 딸이 낳아준 딸은 못데려가는구나 파티에
일반
nagisa8262
05/20 4347 3
역시 슴가는 D컵 이상이 최고라고 생각해요
야짤
minki
05/20 3819 10
RJ01568844 The Witchs End
복구
절대불멸
05/20 24633 66
큰 거 들어간다.
작업현황
mybest
05/20 6412 16
[복구요청] 전투에로 RPG ~음욕의 마탑~
요청
카카루
05/20 5473 0
복구 요청)저속해지는 공주 루시아 이야기 Ver.2.06 손번역+노모패치
요청
sksmsalstjd
05/20 6752 0
niwarhythm-천재 격투가의 패배
동인
k8625
05/20 19686 74
[복구요청] 온후한 아가씨와 작은탈출 1,2,3 (통합본)
요청
절대불멸
05/20 4398 1
판티아 이새끼들은 왤캐 번거롭게 일처리를 하는거지
일반
asdawer
05/20 4158 2
(노모 패치, 수정3) [VJ014099] 좀 더! 임신! 불꽃의 가슴 초 에로♡어플 학원!
번역
joyed47106
05/20 61003 544