kone
소미소프트

소미소프트

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

07/28/2025, 04:59:26
유틸
2510 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.(수정추가) 미리보기 이미지 게시글 이동시에도 남아있는 오류 수정
조이플 오류 및 패치 + 유틸
유틸
yeppi
03/04 12102 34
야식메뉴판 Plus 만들어왔음 - 게임 방주 관리 데스크톱 앱
유틸
qqoro
03/04 15311 77
이터넘 0.9 옛날 버전 브금 모드
유틸
외않되
03/04 4093 5
RJ01389782 비밀 노출 마나카 커스텀 미션 번역2
유틸
ㅇㅇ
03/03 14520 18
렌파이 전용 언락커 ( 갤러리 언락가능 )
유틸
하이바라
03/03 5266 12
ai번역)RJ01389782 비밀 노출 마나카 모드와 미션 여러 가지
유틸
kkkktrrr
03/02 16664 45
지난번에 만든 (케모노,히토미,X,유튜브 등등 downloader gallery-dl, yt-dlp 활용) 다운로더 GUI 버전으로 만들어봄
유틸
noname
03/01 16237 56
하츠네 미쿠 (코이카츠) 프리셋 공유
유틸
pst0025
02/28 13999 32
유니티 클뜯 assetstudio 후속 animestudio
유틸
xcandle
02/28 8997 19
Sizer.7z
유틸
ㅇㅇ
02/27 8432 13
RJ01279319 네토라레 히로인 백설 1.1 백로그등 편의성 개조 파일(패치파일만)
유틸
apelzl011
02/25 7022 13
Digital Contents Library Tool 1.1.7.2 (구 DLsite 퀵 뷰어)
유틸
ll-lllllllll
02/24 92591 70
시니시스타2 1.2.1 폭유 모드
유틸
무슨소리니
02/24 19338 39
어떤 여자 상사의 비밀 마사지 가게 ver.1.0.6 DRM 해제 실행파일
유틸
미스터장
02/23 10261 11
감금된 채 딥키스 여성주도~페라 포함~ 노모패치만
유틸
미스터장
02/23 7768 6
MZ 엔진 index 치트 유틸
유틸
전적노트
02/22 7674 4
[MySonar] 소수를 위한 오디오 플레이어
유틸
hustlyn
02/22 17147 77
RJ01389782 비밀 노출 마나카 커스텀 미션 번역
유틸
ㅇㅇ
02/21 13360 25
마메32 신버전
유틸
a123456789
02/21 40232 191
RJ 미리보기 서포트 (Tempermonkey 기반)
유틸
sss-com
02/21 8160 14
복호화 밑 품번 링크 생성기 사이트
유틸
vOwOv
02/20 9421 11
nursecall 치트
유틸
nekoplug
02/20 7114 5
26.04.18, 90일, 자동 줄바꿈) RJ01540816 ver.1.0.0 js (2).7z
유틸
ㅇㅇ
02/19 22830 13
RJ01438167 여동생과 함께살자 노모 Bepinex 파일
유틸
joaja
02/18 16219 24
시니시스타2 1.2.1 Slit(가터벨트) 아웃핏 노모 모드
유틸
tongpa
02/18 17840 12
수정 Agent17 0.26.6 cheat mod 버전+ 안티치트,추가치트
유틸
a123456789
02/17 15677 10
GameDB 2
유틸
심심한개발자
02/17 14181 8
Agent17 겨울동화 삽 강화 버그 픽스
유틸
AKGH
02/17 16680 13
[후타]pernio의 후타나리 시리즈 노모패치 모음
유틸
레가토
02/17 12099 12
렌파이 공용 치트엔진+agent17 치트 쓰는 법
유틸
high-hope
02/16 27645 38