kone
소미소프트

소미소프트

개념글/전체글 버튼 분리 스크립트(수정)

05/27/2025, 09:41:09
유틸
3008 views · 3 likes

스크립트 지식 1도없이 챗지피티로 만들었습니다~ 문제시 글삭함

오류 생기면 스크립트 삭제 추천드려요



1

원래 이렇게 붙어있던 개념글/전체글 버튼을



1

이렇게 분리했습니다. 왼쪽은 전체글 모드, 오른쪽은 개념글 모드


그리고 중요한건 전체글일때 전체글 버튼 누르면 전체글 새로고침됨

마찬가지로 개념글일때 개념글 버튼 누르면 개념글 새로고침됨

새로고침 할려고 버튼 나눈거임


하 근데 최신순(시계모양) 버튼이 버튼 오른쪽에서 왼쪽으로 가버림.. 이건 못고치겟서


1

게시판 하단에 있던 버튼도 바뀝니다


1
1

확장프로그램 템퍼몽키 설치하시고 새 스크립트 만들기 > 안에 내용 지우고 스크립트 복붙 > 저장




아래는 스크립트 코드

// ==UserScript==
// @name         kone.gg 개념글/전체글 버튼 삽입(수정판)
// @namespace    http://tampermonkey.net/
// @version      2.4
// @description  게시판 개념글/전체글 버튼 삽입 수정
// @match        https://kone.gg/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    let lastUrl = location.href;

    const createButton = (text, onClick, isActive) => {
        const button = document.createElement('button');
        button.textContent = text;
        button.style.cssText = `
            margin-right: 8px;
            padding: 6px 12px;
            border: none;
            border-radius: 9999px;
            font-size: 14px;
            cursor: pointer;
            background-color: ${isActive ? '#dc2626' : '#e4e4e7'};
            color: ${isActive ? 'white' : '#27272a'};
        `;
        button.addEventListener('click', onClick);
        return button;
    };

    const insertButtons = () => {
        const url = location.href;
        const isHot = url.includes('mode=hot');
        const basePath = location.pathname;

        const boardWrapper = document.querySelector('div.grow.flex.flex-col.rounded-b-lg');
        if (!boardWrapper) return;

        const buttonRows = boardWrapper.querySelectorAll('div.flex.items-center.gap-2');
        if (!buttonRows.length) return;

        buttonRows.forEach((targetRow) => {
            if (targetRow.querySelector('a[href*="write"]')) return;
            if (targetRow.querySelector('#custom-btn-hot') || targetRow.querySelector('#custom-btn-all')) return;

            // 기존 개념글/전체글 a 링크 삭제
            targetRow.querySelectorAll('a[href]').forEach(link => {
                const href = link.getAttribute('href');
                if (href.includes('mode=hot') || href === basePath) {
                    link.remove();
                }
            });

            const hotBtn = createButton('개념글', () => {
                window.location.href = basePath + '?mode=hot';
            }, isHot);
            hotBtn.id = 'custom-btn-hot';

            const allBtn = createButton('전체글', () => {
                window.location.href = basePath;
            }, !isHot);
            allBtn.id = 'custom-btn-all';

            targetRow.appendChild(allBtn);
            targetRow.appendChild(hotBtn);
        });
    };

    // 버튼 삽입 및 재삽입 시도
    const tryInsertButtons = () => {
        insertButtons();
    };

    // history API 훅 감싸기
    const hookHistoryMethod = (method) => {
        const original = history[method];
        return function () {
            const result = original.apply(this, arguments);
            window.dispatchEvent(new Event('locationchange'));
            return result;
        };
    };
    history.pushState = hookHistoryMethod('pushState');
    history.replaceState = hookHistoryMethod('replaceState');

    window.addEventListener('popstate', () => window.dispatchEvent(new Event('locationchange')));
    window.addEventListener('locationchange', () => {
        if (lastUrl !== location.href) {
            lastUrl = location.href;
            tryInsertButtons();
        }
    });

    // DOM 변경 감지해서도 버튼 갱신 (최상위 body 감시)
    const observer = new MutationObserver(() => {
        tryInsertButtons();
    });
    observer.observe(document.body, { childList: true, subtree: true });

    // 최초 실행 딜레이 줘서 기다렸다 삽입
    setTimeout(() => {
        tryInsertButtons();
    }, 1000);

})();
3
2 comments
아 근데 지금 해보니까 게시판에 들어와서 새로고침을 한번 해줘야 버튼이 바뀝니다;; 참고해주세용
ㄴ수정했습니다 혹시 처음에 받으신 분 있으시면 다시 써주세용
RPG MV 치트 플러그인 개조 버전 v2.1
유틸
4HHHH
07/19/25 21820 30
[노모이미지파일만] 카바씨네의 즐거운 투병 생활UC
유틸
미스터장
07/17/25 9045 23
goodbyedpi
유틸
unkown453645
07/15/25 6197 23
로케일 에뮬
유틸
unkown453645
07/15/25 4893 15
드래곤 콩키스타 스탠딩 일러스트 가슴 흔들림 모드 번역
유틸
미스터장
07/11/25 11448 49
다키스트 세일 기념 NSFW 스킨/모드
유틸
삐뉴
07/11/25 8262 27
한여름의 절정 캐릭터 공유2
유틸
mola245
07/10/25 11314 30
한여름의 절정 공홈에서 퍼온 캐릭터카드
유틸
ㅇㅇ
07/05/25 7934 15
[2026-01-11] 히토미 다운로더 코네용
유틸
kts
07/03/25 22635 66
Sexbound(스타바운드)통팩 V0.2 ,Lustiest Lair 1.6 메가-커스텀 팩(2025.09.30까지)
유틸
파에톤1호팬
07/02/25 15272 24
[업뎃] base64 자동 복호화 1.4.15
유틸
arcjay
07/01/25 18708 35
[복구]+@ 시니시스타 2 모드 모음(1.07)
유틸
sims9876
06/29/25 38316 39
[업뎃] base64 자동복호화
유틸
arcjay
06/15/25 16463 29
[유틸] [노모] 비밀 노출 -배덕의 달콤함에 물든 마나카- 노모패치 v1.0.0.6
유틸
Ghost
06/15/25 14290 15
업뎃) 스텔라블레이드 릴리 누드모드
유틸
konekat
06/14/25 18520 65
[업뎃알림] 오토소미
유틸
김머시기
06/12/25 11059 34
야식메뉴판 업뎃해옴 - 2.0.0
유틸
qqoro
06/12/25 13804 70
RPGMVP 파일을 포토샵으로 열고 수정하고 저장하장!!!!!!!!!!!!!!!!
유틸
moomin
06/12/25 5041 17
코네 유저 메모 및 차단 스크립트
유틸
글쓴이
06/11/25 6477 17
[노모패치] 졸린 유대감 ver.1.2.1
유틸
77777
06/10/25 10325 29
시니시스타 2 모드 모음
유틸
sims9876
06/09/25 12528 33
시니시스타2 알몸폭유모드
유틸
ㅇㅇ
06/08/25 13529 37
히토미 다운로더용 kone 이미지 일괄 다운로드 스크립트
유틸
글쓴이
06/08/25 7710 31
메스가키 새여동생♡낮져밤져 유혹섹활 AI노모
유틸
물크스
06/08/25 10011 77
(긴급!)유니티 제미니 AI 자동번역 딜레이 대폭수정및 검열회피(반드시 새로 받아야함)
유틸
알탕
06/05/25 15421 33
유니티 (AutoTranslator) 제미니 AI번역기 무료 API 다중추가 삽입및 번역 재시도 기능 추가
유틸
알탕
06/04/25 9373 23
[업뎃] Auto Somi 자동 국룰입력/복호화/다운로드/미리보기 등
유틸
김머시기
06/04/25 15143 53
(수정) 유니티 자동번역기(autotranslator) 제미니 ai (Gemini) 번역하기 풀세트
유틸
알탕
06/02/25 38576 87
[업뎃] Auto 소미 XSS보안 업데이트
유틸
김머시기
05/27/25 11445 52
코네 미리보기 / 갤러리 뷰
유틸
mowajelly
05/25/25 8619 23