https://kone.gg/s/somisoft/b3Kid-M_YjOKD_kofh5zyb
여기 이분 스크립트에서 챗지피티로 댓글 확장 코드만 추출 후 개선한 스크립트입니다. 문제시 글삭함
원본 작성자가 삭제 요청시 글내림(허락받음ㅎ). 오류 생기면 스크립트 삭제 추천
원본 댓글 확장은 대댓 확장만 자동이고 댓글 더 불러오기는 자동이 아니라서 추가했습니다.
템퍼몽키 확장프로그램 받으시고 새 스크립트 만들기 > 안에 내용 지우고 스크립트 복붙 > 파일 저장
아래는 스크립트입니다.
// ==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);
}
})();
