kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2986 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%기준 아래가 짤리네요
타락신관 조이플 이미지 오류 해결
유틸
yeppi
11/23/25 7756 21
RPG MV/MZ 실시간 번역기 - 1.3
유틸
mrpls
11/15/25 22753 116
[노모패치] 란스03
유틸
imakotou
11/14/25 12824 70
포레스티아 낚시 파일 수정본
유틸
geekel
11/09/25 4794 21
demosaic colMask
유틸
kumarin
11/06/25 37315 57
후타)잠꾸러기 후타나리의 착정던전 구출기 노모패치
유틸
레가토
11/03/25 12595 18
[일부 노모패치] 서큐버스 & 매직 (청아,언버스짤 있음)
유틸
OTGie
11/02/25 5573 26
[노모패치]신인마왕과 100명의 연인들
유틸
아르
11/02/25 10644 35
Anaertailin 작가의 Slay the Spire 모음집
유틸
삐뉴
11/01/25 26361 42
[노모 + 텍스쳐 패치] 여신 메르의 만지작 동거 성활 v1.0
유틸
털털털털털털털털
11/01/25 11394 67
무료 BGM 모음집 2025.11.01.
유틸
날개 로봇
11/01/25 4839 15
다시 돌아온 다키스트 던전 NSFW 완전판 [Npc 리텍 / 영웅 리텍 / 이쁜이쁜 영웅 모드 / 몬스터 리텍] + 새 모드!
유틸
삐뉴
10/30/25 21709 122
슬레이 더 스파이어 (Slay The Spire) R18 패치 모드
유틸
cirial
10/28/25 27087 43
미끼 치한 수사관 리나 모드
유틸
happy123
10/27/25 10044 17
일라이자의 비약 노모(Decensor) 패치
유틸
이브라브
10/26/25 4570 25
코네 추천순 정렬 스크립트 업데이트
유틸
ducktail
10/24/25 12769 38
코네 추천 컷 & 추천순 정렬 스크립트
유틸
ducktail
10/20/25 10511 59
MV/MZ 실시간 번역기 0.3 업데이트
유틸
moveit
10/18/25 6267 47
[노모이미지만][청아] 호문쿨루스와의 성생활 노모패치
유틸
Ghost
10/16/25 8779 64
오토소미 autosomi업뎃함
유틸
김머시기
10/13/25 8623 61
방주정리기 (파일명정리 프로그램) v1.16 (26.04.04)
유틸
알비노
10/12/25 14014 54
RPG Maker MV/MZ 실시간 번역기 (DeepL) - 셀레스포니아 3in1 외 기타등등 가능
유틸
moveit
10/11/25 11921 36
도나도나 미검열 CG 오류 수정 최종완성본final최종2
유틸
riel64
10/06/25 14810 77
카린즈 프리즌 cc모드 기계번역해옴
유틸
고추보집물
10/03/25 8767 39
무기력 천사 추가 렉 개선 패치 (a.k.a 쯔꾸르는 최적화 쓰레기가 분명하다)
유틸
erukajihx
10/02/25 6664 65
다키스트던전 Deovolente 에디션
유틸
doyoulikekim
09/27/25 9683 29
[v10] 자동 소미 Auto Somi 개조판
유틸
마나난
09/26/25 14300 22
좀더! 불꽃의 시리즈 붉은화면 수정패치
유틸
adsv42
09/23/25 3733 15
도나도나 미검열 CG 오류들 수정
유틸
riel64
09/23/25 17297 77
SW_Decensor v0.7.4.1
유틸
kumarin
09/21/25 9481 38