kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2177 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
[업뎃] base64 자동복호화. 글제목(작가 이름)도 지원. CJK문자 지원
유틸
arcjay
05/29/25 5957 14
update0529_ DL + STEAM (태그|평점|이미지) 미리보기 크롬 확장.
유틸
ddegul
05/29/25 4197 11
개념글/전체글 버튼 분리 스크립트(수정)
유틸
딸기맛농축함유🍓
05/27/25 2800 3
전체글 버튼을 만들어주세요
유틸
글쓴이
05/27/25 3225 6
[업뎃] Auto 소미 XSS보안 업데이트
유틸
김머시기
05/27/25 11283 52
후타)후타나리들과 뷰릇뷰릇 착정던전 노모패치
유틸
레가토
05/26/25 5501 5
코네 미리보기 / 갤러리 뷰
유틸
mowajelly
05/25/25 8379 23
[업뎃] 자동 복호화/DL미리보기/자동국룰/자동다운 통합 스크립트 Auto 소미
유틸
김머시기
05/24/25 17472 44
20250527update_ STEAM, DL 이미지+태그(tag) 미리보기 크롬확장
유틸
ddegul
05/24/25 4013 9
Starbound 통팩 V0.2 (Sexbound, 스타바운드)
유틸
파에톤1호팬
05/24/25 5618 12
다키스트 던전 Lustiest Lair 1.6 메가-커스텀 팩
유틸
파에톤1호팬
05/24/25 10359 15
base64 자동복호화 (자동/수동모드 전환 가능)
유틸
arcjay
05/24/25 18871 79
Lossless Scaling 오리 꿱꿱
유틸
otona
05/24/25 4142 9
루나트랜스 ai번역 프롬프트 (탈옥+번역개선)_06.10업뎃
유틸
GOLAL
05/23/25 10052 16
링크 프리뷰 내맘대로 업데이트
유틸
cloud67p
05/23/25 2526 3
업데이트!) Base64 변환기 2.0 [확장 프로그램]
유틸
꼬께
05/23/25 8957 42
Base64 변환기 [확장 프로그램]
유틸
꼬께
05/23/25 6253 4
자동 국룰입력/복호화/다운로드 확장프로그램 스크립_귀인 분 코드 긴급 패치_이거 말고 원본 쓰쎔
유틸
noname911
05/22/25 12947 16
kone 이미지 일괄 다운로드
유틸
글쓴이
05/21/25 17490 37
이미지 뷰어(좀 더 편하게 볼 수 있는 그거) - 유기
유틸
noname911
05/20/25 7102 13
후타)착정생물에게 절대 패배하지 않는 거근거유 후타나리 메스가키 노모패치 v2
유틸
레가토
05/20/25 9057 14
ExFa viewer
유틸
글쓴이
05/19/25 4663 7
단축키 -펑-
유틸
유령
05/19/25 3910 11
썸네일 미리보기 다크모드, 댓글창 개선 스크립트
유틸
김머시기
05/18/25 16280 32
자동 국룰입력/복호화/다운로드 확장프로그램 스크립트
유틸
김머시기
05/18/25 61732 174
[유틸/수정1] 히토미 다운로더 스크립트 with 코네
유틸
kts
05/17/25 12994 30