kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2187 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
Kiosk 암호 자동 입력기 2.0
유틸
oroshinashi9
03/26 5195 32
[의상 파일 공유][비밀 노출 -배덕의 달콤함에 물든 마나카-] 데빌
유틸
akuma
03/26 11858 19
[요청복구] Prison Hero 감옥용사 조이플 구동패치
유틸
감비아
03/22 2784 3
Tsukuru Extractor에서 추출한 .txt 파일 재미나이2.5 flash로 번역하는 파이썬 코드
유틸
lovesccubus
03/21 2789 3
mp3,wav 여러 파일 한개로 병합해주는 프로그램 만듬
유틸
noname
03/21 11453 20
fapcraft (제니모드) v1.1
유틸
monolithliza
03/20 10185 48
하츠네 미쿠 (코이카츠) 프리셋 공유 v2
유틸
pst0025
03/19 19893 36
키오스크 비번 자동입력기(업그레이드)
유틸
oroshinashi9
03/19 5981 13
(코이카츠) 셀레스포니아 캐릭터 공유 (우리가 아는 그 게임 맞음)
유틸
pst0025
03/18 19730 38
(코이카츠) Vrchat 캐릭터 공유
유틸
pst0025
03/17 10621 42
트랜스크랩 1.0.5 패치에서 오류나는 사람들은 이거 다운받으셈.
유틸
liberty
03/17 13661 25
악!! 저는 파일 올릴 때 최신화 체크도 안하는 병신입니다!!
유틸
pst0025
03/16 6732 28
블아 캐릭터 공유 빠진거 3개
유틸
pst0025
03/16 10340 38
(코이카츠) 벽람 캐릭터 공유 [이것도 많다....]
유틸
pst0025
03/16 11678 43
(코이카츠) 블아 캐릭터 공유 [아무튼 ㅈㄴ 많음]
유틸
pst0025
03/16 12946 75
(코이카츠) 명조 캐릭터 공유
유틸
pst0025
03/16 19463 54
(코이카츠) '데어라' 프리셋 공유
유틸
pst0025
03/16 9209 45
던전 앤 브라이드 치트모드 1.56업데이트 + 번역모드 대응버전 출시 *04/04 18:31 수정
유틸
rengester
03/13 17542 37
아이폰) 아이폰 렌파이 자동 번역기 1티어 나옴
유틸
quilqiil132
03/12 4746 6
유니티 플러그인 만들어옴(받침유무에 따른 조사 수정)
유틸
neighborsbear
03/11 5567 14
아이폰 필독)아이폰용 무료 렌파이 자동 번역기앱 나옴
유틸
quilqiil132
03/10 5446 5
JSON AI 번역기 (마나카 커스텀미션 및 etc..)
유틸
bunta_expert
03/10 6538 20
MV 백로그 플러그인) Lunatlazur_BackLog.js
유틸
ㅇㅇ
03/09 7360 5
아리아 서큐즘 노모 텍스쳐 대체 방식
유틸
paleblood
03/09 6806 13
[노모패치] 324709 노엘 간바리마스! v.1.2.2
유틸
dd
03/07 12920 33
Darkest Dungeon NSFW 십덕 스킨모드
유틸
hibeast
03/07 13655 14
▼ 素材(Materials) ## VX Ace to MV Converter.rb
유틸
ㅇㅇ
03/06 10203 4
야식메뉴판 Plus 업뎃 안내 - 1.2.1
유틸
qqoro
03/06 16350 38
여동생 생활 판타지 DLC 2.0.1 치트에디터(파이썬)
유틸
jghkk9
03/05 5146 7
코이카츠 프리셋 공유
유틸
wonder11
03/04 9791 34