kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2180 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
다키스트 던전 Anaertailin 몬스터 컬렉션/NPC NSFW 모음
유틸
삐뉴
07/28/25 10991 27
미리보기 관련 유저스크립트
유틸
cloud67p
07/28/25 2494 3
Base64 링크 자동번역 확장 프로그램
유틸
blacklink
07/25/25 6094 15
카린 전용치트 Karryn's Prison 전용치트 ver1.4d
유틸
4HHHH
07/22/25 18525 22
이제 다운받은 망가도 히토미를 보듯이!
유틸
blacklink
07/21/25 8366 17
RPG MV 치트 플러그인 개조 버전 v2.1
유틸
4HHHH
07/19/25 21641 30
[노모이미지파일만] 카바씨네의 즐거운 투병 생활UC
유틸
미스터장
07/17/25 9027 23
goodbyedpi
유틸
unkown453645
07/15/25 6087 23
mpv(영상플레이어)
유틸
unkown453645
07/15/25 4327 9
로케일 에뮬
유틸
unkown453645
07/15/25 4712 15
아랄트랜스
유틸
unkown453645
07/15/25 3857 12
투투컨
유틸
unkown453645
07/15/25 4376 11
간단한 자동 RJ/VJ 코드 링커
유틸
traffica9
07/15/25 4373 7
webp -> jpg 이미지 변환기
유틸
anaweak
07/15/25 3213 13
루저메이커 뷰지 모델링
유틸
vneldzhffk
07/14/25 3921 3
드래곤 콩키스타 스탠딩 일러스트 가슴 흔들림 모드 번역
유틸
미스터장
07/11/25 11260 49
다키스트 세일 기념 NSFW 스킨/모드
유틸
삐뉴
07/11/25 8258 27
시니시스타2 모드 관련 편집 모드툴?
유틸
무슨소리니
07/11/25 5522 13
한여름의 절정 캐릭터 공유2
유틸
mola245
07/10/25 11160 30
요즘 애용하고있는 랜덤 파일 선택기
유틸
skdyd
07/07/25 4342 13
한여름의 절정 공홈에서 퍼온 캐릭터카드
유틸
ㅇㅇ
07/05/25 7841 15
MaidenSnowEve 메이든스노우이브 어느 전야제, 보이스팩 + 양덕모드
유틸
eyjafjalia
07/04/25 5232 13
[2026-01-11] 히토미 다운로더 코네용
유틸
kts
07/03/25 22432 66
Sexbound(스타바운드)통팩 V0.2 ,Lustiest Lair 1.6 메가-커스텀 팩(2025.09.30까지)
유틸
파에톤1호팬
07/02/25 15036 24
[업뎃] base64 자동 복호화 1.4.15
유틸
arcjay
07/01/25 18690 35
개념글 앞에 ⭐️ 붙이기 스크립트
유틸
963
06/30/25 4029 13
[복구]+@ 시니시스타 2 모드 모음(1.07)
유틸
sims9876
06/29/25 38075 39
웨일 브라우저 로컬 저장소 이미지 번역용 로컬 서버
유틸
LRMGC
06/29/25 3735 10
구버전 알만툴 게임에 더 나은 전체화면 적용 시키는 유틸리티
유틸
jpjp112
06/22/25 4820 11
[업뎃] base64 자동복호화
유틸
arcjay
06/15/25 16217 29