kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2786 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
[복구]섹타듀벨리 모드팩
유틸
continuereset
05/26 5099 20
FORTUNE BRIDE ~절정개안의 의식~ 노모 패치
유틸
미스터장
05/24 6453 33
(코이카츠) 엔드필드 프리셋 공유
유틸
pst0025
05/23 8777 65
EnigmaVBUnpacker (MV MZ 언팩) 웹버전 오픈
유틸
mrpls
05/23 4207 15
[패치만] 시니시스타2 따거 MOD
유틸
하우두유두
05/22 14067 50
[노모패치] 갓 딴 임신시키기 좋은 날
유틸
나나바
05/21 9807 39
시니시스타 2 업뎃기념 모드 모음
유틸
sims9876
05/16 20896 105
(코이카츠) 버튜버 프리셋 공유 ver.2
유틸
pst0025
05/16 13305 51
(코이카츠) 버튜버 프리셋 공유 (복구)
유틸
pst0025
05/16 14664 64
WebP_Converter 코네 다운로드하다 WebP 불편해서 만든 프로그램
유틸
noname
05/15 13097 16
(코이카츠) 최근에 풀린 프리셋 공유
유틸
pst0025
05/15 12770 34
[RPG Maker MV/MZ 실시간 번역기] 4.0 출시
유틸
mrpls
05/15 22714 70
내가 쓰려고 만든 동음 정리 유틸
유틸
yeppi
05/15 8250 24
Texture Tool for Unity 6 ( Mono / IL2CPP ) v0.1.1 최초 배포 버전
유틸
argoklarke
05/14 15163 28
(코이카츠) 학원마스 프리셋 공유
유틸
pst0025
05/14 15650 43
(코이카츠) 프리셋 공유
유틸
pst0025
05/14 11397 58
QW1wbGVjdGVk 블렌더 파일 공유 첫번째 9.74GB
유틸
hannanas
05/12 15587 21
이미지 다운로더 만들어봄
유틸
lordofcinder
05/11 7856 34
코캇 명조 히유키 프리셋 2종류
유틸
pst0025
05/09 15936 24
(코이카츠) 씬 카드 공유
유틸
pst0025
05/09 9179 44
시니시스타2 안대 금발녀 모드 1.2.1 ver
유틸
cascastu
05/08 14386 37
자동소미 해적판X2 1.0.4업데이트 알림
유틸
스눕제이크
05/07 6455 18
[★추천] 무료 망가 번역기★
유틸
mybest
05/07 27759 127
(코이카츠) 소전 캐릭 2명 프리셋
유틸
pst0025
05/06 6791 21
(코이카츠) 명조 신캐 둘 프리셋
유틸
pst0025
05/06 6352 37
Unity Texture Changer v1.0
유틸
kumarin
05/05 7569 34
(코이카츠) 버튜버 프리셋 공유
유틸
pst0025
05/05 16993 79
염월선행록 translation-cache.log 5월10일자 갱신 마지막
유틸
보바도사
05/04 8843 39
배덕의 달콤함에 물든 마나카 FansChat 마개조 및 번역 모드 WIP Manaka
유틸
sco0815
05/04 12032 57
파일 구글 or LM 번역기) AI_kr_tr_9.pyw, AI_kr_tr_8.pyw
유틸
ㅇㅇ
05/03 11490 20