kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2885 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
복구요청 공원장난시뮬레이터
요청
mtname
05/25 2192 -4
유부녀 세리아의 타락과 배덕 발매일 확정
정보
wouwouer
05/25 7467 34
공포+"야"겜 인거 추천해줄 수 있음?
질문
애널
05/25 1782 0
귀갓길-연이은 밤- 엔딩 후기
후기 및 공략
Nate Higgerson
05/25 3061 12
아부라소바 서클 새게임 나왔네
일반
ryyyyyn
05/25 2392 0
게임 이름이 기억이 안나네요
질문
hhtty
05/25 1194 0
(수정)이것과 비슷한 게임을 찾는데요;; 찾았습니다 관심에 감사드립니다^^
질문
hwucs
05/25 2339 1
의술사 버전업 질문
질문
nghj7722
05/25 2285 0
봉음동굴 에로네스트 해보신분들
질문
jiyee
05/25 2847 0
의술사 다리 어캐놓아요?
질문
lunee
05/25 1746 0
존재감 여동생 1.1 모바일은 아직 없는건가?
질문
rice-eating
05/25 1277 0
[구매보급] RJ01271506 フォレスティア~ちいさな町の牧場ライフ~ 1.41 + 음성DLC 적용합본
미번
fbrpdlawm
05/25 21857 163
음습의 카쿠리요 마을 이게임 ntr게임들중에 top임??
질문
pouz123
05/25 2423 -1
망가하나 찾습니다
질문
k97k98
05/25 1733 0
오나서포 mp3? 이거는 다 일어인데
질문
bestviewg
05/25 2402 0
눈을 떠보니 목이 잘려 있는 여주인공
일반
mowajelly
05/25 6677 26
고전 만화 하나를 찾고 있읍니다...
질문
aicxvmwn
05/25 3077 0
[복구요청] RJ01299483 RiNaTest
요청
porsent
05/25 3032 0
클리어 후기 : [강화버전]달인 퇴마사는 촉수요마 따위에 굴하지 않아_v260523
후기 및 공략
우흥
05/25 3390 5
아득한 세레스피아 세이브없음?
질문
르모듈러
05/25 2088 0
색귀 WASD 오류
질문
liamayril
05/25 2312 0
비월선행록 개조판 정기획득 됨?
질문
o0o99
05/25 2489 0
복구 부탁드립니다.
요청
sa-ba-chan
05/25 3929 0
[복구요청] 대마관 아폴로의 쾌감조교
요청
인디게임보지맨
05/25 1854 0
의술사 패치했더니 주인공 세졌네...
일반
happy3
05/25 2859 0
House of shinobi 게임은 정말
질문
두파루파
05/25 1997 2
이터넘 질문
질문
dfgtewkwg
05/25 1161 1
[ai 번역][Usagi Nagomu] 황혼의 창 엘프 총집편 에일린 파트 1 [p.137]
동인
mybest
05/25 16195 69
뭐지 메가 서버 터졌나?
일반
mdabedlehm
05/25 1699 -2
청아)zzz망상병 집단과 파티
영상
gal-joa
05/25 27018 87