kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2876 views · 4 likes

챗지피티로 만들었는데 오류 생길수있음 문제시 글삭


1

ㄴ 기존 썸네일 크기


1

ㄴ 스크립트 작동 후 썸네일 크기


1

ㄴ 썸네일 너비 설정 클릭

1

너비 숫자만 쓰고 (뒤에 px는 자동으로 써짐) 확인 누르면


1

높이는 대충 4:3 비율로 계산되고 다시 확인 누르기 >> 새로고침


초기 기본 너비 : 500

초기 기본 높이 : 375


아래는 스크립트입니다


// ==UserScript==
// @name         kone.gg 썸네일 크기 조절 (너비만 입력)
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  kone.gg 미리보기 썸네일 크기를 너비만 입력해 간편하게 조절합니다.
// @match        https://kone.gg/*
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function () {
    'use strict';

    const defaultWidth = '500px';
    const defaultHeight = '375px'; // 초기 기본 높이, 계산용 참고

    const width = GM_getValue('thumbnailWidth', defaultWidth);
    const height = GM_getValue('thumbnailHeight', defaultHeight);

    function normalizeSize(input) {
        if (!input) return null;
        input = input.trim();
        if (/^\d+$/.test(input)) {
            return input + 'px';
        }
        return input; // 이미 단위 포함되어 있는 경우
    }

    function extractPixels(value) {
        const match = /^(\d+)(px)?$/.exec(value.trim());
        return match ? parseInt(match[1], 10) : null;
    }

    function updateThumbnailSize() {
        const newWidthRaw = prompt('썸네일 너비를 입력하세요 (예: 500 또는 100%)', width);
        const newWidth = normalizeSize(newWidthRaw);

        if (!newWidth) return;

        let newHeight;

        // 비율 계산 (숫자일 경우에만 적용)
        const widthNum = extractPixels(newWidth);
        if (widthNum !== null) {
            const heightNum = Math.round(widthNum * 0.75); // 4:3 비율
            newHeight = heightNum + 'px';
        } else {
            newHeight = 'auto'; // 퍼센트나 auto 같은 경우
        }

        GM_setValue('thumbnailWidth', newWidth);
        GM_setValue('thumbnailHeight', newHeight);

        alert(`썸네일 크기 변경:\n너비: ${newWidth}\n높이: ${newHeight}\n\n페이지를 새로고침하면 적용됩니다.`);
    }

    function applyThumbnailStyle(w, h) {
        const style = document.createElement('style');
        style.id = 'custom-thumbnail-style';
        style.textContent = `
            img.max-w-50.max-h-40 {
                max-width: ${w} !important;
                max-height: ${h} !important;
            }
        `;
        document.head.appendChild(style);
    }

    GM_registerMenuCommand('썸네일 너비 설정 (높이는 자동 계산)', updateThumbnailSize);
    applyThumbnailStyle(width, height);
})();
4
2 comments
Sign in to comment
06/01/25
너비아니
06/15/25
참 좋은데 맨 아래쪽 게시글 한두개는 100%기준 아래가 짤리네요
Sign in to comment
PrincessElicia 오류
피드백
솔라셀
05/26 1796 2
오늘부터 금딸목표
일반
oimasage
05/26 2247 0
신작은 확실히 나오고 따끈따끈할 때 해야돼
일반
kalbin
05/26 2312 0
시니시스타2 하는데.... z키 x키 이거 나만 불편해? 변경 하는법 있음?..
질문
sinbiru
05/26 1645 0
파라다이스 서큐버스 드디어 다 깼다
일반
latham
05/26 1678 1
프로넌트 심포니 질문
질문
assa3223
05/26 1229 1
규정위반일지도 모르지만 규정위반이면 지우겠긔
일반
negativ
05/26 1837 0
ai 랜덤)after sex room
야짤
ezmood
05/26 6798 28
비월선행록 질문 몇가지
질문
geraltroll
05/26 1384 0
시니시스터2 1.3.1 버전업 됬던데 기존 (1.2.1)거랑 차이 있음?
질문
sinbiru
05/26 1065 0
[복구 요청] 네토리 용사 ~친구의 엄마를 임신시키면 즉시 클리어 ver 1.0
요청
qzmp310
05/26 2257 5
vp세레나 막혔는데 질문점
질문
won0817
05/26 2113 0
항상 최신겜 트랜드 정보 감사
일반
mybest
05/26 1802 0
알몸으로 스토리 보는 편이 더 웃기네
일반
ENE
05/26 2020 1
의술사, 스포) 크롯 바인드 R 이거 어디서 구하나요
질문
borneo
05/26 1187 0
시니시스타2 해보려고 하는데 꼭 1 해야함?
질문
sinbiru
05/26 1644 0
날이 갈수록 덥다
일반
mybest
05/26 1795 -3
Umemaro 우메마로영상 RJ01059074, RJ01399859
영상
ckkey
05/26 24692 227
7월 라무네 애니 7화 에반데
일반
jhgvh
05/26 2531 0
펨돔류 게임 추천 있음?
질문
satam1212
05/26 2464 0
찾아요 부탁드립니다 🙏
질문
seohb5403
05/26 1917 1
[스포]Bastian's Family Secret - K드라마 같은 렌파이
후기 및 공략
delkin424
05/26 3564 6
의술사 영주 만나도됨?
질문
sjh5758
05/26 1975 1
[복구 요청] 천국 등반 자위 서포트 타워 요청드립니다.
요청
satara333
05/26 2016 -1
화이트피치 서클 신작 연기
정보
sorbe123
05/26 2223 5
태양의 기사 에리카 길이 어디냐;;
질문
elke5058
05/26 1607 0
(징징 장문글) 돈 쓴다는데 세상이 날 억까한다
일반
신창섭
05/26 3370 1
[요청복구] RJ01299483 RiNaTest (ai번역)
복구
retanya
05/26 9545 15
아기만들기 온천 개쩌네
일반
98kpl
05/26 1824 5
ai, 블아) 키사키와 잔뜩 아기 만들기 섹스했다
야짤
kjh9304
05/26 12135 126