kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2978 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%기준 아래가 짤리네요
의술사 스포)1.06으로 상향 먹은 장비가
일반
ashesone
05/24 2025 1
[AI번역] 호스트에게 속아서 ~모르는 사이에 조교당해 가는 그녀~
번역
미하리
05/24 40066 178
[無요청복구] (NTR)리본 아일랜드 그록움짤화 한거
복구
단또
05/24 16291 55
야애니 제작 특이점오면 만들어보고 싶은 야애니있음??
질문
villan
05/24 1599 0
유니슨 코드 같은 초갓겜 더 안나오나
야짤
sor17
05/24 4857 11
[복구] 에바네시아 / 히유키 & 에이메스 & 데니아 복구 영상 2개
영상
브레머튼
05/24 13351 70
타케다 다음 코미케 불참
일반
riden
05/24 3320 2
FORTUNE BRIDE 이 이상은 못해먹겠다
일반
tjqjtktwy
05/24 2208 0
이거 최강록 닮지 않음?
야짤
pandaman
05/24 3256 0
아 큰일났다... 나 카린 칭호 다모은 세이브...
일반
liberty
05/24 1083 0
메르피어스 빨간열쇠 획득 방법좀,,
질문
dmdpehd
05/24 2978 0
[요청복구] (RJ01610735) 一人暮ぐらしの夏休み
복구
blases236
05/24 19240 46
풍기위원은 여음마의 꿈을 꾸는가 질문
질문
jhu09
05/24 2417 0
귀축 아저씨들과 JK [잘못 올려서 재업]
동인
mango8981
05/24 18610 85
Summer Memories(응석받이) 아는사람
질문
eyeear
05/24 2139 0
의술사 플탐 좀 긴가
일반
votmvkdlsej
05/24 1906 0
프로미아 (ZZZ)
영상
브레머튼
05/24 12812 83
존재감 여동생 질문
질문
atium842
05/24 1800 0
RJ01153473 < no translation found for 문제
질문
명붕이
05/24 2151 1
하드 산 거 왔는데 초기불량 당첨...
일반
신창섭
05/24 1495 1
Shirabe Shiki-요마 사냥꾼 카나타
동인
k8625
05/24 25495 161
rpgplayer 이거 1번 세이브칸만 로드가 안됨
정보
qaa02ya
05/24 2442 1
엔젤디 (ZZZ)
영상
브레머튼
05/24 14248 102
Hard★Core ~ほたるVer 화면 멈춤
질문
k123321
05/24 1685 0
비월선행록 회차 버그 교차 확인하고싶음
질문
o0o99
05/24 1822 0
RJ161939 메이드 인 메이독 (MADE IN MAIDOG) v4.06 복구 부탁드립니다
요청
한복스님
05/24 3515 1
오네쇼타 스토리 시리즈(Big sis stories) 파트 1
영상
브레머튼
05/24 18062 118
의술사는 한동안 업뎃 계속 나오겠네
일반
ㅇㅇ
05/24 2561 0
던브 개시발시발시발시발
일반
auo-cast-off
05/24 2431 0
대용량 파일은 어떻게 올리는 게 좋을까
질문
ㅇㅇ
05/24 2036 3