kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2414 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
개추콘
[AI번역]예전에 번역했던거 몇개
번역
솔라셀
05/21 32568 169
Zurikishi-동급생 메이드 시리즈 모음
동인
k8625
05/21 26049 139
Zurikishi-멘헤라 여자애 모음
동인
k8625
05/21 36138 212
동인지 이름 찾습니다...
질문
gomdong2021
05/21 1534 1
그러고보니 관문지기 요즘 어떻게 됐지
일반
ㅇㅇ
05/21 2729 -1
버전업, 자체한글) RJ01604009 너스콜 경비원: Append.1 간호사 증원 패치
번역
딸ㄱ기맛
05/21 29480 154
[복구]penetrating a petite sleeping elf
미번
kimkaral
05/21 5783 11
나도 의술사 불만인 점
일반
lightmax
05/21 3655 0
ai 동인지는 말그대로 찍어내듯이 만들 수 있을텐데
일반
ec2100
05/21 3094 0
순애야겜<<<이게 잘만들면 갓겜인 이유가 있더라
일반
pinanmin
05/21 2536 3
[복구요청] [RJ01167948][보이스코믹/음성][한글화] 반찬당번 마치다짱
요청
삐삐삣
05/21 2897 2
얼터에고이즘 DLC는 무슨 내용임?
질문
paddackmon
05/21 2296 0
[기번/검수][A-10]-백주 백탁 클리 노출 절정(유루캠△)
동인
serdic
05/21 14444 75
kiss사는 보법이 남다르네...
일반
흐긴배긴
05/21 3419 0
(청아, 노모, 컬러)봐줘 봐줘 좀 더
동인
에우리알레
05/21 22852 56
왜 자꾸 eperm이 뜸?
질문
zszsz
05/21 4754 -2
이거ai인가
질문
pudiwey
05/21 2304 -1
의술사 다 좋은데 좀 아쉬운거
일반
bbtt1234
05/21 1963 0
[복구요청] RJ328615 새겨진 쾌감 복구 요청드립니다.
요청
사탕20
05/21 4490 2
풍기위원이란 소재 자체가 치트기인 것 같음
일반
didhd87
05/21 3601 3
[복구요청]소장의 욕망증 시리즈
요청
dfgtewkwg
05/21 1880 5
학원생활노출 이모저모
후기 및 공략
ENE
05/21 5070 4
Church of Desires 손번역판 1.3 버전 업 완료
작업현황
sesv3030
05/21 4386 7
[한글자막] 버큠 프리큐어 SPECIAL MOVIE Vol.003 ~큐어 비트와의 만남~
영상
실루엣21
05/21 27876 177
28일 출시 예정 "레벨 99 치트 용사인 내가 서큐버스 따위에게 질 리가 없어"
정보
lovesccubus
05/21 4405 3
언홀메 seed of profanity 적용 시킬 때, 한패 적용도 안 된 순정파일에 해야 하는 거임?
질문
buysomething
05/21 2938 0
fantia는 좆같은 결제를 속박으로 규제가 덜한게 아니었나
일반
nokchabap
05/21 2403 0
이젠 안하겠지 지우지 말기
일반
gaemi01ba
05/21 2453 1
시간순삭게임 업나용?
질문
p2ppl
05/21 2236 1
벌써 5월말이네...
일반
Salmon103918
05/21 4203 1