kone
소미소프트

소미소프트

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

07/28/2025, 04:59:26
유틸
2607 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.(수정추가) 미리보기 이미지 게시글 이동시에도 남아있는 오류 수정
[수정1] 대리업로드 번역게임 14개
번역
미스터장
04/27 97086 388
[AKIRE][컬러/노모] 나만의 응석을 받아주는 거유JK아내를 다른남자에게 안기게 해봤다 3
동인
프로베스트캣
04/27 22088 87
성지식 없어서 무신경하게 섹스해주는거 꼴리는
야짤
superkiller123
04/27 23723 97
[시모바시라 공방] 「마장영희 셀레녹시아」 제작 보고 69 - 서브 이벤트 다듬기!
정보
날개 로봇
04/27 19446 44
[구매보급][청아] 마마루미기획 작품 4개
영상
mantoo12
04/27 37573 96
ai, 이터널 리턴) 수영복 데비와 순애 섹스
야짤
kjh9304
04/27 17425 76
[미번] 내 여자친구가 지배 어플로 NTR 방송되고 있는데
미번
미스터장
04/27 10232 40
[미번] 다락방의 에로 낙원(에덴) ~귀여운 제자에게 첫 암컷 수업~
미번
미스터장
04/27 8958 29
Poriuretan 매칭
동인
uzaki
04/27 17004 56
Poriuretan 노출증 환자
동인
uzaki
04/27 17459 52
Poriuretan 동네누나
동인
uzaki
04/27 17267 31
Poriuretan 등산 캠핑에서 의기투합
동인
uzaki
04/27 10866 30
Poriuretan 너무 오래 기다리게한 소꿉친구
동인
uzaki
04/27 17323 33
Poriuretan 전직 야리사쿠(성인 동아리) 출신 유부녀
동인
uzaki
04/27 17299 42
Poriuretan 넷카페
동인
uzaki
04/27 31206 52
Poriuretan (본인은) 넘어가지 않았다고 생각하는 아이
동인
uzaki
04/27 24377 46
Poriuretan 가출과 무녀
동인
uzaki
04/27 15531 37
Poriuretan 흑백 갸루의 메리 크리스마스
동인
uzaki
04/27 21105 63
(청아) アブジャン 팬박스 26년 영상
영상
교미의요정
04/27 43776 136
내 근육 돌려줘!!
후기 및 공략
키리히토
04/27 11089 30
(ios 사용자 전용) 핸디맨 판타지 ipa
hornyhorse
04/27 28759 27
(이미지 번역 파일만/이미지 통합본) [RJ01414102] おかしな刑務所と淫欲の地下迷宮 (이상한 형무소와 음욕의 지하 미궁)
번역
5dk2io1
04/27 92425 540
생화학적 제한구역 전개방 세이브
세이브
thomastrain
04/27 14697 16
[gemma4][미검수][패치만]서큐버스들의 밤 ~음마간, 혹은 서큐버스와 인큐버스에 대하여~
번역
lovesccubus
04/27 40053 87
[구매보급,번역요청,청아]챔버 게임, 오빠 전용 딜리버리 J◯ plus
미번
12532748912
04/27 24798 31
bHVjaWZpbmEwMDZhMQ== 모음 한달
야짤
raime
04/27 11687 31
[구매보급,번역요청] RJ01613299 음주도시 휴프노즘? (기번이라 제목 맞나 모르겠음...)
미번
gkawkek23
04/27 19756 99
[한글자막] 산타 코스프레 타카기 양과 극혐남의 메모리
영상
실루엣21
04/27 31524 142
콜레다 & 와이즈 (ZZZ)
영상
브레머튼
04/27 17320 79
MZ MV data 복호화 실행기
유틸
미요포
04/27 13714 38