kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2857 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
그런겜없나
질문
짭우
05/18 7356 1
어사일럼 느낌의 최면물 없나요
질문
asdf12----34
05/18 4648 0
촉수던전클리커
미번
coyotori
05/18 13452 49
언홀메 헤그이 마을 진행 더 못함?
질문
unzuk
05/18 5892 0
코네 이미지 버그 해결 방법 찾음
정보
mybest
05/18 5095 15
순도 100% ai만써서 게임 번역하기 근황
일반
아로나
05/18 3623 3
Failed to start BeplnEX 오류
일반
starlight18
05/18 7304 0
용머리는 항상 폰트가 문제야
일반
네토라레프린세스
05/18 4840 1
미번 ) 카이저 PMC에 사로잡힌 토키
동인
nnong
05/18 13047 26
[요청복구] RJ398173 그 여름의 섬 v1.1 [손번역, 노모]
복구
xxxiroha
05/18 29934 93
동거 라이프 같은겜 또 없음??
질문
asdasd12312123
05/18 3163 0
동거라이프 ㄹㅇ GOAT다
후기 및 공략
asdasd12312123
05/18 6516 11
에밀리아나 춤 마스터 하려면 어디로 가야됨?
질문
afggh778
05/18 3564 0
카린의 형무소 질문
질문
sdsdas
05/18 2880 0
ai 번역 채널 개설했습니다.
정보
mybest
05/18 13445 38
구매보급 미번 秘密のアトリエ!
Mock
05/18 25317 90
의술사 이 미친게임
일반
rlawjddms
05/18 4694 0
받아둔 것들은 참 많은데
일반
dkfvkzk123
05/18 3123 2
[기계번역] Yes, I Am a Furry [v0.2.3]
번역
karuparu13
05/18 37773 90
무인도 사원 여행기 이거 풍기레벨이안오름
질문
의현아가방쮸쮸탐사원
05/18 4344 0
[복구요청] RJ398173 여름의 그 섬
요청
어흙마이깟
05/18 15344 5
의술사) 적룡단애 식물학자 퀘 크롯바인드 r 입수처가 어디임?
질문
이상히상
05/18 2932 0
복구요청) 밤산책2 한글패치
요청
machiavelle
05/18 2774 1
꼴잘알들만 아는 마마쇼타물 존맛탱 포인트
일반
nazuma
05/18 3542 4
JRPG 할때 어이없는 보스
일반
에로탐구가
05/18 3639 3
뭐야이거 무서워요
일반
nagisa8262
05/18 2815 1
직번)[mucc]Oppai Mama to Ichaicha Harem _ Lovey-dovey Big Tiddy Mommy Harem -Short Stories
동인
rjwkdrmschl
05/18 22059 77
[복구요청] 네토라레 발정 엘프 여동생 검사 세리카
요청
응애
05/18 4248 0
직번)[mucc]睡眠姦 魔王 - The Hero's Trap
동인
rjwkdrmschl
05/18 15509 70
의술사 여동생 찾기 퀘 질문
질문
nghj7722
05/18 2329 0