개념글/전체글 버튼 분리 스크립트(수정)
스크립트 지식 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
딸기맛농축함유🍓
05/27/25 아 근데 지금 해보니까 게시판에 들어와서 새로고침을 한번 해줘야 버튼이 바뀝니다;; 참고해주세용
딸기맛농축함유🍓
05/27/25 ㄴ수정했습니다 혹시 처음에 받으신 분 있으시면 다시 써주세용
공지
AI 이미지 관련 공지 및 관련 규정 수정 공지
1uF
05/02
63968
22
AI 이미지 관련 공지 및 관련 규정 수정 공지
공지
1uF
05/02 63968 22
공지
‼️뉴비 필독 가이드‼️
1uF
05/02
94377
134
‼️뉴비 필독 가이드‼️
공지
1uF
05/02 94377 134
공지
🔔[필독] 채널 규정 & 신문고 (2026 04 05~)
SK
04/05
207772
-25
🔔[필독] 채널 규정 & 신문고 (2026 04 05~)
공지
SK
04/05 207772 -25
공지
🔔[필독] 탭 별 이용 가이드 (20260206~)
Etrick
02/05
256341
-41
🔔[필독] 탭 별 이용 가이드 (20260206~)
공지
Etrick
02/05 256341 -41
공지
[필독] 서브에 자주 올라오는 여러 가지 질문 모음 (20251026~)
SK
05/17/25
1244788
-14
[필독] 서브에 자주 올라오는 여러 가지 질문 모음 (20251026~)
공지
SK
05/17/25 1244788 -14
유틸
[업뎃] 자동 복호화/DL미리보기/자동국룰/자동다운 통합 스크립트 Auto 소미
김머시기
05/24/25
17581
44
[업뎃] 자동 복호화/DL미리보기/자동국룰/자동다운 통합 스크립트 Auto 소미
유틸
김머시기
05/24/25 17581 44
유틸
다키스트 던전 Lustiest Lair 1.6 메가-커스텀 팩
파에톤1호팬
05/24/25
10485
15
다키스트 던전 Lustiest Lair 1.6 메가-커스텀 팩
유틸
파에톤1호팬
05/24/25 10485 15
유틸
base64 자동복호화 (자동/수동모드 전환 가능)
arcjay
05/24/25
18906
79
base64 자동복호화 (자동/수동모드 전환 가능)
유틸
arcjay
05/24/25 18906 79
유틸
루나트랜스 ai번역 프롬프트 (탈옥+번역개선)_06.10업뎃
GOLAL
05/23/25
10086
16
루나트랜스 ai번역 프롬프트 (탈옥+번역개선)_06.10업뎃
유틸
GOLAL
05/23/25 10086 16
유틸
업데이트!) Base64 변환기 2.0 [확장 프로그램]
꼬께
05/23/25
9086
42
업데이트!) Base64 변환기 2.0 [확장 프로그램]
유틸
꼬께
05/23/25 9086 42
유틸
자동 국룰입력/복호화/다운로드 확장프로그램 스크립_귀인 분 코드 긴급 패치_이거 말고 원본 쓰쎔
noname911
05/22/25
13061
16
자동 국룰입력/복호화/다운로드 확장프로그램 스크립_귀인 분 코드 긴급 패치_이거 말고 원본 쓰쎔
유틸
noname911
05/22/25 13061 16
유틸
kone 이미지 일괄 다운로드
글쓴이
05/21/25
17689
37
kone 이미지 일괄 다운로드
유틸
글쓴이
05/21/25 17689 37
유틸
썸네일 미리보기 다크모드, 댓글창 개선 스크립트
김머시기
05/18/25
16299
32
썸네일 미리보기 다크모드, 댓글창 개선 스크립트
유틸
김머시기
05/18/25 16299 32
유틸
자동 국룰입력/복호화/다운로드 확장프로그램 스크립트
김머시기
05/18/25
61750
174
자동 국룰입력/복호화/다운로드 확장프로그램 스크립트
유틸
김머시기
05/18/25 61750 174
유틸
[유틸/수정1] 히토미 다운로더 스크립트 with 코네
kts
05/17/25
13222
30
[유틸/수정1] 히토미 다운로더 스크립트 with 코네
유틸
kts
05/17/25 13222 30
s/somisoft
• 143,985 subscribers여러가지 다루는 서브
Created 05/17/2025, 14:58:43