Skip to content

Instantly share code, notes, and snippets.

@sh-cho
Last active June 3, 2026 02:46
Show Gist options
  • Select an option

  • Save sh-cho/53bc2fc880ebba0d1a6f9b430d010449 to your computer and use it in GitHub Desktop.

Select an option

Save sh-cho/53bc2fc880ebba0d1a6f9b430d010449 to your computer and use it in GitHub Desktop.
Make Laftel comments collapsible. Userscript for Violentmonkey (tamplermonkey, etc.)
// ==UserScript==
// @name Laftel collapsible comments
// @name:ko-KR 라프텔 댓글 접기
// @description Make Laftel comments collapsible
// @description:ko-KR 라프텔 에피소드에서 댓글을 접고 펼칠 수 있게 수정합니다
// @namespace https://laftel.net/
// @match https://laftel.net/*
// @require https://cdn.jsdelivr.net/npm/@violentmonkey/dom@2
// @grant none
// @icon https://static.laftel.net/favicon.ico
// @version 1.2
// @author Seonghyeon Cho
// @updateURL https://gist.github.com/sh-cho/53bc2fc880ebba0d1a6f9b430d010449/raw/laftel-collapsible-comments.user.js
// @downloadURL https://gist.github.com/sh-cho/53bc2fc880ebba0d1a6f9b430d010449/raw/laftel-collapsible-comments.user.js
// @homepageURL https://gist.github.com/sh-cho/53bc2fc880ebba0d1a6f9b430d010449
// @supportURL https://gist.github.com/sh-cho/53bc2fc880ebba0d1a6f9b430d010449
// @license MIT
// ==/UserScript==
'use strict';
// url should be like https://laftel.net/player/12345/12345
const regex = /https:\/\/laftel\.net\/player\/\d+\/\d+/;
/**
* Check whether the node is a comment section.
* The node must have a header and a div with id 'comment-count'.
*
* @param {HTMLElement} node the node to check
* @returns {boolean} true if the node is a comment section, false otherwise
*/
function isCommentSection(node) {
if (!node) return false;
if (!node.querySelector('header')) return false;
if (!node.querySelector('div#comment-count')) return false;
return true;
}
/**
* Make section node collapsible.
*
* @param {HTMLElement} section the section node to wrap
*/
function wrapSection(section) {
// check current url is player
if (!regex.test(location.href)) return;
// prevent multiple wrapping
if (section.dataset.collapsible) return;
section.dataset.collapsible = "true";
// check if the node is a comment section
if (!isCommentSection(section)) return;
const details = document.createElement('details');
const summary = document.createElement('summary');
summary.textContent = '댓글 toggle';
section.parentNode.insertBefore(details, section);
details.appendChild(summary);
details.appendChild(section);
}
VM.observe(document.body, () => {
const node = document.querySelector('section');
if (node) {
wrapSection(node);
// no return
}
});
@ssjun350

ssjun350 commented Jun 1, 2026

Copy link
Copy Markdown

사용자평 관련은 확실히 안누른는게 방법인것 같네요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment