kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2239 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
개추콘
부계에 잠든 왕녀의 아바돈 할 사람 이거 보고 가!
일반
이상성애
05/18 3111 6
던브 무르무르전 존나어렵네
일반
nagisa8262
05/18 2951 1
세레스피아 원래 이런 느낌인가
후기 및 공략
삣삐세여
05/18 7072 1
직번) [Yamamoto Zenzen] 학원원교일기 Comix 2화
동인
qlalfsla
05/18 23176 91
[구매보급]철벽인 성녀와 육식음마 두 사람 사이좋게 섹스승부 ~누구를 신부로 맞이할 거야?~
소리
이름뭐하지
05/18 10086 73
비월선행록 처음부터 어떻게 하는거임?
질문
alsjdiwjw3
05/18 2663 0
서양쪽은 뷰어 쓸만한게 없나
질문
jiska0
05/18 2539 0
꽐라거유녀 엄마로 만들기
야짤
superkiller123
05/18 6629 8
[손번역][초반번역]RJ01526327 어서오세요! 어린이 만들기 온천 마을 1.01
번역
sjdwj
05/18 45627 251
AI,청아)그록 살아있던 시절 뽑은 영상들
영상
ㅇㅇ
05/18 26566 60
근친 망가 질문
질문
dascoreal
05/18 5217 0
AI) 눈팅하다 찾은 작가꺼 올려봄....
영상
교배아저씨
05/18 15102 80
시니시스타2 dl판 r18패치 해야함?
질문
higher365
05/18 1806 0
Yes I Am Furry 버전
미번
britz69
05/18 4196 7
근친망가인데 대사는 기억나는데 좀 도와주세여
질문
pripara1005
05/18 3310 0
원치않은 성희롱 스택 슈발
일반
메론맛바밤바
05/18 8155 0
[복구요청] 아리사 그리모어 アリサグリモア
요청
bbbbbuuuu
05/18 4560 4
알미오시온의 의술사 후기
후기 및 공략
드라군
05/18 5385 6
에테르게이저 지금 시작
야짤
정실은스쿨드
05/18 7010 5
의술사 성화탑 퍼즐 어케 뚫어야함?
질문
ballongdoor555
05/18 3621 1
양쪽 귀에 "싸라", "싸지 마" 하는 동음이 있었는데
질문
hukug
05/18 1960 0
염월선행록 지금 드가도 됨?
질문
렐루
05/18 3055 -1
AI 작품관련 업로드
질문
simoene2
05/18 2085 1
어지럽네... 이게 양지 작품이라니
일반
seiya
05/18 4211 5
[복구요청]RJ01360136 엘프소녀 리피아와 몽환의 미궁 ver1.06 노모패치
요청
kekera133
05/18 3548 0
TU1EdHlwZTg3 모음집 업데이트 알림
영상
hannanas
05/18 11432 32
[요청없는 복구] 이것저것 잡탕 모음집
복구
yeondooooo
05/18 67768 336
스포) 근데 의술사 주인공이 너무 불쌍하네
후기 및 공략
ㅇㅇ
05/18 6247 2
익 x 자동 다운로더 드디어 만들었다
일반
stricken5448
05/18 3955 4
의술사 구시가지 대성당 이후로는 무한맵임?
질문
simya1557
05/18 2264 0