kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2936 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
06/01/25
너비아니
06/15/25
참 좋은데 맨 아래쪽 게시글 한두개는 100%기준 아래가 짤리네요
[Ai번역] 후타나리 에로 버라이어티!!!
번역
봇치
05/19 39272 77
(스포일수도?)사신상관은 그냥 세이브받자...
후기 및 공략
해피호건
05/19 4749 6
슬더슬2는 야한모드 나온거 없죠?
질문
odless0101
05/19 3876 -1
스포)의술사 ex엔딩 정리
질문
부탄가스
05/19 5104 0
스토리 좋은 남주물 야겜 추천해조
질문
jiguhyu
05/19 4313 0
타락신관 같은 그림체 갓겜
질문
khb2237
05/19 2270 0
야겜 떡신 모아놓은 사이트 없나
질문
dhoskaks
05/19 5304 0
이 씨발년 결국 찍싸고 튀었네
일반
마사지
05/19 4717 6
동인지 이름 질문.
질문
doma225
05/19 2207 0
던브 통합모드 레벨링에 대한 팁
후기 및 공략
hacom
05/19 3522 8
던전즈 레기온 컷
후기 및 공략
jiguhyu
05/19 3216 3
미번) (역NTR) 좋아하는 남자를 엄마에게 뺏긴 여자
동인
ackfk3
05/19 5613 10
어으 씨 모니터 주사율 문제엿나
일반
제이워드
05/19 1568 1
게임 제목이 기억이 안납니다.
질문
podjtak1
05/19 2875 0
야겜 제작 입문해보려고하는데 다들 어떤 시츄에이션 좋아해요?
질문
YoAKe
05/19 3292 2
의술사 난이도 이지하면 어디까지 내려감?
질문
부탄가스
05/19 4355 0
던브 레벨링 질문입니다
질문
fusbriwidhei32
05/19 2205 0
ai) ----스압---- 명희 모음
야짤
Ghost
05/19 7215 25
그 뭐더라 ts물
질문
danya
05/19 5709 0
waifu fighter 어디간지 알려주실분 구함
질문
supermanig
05/19 2891 -1
스포)비월 질문
질문
sosioto
05/19 2235 0
3d 야애니였는데 뭐였지 기억이안남;;
질문
soolmana23
05/19 1775 0
[구매보급][번역요청] RJ01569600 selenophile 《セレノフィル》
미번
futanarivorelove
05/19 12087 18
ai) 고전 캐릭들 ai로 가지고 놀기
야짤
리피쨔응
05/19 3941 9
안녕하세요 떡인지 하나 찾고있습니다.
질문
homa7
05/19 1934 1
비타퀘2 라이 파트 질문
질문
kmk98
05/19 1761 1
불사설정 캐릭터 볼 때마다 엄한 생각나네
일반
puccho
05/19 2524 3
흑발 존예 히토미 추천 받아요
일반
haha19
05/19 2499 -2
군청의 마녀 키 말인데
질문
aagobe
05/19 2825 0
소리탭 고수분들 소리탭에있는거 추천해주셈
질문
mysteriousdesk
05/19 2758 1