kone
소미소프트

소미소프트

미리보기 관련 유저스크립트

07/28/2025, 04:59:26
유틸
2513 views · 3 likes

미리보기 사진 위치나 크기 조정이 필요하다 생각해서 만듬 필요한 사람 쓰셈

+25/07/28 19:53분 수정 게시글 클릭시 미리보기 이미지 남아있는 문제 해결

// ==UserScript==
// @name         코네 미리보기 조정
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  kone.gg 미리보기 복제 방식으로 위치와 크기 자유 조정 + 게시글 밖 잘림 방지 + 원본 숨김 처리 포함 + SPA 대응
// @author       cloud67p
// @match        https://kone.gg/*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function () {
  'use strict';
  
  let activePreview = null;
  let hiddenOriginal = null;
  let currentUrl = window.location.href;

  // 미리보기 정리 함수
  function cleanupPreview() {
    if (activePreview) {
      activePreview.remove();
      activePreview = null;
    }
    if (hiddenOriginal) {
      hiddenOriginal.style.display = '';
      hiddenOriginal = null;
    }
  }

  // URL 변경 감지 (SPA 대응)
  function detectUrlChange() {
    const newUrl = window.location.href;
    if (newUrl !== currentUrl) {
      currentUrl = newUrl;
      cleanupPreview();
    }
  }

  // URL 변경 감지를 위한 이벤트 리스너들
  window.addEventListener('popstate', cleanupPreview);
  
  // pushState, replaceState 감지 (SPA 라우팅)
  const originalPushState = history.pushState;
  const originalReplaceState = history.replaceState;
  
  history.pushState = function() {
    originalPushState.apply(history, arguments);
    cleanupPreview();
  };
  
  history.replaceState = function() {
    originalReplaceState.apply(history, arguments);
    cleanupPreview();
  };

  // 주기적으로 URL 변경 체크 (추가 안전장치)
  setInterval(detectUrlChange, 100);

  // 클릭 이벤트 감지 (게시글 링크 클릭 등)
  document.addEventListener('click', (e) => {
    // 링크나 버튼 클릭 시 미리보기 정리
    if (e.target.closest('a') || e.target.closest('button') || e.target.closest('[role="button"]')) {
      cleanupPreview();
    }
  }, true);

  // 키보드 이벤트 감지 (ESC 키 등)
  document.addEventListener('keydown', (e) => {
    if (e.key === 'Escape') {
      cleanupPreview();
    }
  });

  // 기존 마우스오버 이벤트
  document.addEventListener('mouseover', (e) => {
    const postWrapper = e.target.closest('.group\\/post-wrapper');
    if (!postWrapper) return;
    
    const preview = postWrapper.querySelector('.group-hover\\/post-wrapper\\:block');
    if (!preview) return;
    
    // 기존 미리보기 정리
    cleanupPreview();
    
    // 원본 숨김
    preview.style.display = 'none';
    hiddenOriginal = preview;
    
    // 복제본 생성
    const clone = preview.cloneNode(true);
    const rect = postWrapper.getBoundingClientRect();
    
    clone.style.position = 'fixed';
    clone.style.left = '40rem';
    clone.style.top = `${rect.top - 200}px`;
    clone.style.zIndex = '9999';
    clone.style.pointerEvents = 'none';
    clone.style.display = 'block';
    
    const img = clone.querySelector('img');
    if (img) {
      img.className = '';
      img.style.width = 'auto';
      img.style.height = 'auto';
      img.style.maxWidth = '720px';
      img.style.maxHeight = '720px';
      img.style.objectFit = 'contain';
      img.style.display = 'block';
    }
    
    document.body.appendChild(clone);
    activePreview = clone;
  });

  // 기존 마우스아웃 이벤트
  document.addEventListener('mouseout', (e) => {
    const postWrapper = e.target.closest('.group\\/post-wrapper');
    const related = e.relatedTarget?.closest?.('.group\\/post-wrapper');
    
    if (postWrapper && related !== postWrapper) {
      cleanupPreview();
    }
  });

  // 페이지 언로드 시 정리
  window.addEventListener('beforeunload', cleanupPreview);
  
  // 페이지 숨김 시 정리 (탭 전환 등)
  document.addEventListener('visibilitychange', () => {
    if (document.hidden) {
      cleanupPreview();
    }
  });

})();
3
1 comment
07/28/25 Edited 07/28/25
1. 미리보기가 게시글 제목을 가림 -> 위치를 더 오른쪽으로 보냄 2. 미리보기 더 크게 보고싶은데 단순히 크기 조정시 -> 게시글 박스를 넘어가면 짤림 -> 새로 복제함 3. 크기 더 크게 만드니 맨 아래 게시글의 미리보기는 하단부가 짤림 -> 미리보기들을 전부 위로 좀 더 올림 4.(수정추가) 미리보기 이미지 게시글 이동시에도 남아있는 오류 수정
(청아)your mom 용 vrm 파일 2개
유틸
hamellton1144
01/08 11207 24
동급생2 리메이크 *DL Version* v1.0.2.0 크랙
유틸
핏짜허엇
01/07 11236 30
starmaker(스타메이커) 갤러리 모드
유틸
horseking94
01/04 35711 53
(01.07수정됨)슬레이 더 스파이어 (Slay the Spire) R18 모드 - Echidna (Ai 번역 + 손번역)
유틸
고기사장님
01/04 20678 60
언홀리 메이든 폭탄 증가패치
유틸
yuri88
01/04 14296 18
멀웨어 검사 스크립트 - 편집증 모드 추가 (DLL 전수조사)
유틸
moomin
01/03 8124 23
🔞 슬레이 더 스파이어 NSFW 모드 모음집 + 디펙트 리플레이서
유틸
Rasmodia
01/03 24916 56
⚠️⚠️멀웨어 탐지 스크립트⚠️⚠️ - 260104 수정
유틸
moomin
01/03 33266 128
카린즈 프리즌 개인모드공유
유틸
보바도사
12/31/25 18912 12
타락신관 조이플 언어설정+이미지 오류 해결파일
유틸
kimchi1234
12/31/25 10363 2
우리아이 판타지아 cGFzc2ZpbGU=
유틸
askted
12/30/25 4257 6
하급생리메이크 1.0.1패치+크랙
유틸
쿠로
12/28/25 15010 41
모카 러브 ReLive♪ ~진심 순애 거리에서의 절정 표정 관찰 + 귀여운 미소에 폭발 분사 애니메이션~ 노모파일
유틸
미스터장
12/27/25 19632 80
Anaertailin 작가의 Slay the Spire 일부 모드만
유틸
oobd69
12/26/25 16986 15
[후타]pernio의 후타나리 시리즈 노모패치 모음 + 복구 제한 안 두기로 했음
유틸
레가토
12/24/25 9857 20
darkest dungeon 성전사(crusader) 스킨
유틸
ine158cm
12/24/25 4639 11
음혈조복토에하 천박한 한글 데칼 공유
유틸
kkkkcccc
12/23/25 14084 46
언홀리 메이든 스탠딩 일러 노예 마스크 수정해 봄
유틸
5dk2io1
12/23/25 14695 30
[유틸] RJ01497368 라스트 스탠드 기번세트
유틸
Ghost
12/21/25 15748 34
용사 파티 무너뜨리기(Hero Party Must Fall) 0.6 회상방 개선 모드
유틸
이드씬
12/21/25 14514 31
시니시스타2 모드 노모 덮어쓰기 툴
유틸
sims9876
12/20/25 14175 15
통합노모모드 시니시스타2 (SiNiSistar2) 1.2.1 마지막... (25.12.24)
유틸
크로우
12/20/25 44305 131
[요청복구] 감옥용사 조이플 구동 패치
유틸
감비아
12/20/25 5013 9
ai로 만든 히토미 다운로더 kemono
유틸
skybleu
12/19/25 8813 9
신문고 인증) Brotli 텍스트 압축 및 해제 도구 사이트 소개
유틸
ㅇㅇ
12/17/25 4833 1
슬레이 더 스파이어 (Slay The Spire) R18 패치 복구 + 2 모드
유틸
cirial
12/15/25 28284 42
[유틸] RJ01389782 비밀 노출 -배덕의 달콤함에 물든 마나카 커스텀 미션 번역
유틸
kdhehejd
12/14/25 18658 25
촉수로 세뇌 1.00 CG버그 수정파일
유틸
Bulchevik
12/14/25 5346 13
윈도우 폴더 검색용 bat 파일
유틸
asdawv123
12/13/25 4371 -6
후타)[복구]잠꾸러기 후타나리의 착정던전 구출기 노모패치
유틸
레가토
12/03/25 5585 5