kone
소미소프트

소미소프트

유저스크립트 공유(업데이트250531)

05/31/2025, 12:35:43
유틸
4103 views · 2 likes

기능 1: 코네 메인 페이지 설명 펼치기/접기 기능 ( 모바일에 있길래 PC에서도 동작하게 수정)

1
1

기능2: 댓글창 좌클릭 잠금 버튼
댓글창에서 복사하거나 드래그하려고할때 대댓글창으로 자꾸 넘어가서 추천/비추천 우측에 자물쇠 버튼이 개별적으로 적용되어

기본적으로는 클릭시에 대댓글이 열리지않음, 자물쇠를 풀면 좌클릭 한번에 대댓글이 열림

1


// ==UserScript==
// @name         코네 유틸 
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  kone.gg 잠금버튼으로 답글 토글 (켜기/끄기): 기본적으로 댓글 클릭시 답글 안나오도록 & 메인페이지 토글 (접기/펼치기): 기본 접어두기
// @author       cloud67p
// @match        https://kone.gg/*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    /***** [1] 댓글 관련 기능 *****/

    /****댓글 요소(commentEl) 옆에 잠금/해제 버튼을 추가하는 함수****/
    function addToggleButton(commentEl) {
        // 이미 버튼이 붙어 있으면 중복 추가하지 않기
        if (commentEl.querySelector('.reply-toggle-btn')) return;

        const btn = document.createElement('button');
        btn.textContent = '🔒';
        btn.classList.add('reply-toggle-btn');

        // 스타일 조정 (필요에 따라 위치/크기 바꿔도 무방)
        btn.style.marginLeft = '8px';
        btn.style.fontSize = '14px';
        btn.style.cursor = 'pointer';
        btn.style.background = 'transparent';
        btn.style.border = 'none';

        // 클릭 시 data-reply-enabled 토글 및 아이콘 변경
        btn.addEventListener('click', function(e) {
            e.stopPropagation();
            e.preventDefault();

            const enabled = commentEl.dataset.replyEnabled === 'true';
            if (enabled) {
                commentEl.dataset.replyEnabled = 'false';
                btn.textContent = '🔒';
            } else {
                commentEl.dataset.replyEnabled = 'true';
                btn.textContent = '🔓';
            }
        });

        // 댓글 엘리먼트 마지막 자식으로 버튼 붙이기
        commentEl.appendChild(btn);
    }

    function findReplyWrapper(commentEl) {
        const parentContainer = commentEl.closest('div.relative.pl-4.py-1\\.5');
        if (!parentContainer) {
            return null;
        }
        const sibling = parentContainer.nextElementSibling;
        if (!sibling) return null;
        return sibling.querySelector('#comment_write') ? sibling : null;
    }

    /**
     * 특정 댓글(commentEl)을 왼쪽 클릭했을 때,
     * data-reply-enabled="true" 상태가 아니면 원래 동작(대댓글창 열기)을 차단합니다.
     * 다만, 클릭된 요소가 버튼 또는 버튼 내부라면 차단하지 않습니다.
     */
    function disableClick(commentEl) {
        commentEl.addEventListener('click', function(e) {
            // 잠금 상태일 때만 처리
            if (commentEl.dataset.replyEnabled !== 'true') {
                // 클릭된 요소가 button 태그이거나, button의 자손인 경우—버튼 클릭은 허용
                if (e.target.closest('button')) {
                    return;
                }
                // 그 외(예: 댓글 텍스트 또는 빈 공간 클릭)는 차단
                e.stopPropagation();
                e.preventDefault();
            }
        });
    }

    /**
     * 한 댓글(commentEl)에 대해:
     * 1) 왼쪽 클릭 제한 (disableClick)
     * 2) 우클릭(contextmenu) 시 data-reply-enabled 속성을 토글 (true ↔ false)
     * 3) 댓글 옆에 잠금/해제 버튼 추가
     * 4) 대댓글창의 “취소” 버튼을 눌러도 대댓글창이 닫히도록 연결
     */
    function patchComment(commentEl) {
        // 이미 처리된 댓글이면 패스
        if (commentEl.dataset.replyPatched === 'true') {
            return;
        }
        commentEl.dataset.replyPatched = 'true';

        // 1) 왼쪽 클릭 제한
        disableClick(commentEl);

        // 2) 댓글 옆에 잠금/해제 버튼 추가
        addToggleButton(commentEl);

        // 3) 우클릭(contextmenu) 시 토글 로직 (기존에 있던 코드)
        commentEl.addEventListener('contextmenu', function(e) {
            e.preventDefault();
            e.stopPropagation();

            if (commentEl.dataset.replyEnabled === 'true') {
                commentEl.dataset.replyEnabled = 'false';
            } else {
                commentEl.dataset.replyEnabled = 'true';
            }
        });

        // 4) 대댓글창 “취소” 버튼 클릭 시 wrapper 닫기 (기존 코드)
        const wrapper = findReplyWrapper(commentEl);
        if (wrapper) {
            Array.from(wrapper.querySelectorAll('button')).forEach(btn => {
                if (btn.textContent.trim() === '취소') {
                    btn.addEventListener('click', function(ev) {
                        ev.stopPropagation();
                        ev.preventDefault();
                        wrapper.style.display = 'none';
                    });
                }
            });
        }
    }

    /**
     * 페이지 내 모든 댓글을 찾아 patchComment 실행
     */
    function patchAllComments() {
        document.querySelectorAll('.group\\/comment').forEach(patchComment);
    }

    /**
     * 댓글이 동적으로 추가/삭제될 때마다 patchAllComments 재실행
     */
    const observer = new MutationObserver(() => {
        patchAllComments();
    });
    observer.observe(document.body, { childList: true, subtree: true });

    // 초기 실행 (DOMContentLoaded 이후)
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', patchAllComments);
    } else {
        patchAllComments();
    }

    /***** [2] 환영 메시지 토글 복원 기능 *****/

    const esc = cls => cls.replace(/:/g, '\\:');

    function fixToggle() {
        document.querySelectorAll(`.overflow-hidden.max-h-32.${esc('md:max-h-none')}`)
            .forEach(el => el.classList.remove('md:max-h-none'));

        document.querySelectorAll(`button.${esc('md:hidden')}`)
            .forEach(btn => btn.classList.remove('md:hidden'));
    }

    fixToggle();

    const toggleObserver = new MutationObserver(fixToggle);
    toggleObserver.observe(document.documentElement, { childList: true, subtree: true });
})();
2
2 comments
05/31/25 Edited 05/31/25
추천, 수정,삭제도 우클릭 제한이 걸려있는 것을 확인하여 수정했습니다 현재 댓글을 좌클릭해도 답글 기능이 제한되어 페이지 위치조정등이 비활성화 되어있습니다. 각 댓글 영역의 우측상단 좌물쇠 버튼을 클릭하여 원래의 기능( 댓글 클릭 답글 및 페이지 위치조정 )이 활성화됩니다
05/31/25
오 신기하다
[복구] 에이메스 & 린네 (명조) 복구 영상 3개
영상
브레머튼
05/08 20327 79
[AI][패치만] RJ01549336 알미오시온의 의술사 ver 1.044
번역
lovesccubus
05/08 68080 309
[국산 우리 농수간물]수간 커미션 모음집
야짤
412343
05/08 14813 68
ai, 찢) 이블린과 휴일에 데이트 후 잔뜩 연인섹스 했다
야짤
kjh9304
05/08 12971 121
[구매보급] [버전업] RJ01491971 마을의 간판녀가 권력자의 눈에 띄게 되는 이야기 26.05.07
미번
gkqisq
05/08 14270 44
[AI번역-노모 풀컬러] Master Works + Master Piece[수정]
동인
mybest
05/08 39034 163
[AI번역-♥개추♥][Okayusan] ★지금까지 가장 좋았던 섹스★(노모)
동인
mybest
05/08 26813 82
[미번/번역요청]NymPri_Alpha_080h[님포](5월 패치) 적용
미번
우욿
05/07 11070 26
[RJ01042589]사막 왕국과 노예 사냥 V3.1.0 (현재 메인스토리 완료까지 멈춤 수정 )
번역
sawsd
05/07 39479 125
(노모화) [Shiwasu No Okina] '에로♡삐삐' 단행본 완료 [Decensored]
동인
xbox
05/07 15696 85
[나의 히어로 아카데미아](재업) 랙돌x데쿠 + 서비스 신(청소) + 화질 up
영상
Ghost
05/07 22488 159
[RJ01575169/이미지번역/기게번역] 가출 딸, 주웠습니다. (2026.05.07)
번역
candle
05/07 87791 397
[버전업 알림] 이케부쿠로 섹스로이드 학원 v1.3.1
번역
jaaxmaster
05/07 50945 203
[요청복구] 236799 그녀가 노예가 된 이유 - 여도적실피와잠들지않는섬 -
복구
VoTaeBe
05/07 34945 60
[Asani nemuru]부모님이 심취한 노출교에 강제 입교당한 소녀
동인
요요코코
05/07 36809 65
[구매보급]NO라고 말할 수 없는 무방비 JK와 농후한 씨받이 연인 섹스
소리
이름뭐하지
05/07 14905 48
[번역](ahemaru) - 하이엘프 여왕과 공주가 성범죄자를 응징한다. 라는 내용의 만화
동인
핥는맛
05/07 33005 189
[미번/구매보급] 绯月仙行录 비월선행록 간체자 V1.287 버그수정본
미번
흑토끼
05/07 30808 101
[일부90일]요청복구 5게 +최신화 완료+
복구
Ghost
05/07 54925 111
(명조) 히유키
영상
브레머튼
05/07 17178 112
수나 (ZZZ)
영상
브레머튼
05/07 17848 101
RJ01037663) 서큐버스 장군의 병력 증산소
복구
양겜소믈리에
05/07 28785 80
[Liyoosa]불법 카지노에서 정체가 탄로나 조교당하는 여주인공
동인
요요코코
05/07 42573 171
[ai번역] 발기부전 밖에 태어나지 않는 섬에서 유일한 절륜 2
동인
yaoino
05/07 31121 56
[복구] 신데렐라(니케) 복구 영상
영상
브레머튼
05/07 17381 56
[구매 보급] RJ01485652 終末のオルターエゴイズム
미번
salrami5752
05/07 9961 30
[요청복구][게임녹화]리본 아일랜드
영상
komet52
05/07 22825 41
AI, 셀레스포니아) 유리 캡슐 구속 (촉수, 보테배 주의)
야짤
miso5
05/07 18995 86
[AI번역][Tachi Iyashi] Maso Mesu Happy Acme (decensored)
동인
mybest
05/07 27297 92
점장인데도 소악마 알바 전속 자지가 되어버렸습니다. CV. 야나기 히토미
소리
maruran
05/07 7232 55