kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2194 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
개추콘
asdsdadsadas
일반
코네
06/11 420 0
dsdsadasdsadas
일반
코네
06/11 980 0
제4목
일반
Magic
05/29 714 0
제3목
일반
Magic
05/29 424 0
제2목
동인
Magic
05/29 465 0
제목
일반
Magic
05/29 448 0
sdadsadsa
일반
Magic
05/29 741 0
의술사 로드하려면 겜끄고 다시켜야되는거 진짜 존나불편하네
일반
nagisa8262
05/28 917 0
혼자 몇시간씩 끙끙대면서 이것저것 만져보다 결국
작업현황
Empty0
05/28 785 3
[구매보급][번역요청] RJ01261369 淫欲の輪廻
미번
nfssss
05/28 834 3
니트사장 신작 칸코레 애틀랜타
영상
ㅇㅇ
05/28 751 6
오늘은 진짜 엔딩보고 딴 거 해야지
일반
ENE
05/28 748 2
버,청아,방뇨) セネト 신작 신데마스아리스 사쿠라미코
영상
ㅇㅇ
05/28 1224 6
삼성갤러리 원드 연동 종료
일반
정실은스쿨드
05/28 854 0
던전앤브라이드 여주플 모드는 없는거죠?
질문
시소시소
05/28 1017 0
청아) まだな(madana90962) 신작
영상
ㅇㅇ
05/28 821 7
Lapin Gris 신작
영상
ㅇㅇ
05/28 874 7
여주물 배틀퍽 있는거 추천해주세요
질문
nagisa8262
05/28 524 0
게임 이름을 알고싶음!!!
질문
prontal
05/28 524 -1
[구매보급]오호성 섹스하지 않으면 나갈 수 없는 방, 쿨한 여자의 교미 관찰
소리
이름뭐하지
05/28 1132 5
판매자가 게임을 내리는 경우도 있나? 아니면 다른 곳에서 판매하는건가.
질문
124142355t1
05/27 474 0
던브 통합모드 에러
질문
karim
05/27 449 0
에로검열관 DLC 유리코 퀘스트어케 받는겅미?
질문
의현아가방쮸쮸탐사원
05/27 1064 -1
[복구요청] 3D 치한 체험 만지기 무제한! 통학 전철 편
요청
somisoft32
05/27 1072 1
게임 구매한거 공유 처음하는데 암호화는 어떻게 하는거에요?
질문
ㅇㅇ
05/27 1052 0
이세계의 마법소녀들(후타,퍼리)
창작
sexqueen0312
05/27 893 1
(세이브요청) SEED OF THE DEAD 2
요청
kkull00
05/27 953 0
100만년만에온 여동생 모노크롬 앵콜 제작근황 ㅋㅋㅋㅋㅋㅋㅋ
정보
여동생킬러
05/27 972 8
요즘 서브컬쳐겜은 콜라보 할데가 없나
일반
kunarin
05/27 821 -2
에로 검열관 회상방에 도트씬 없음?
질문
kmk102
05/27 1300 0