kone
소미소프트

소미소프트

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

05/31/2025, 08:06:09
유틸
2297 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) 오늘의 야짤
야짤
ai0098
05/24 7049 26
우메마로 신작 이제서야 봤는데
일반
헤으응킬러
05/24 2622 0
Ntrpg2 진짜 너무 좋은듯
일반
porsent
05/24 3790 2
이거 어떻게 하는거임?
질문
aemeath
05/24 2585 -6
(해결)게임 파일 압축 관련하여
질문
angugsa
05/24 2667 -1
[후속편] 갱뱅 섹스 중에 최면이 풀려버린 의현 영상 (ZZZ)
영상
브레머튼
05/24 26046 148
[구매보급][번역요청][스캇] RJ098572 H -HARD CORE-
미번
oo
05/24 8798 21
비타퀘 업스케일 원래 이런거임?
질문
koko0o
05/24 2253 2
우씌...결국 카린 모드 번역을 직접하고 있네...
일반
liberty
05/24 1453 0
vp세레나, 마법투희 시리즈 이후로 꼴리는겜을 못찾겠다
일반
kkoguma
05/24 1365 2
마나카 스토리모드
질문
hooyj
05/24 2312 0
(하드) 야겜고수님들 혹시 이런 취향의 야겜도 있나요?
질문
BroadRight
05/24 1864 3
혹시 이거 뭐 눌러야함?
질문
kimrak
05/24 1557 -1
사이클론 신작 야겜정보 갱신 지연
야짤
kjalar
05/24 5549 7
[복구요청] RJ01214867 둘만의 생활_ver1.671
요청
iorvbr
05/24 2198 0
[복구요청]RJ01166543 마법소녀 티어 스위트
요청
henry
05/24 2426 0
쓰읍... 카린 스시 행거 모드만 넣으면 버그나네...
일반
liberty
05/24 1753 -1
판티아 좀 써본 사람
질문
마라맛부리또
05/24 1355 0
직번]doji ro)처녀가 동정과의 첫 체험에서 눈을 뜨는 이야기 4
동인
woo15
05/24 25004 140
카린형무소 해볼려는데
질문
gooddaytodie
05/24 1950 2
말랑한 그림체 게임 많이 나와서 좋네~
일반
ㅇㅇ
05/24 2114 0
야겜 1시간 10분 이내에 딸안치는 게임이면 어떤 게임이든 무조건 지우는데
일반
alumni
05/24 1514 1
복구요청) RJ01089362 네토라레 창녀거리 복구 부탁드려요 ㅜㅜ
요청
ddaljang
05/24 3629 0
[청아 포함] a2FvZ3Vt 모음집 - [402.33MB]
영상
HNO₃
05/24 58216 106
절정개안의 의식 엔딩이 하나밖에없는거같네
일반
drachir
05/24 2470 0
크아악
일반
사과맛오징어
05/24 1881 1
밈으로만 봐왔던 대사를 직접 봤을때의 감동이란
일반
ㅇㅇ
05/24 2463 4
[AI번역][iwao] 카렌 만화(가칭)(カレン漫画(仮)(1~4)
동인
초보역식자
05/24 16300 94
[복구 요청] 카펠레티 -다우너 아가씨와의 화려한 생활-
요청
bymyside
05/24 1503 0
[복구요청] 마검 루세프리드
요청
ㅇㅇ
05/24 1670 0