kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2874 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
젠존제) 엔젤디 4p
영상
darkunicorn
05/16 19728 109
[요청복구] [RJ01540816] 창해의 레이디 스파이 ver.1.0.0 (번역파일만)
번역
andal
05/16 43888 122
[요청복구] RJ231296 나이트테일 ナイトテール Kr v1.12
복구
stonerock
05/16 15081 38
블아) 미요 강제 + 순애
영상
darkunicorn
05/16 23399 100
[구매보급] RJ01601558(후타), RJ01581759, RJ01577122
소리
stitch
05/16 13922 70
Mankai Kaika 작품모음
동인
ㅇㅇ
05/16 23154 97
(요청복구) Futa Familly 0.245 번역
복구
Onko
05/16 25307 38
AI) 무표정쨩 갱뱅
야짤
miso5
05/16 17212 93
[요청복구]Evil Goddess Ver1.092 복구
복구
로켓드릴킥
05/16 23391 43
청아) 사죠 유키미
영상
darkunicorn
05/16 25551 102
[요청복구/스캇] 수상한 마사지 체험판 EX
복구
be정상인
05/16 24796 45
청?아) Hⓐreⓒhipⓟai 레나 2종류 + 코하루 2종류
영상
darkunicorn
05/16 22371 96
ai)스커크 선생님4 완전굴복 bbc주의
야짤
ezmood
05/16 8782 52
ai)원신 스커크선생님 참교육 3
야짤
ezmood
05/16 13258 41
후원보급,Br@n)서큐버스 하렘 + 통합편집
영상
비밀봉투
05/16 18170 82
[AI번역, 검수] 아득한 세레스피아 1.0.5
번역
제로콜라라이트
05/16 85929 357
인기 게임 스트리머의 성생활
동인
나나세마루
05/16 42677 247
AI역식, Mafuyu) 춘풍정 최음비화 3
동인
sexe1
05/16 15040 53
(청아, 노모, yukino minato)와라베 단지
동인
에우리알레
05/16 25503 94
[구매보급] [스캇물포함] 의붓어머니 대변 외3
소리
책먹는망아지
05/16 10364 46
[AI번역][VJ004665] Innocent Blue 이노센트 블루 (패치파일만)
번역
호빵할배
05/16 26789 67
hechima koubou 같은반 건방진 갸루는 처녀였습니다.
동인
SK
05/16 21562 91
Poriuretan 기생 고블린
동인
SK
05/16 31014 196
[미번 복구]RJ220960 네코로노미콘 복구
미번
printink
05/16 17481 25
[자체번역] 스칼렛 이스케이프 체험판 ScarletEscapeDemo_ver2
복구
송편
05/16 44121 174
[번역기+검수][urakan] 폭유엄마와 의붓아들들
동인
alen
05/16 13627 77
펌,RK-2] 의붓어머니의 장난감이 된 나
동인
kjalar
05/16 20465 52
던전 앤 브라이드v1.56 통합 모드v4.0 업뎃알림
번역
지나가던사람
05/16 32290 73
[Hoeeeng]그 날, 내 usb에 담긴 것은 - 1 중국어 원본+ ai번역
동인
qpsjcb10
05/16 24097 39
<링크 수정>[한글패치만] subverse 1.2.01
번역
mybest
05/16 37105 62