kone
소미소프트

소미소프트

썸네일 크기조절 스크립트

06/01/2025, 08:33:19
유틸
2841 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
Poriuretan 수영부의 에이스
동인
uzaki
04/25 15246 37
Poriuretan 여름 해변에서 의기투합
동인
uzaki
04/25 17967 48
Poriuretan 시골누나
동인
uzaki
04/25 16306 46
Poriuretan 선생님
동인
uzaki
04/25 13192 31
Poriuretan 옆방의 아주머니
동인
uzaki
04/25 14114 28
Poriuretan 정오가 지난 오후의 단지아내
동인
uzaki
04/25 15496 30
Poriuretan 폭풍전의 도서실
동인
uzaki
04/25 11506 28
Poriuretan 장마철의 빨래방
동인
uzaki
04/25 11427 43
Poriuretan 갸루b의 파파카츠
동인
uzaki
04/25 12649 60
[미번][번역요청] 디펜드 다이어리~_ver1.02
미번
minki
04/25 20700 27
[미번] RJ01612483,RJ01414102
미번
페비
04/25 55366 261
[요청복구] RJ01412500 Night High 5
미번
아무일도없었다
04/25 19183 37
기번) 더블 유부녀(미검수)
번역
썩은동태눈깔맨
04/25 32181 106
특공위원회 오우카 RPG 0 이미지(ui) 번역 80% 진행
작업현황
joyed47106
04/25 7065 19
[한국어 자막판][구매보급][전편느긋오호】 다우너 오호고에 개변태 후배와 섹스라이프
소리
이름뭐하지
04/25 19608 69
[미번] 비주얼노벨계 야겜 11개
미번
미스터장
04/25 19140 92
기번) BBC×FAMILY~
번역
썩은동태눈깔맨
04/25 42683 215
(요청복구) 테러블 레버토리 v1.01
복구
kakinara12
04/25 39107 62
고블린 네스트 세이브 최신화 완
세이브
흰꼴뚜기
04/25 8631 15
RJ388166 에이전트 시리우스 DLC
복구
doritori
04/25 27702 63
개꽂혀서 최소 10시간 이상 박았던 게임들
후기 및 공략
dpgutlqkf
04/25 30046 82
~임신 전설~ 옛 용사인 나와 초변태 폭유 공주님×3의 모유 듬뿍 임신시키기 아이 만들기 마왕 봉인 전설♪
소리
dasdaa
04/25 23257 109
후타, 명방) [직번] 시한테 박는 니엔
동인
wa4231
04/25 15983 94
[구매보급]【사상 최고의 오호신음】몰락 메스가키 영애 음문 조교
소리
이름뭐하지
04/25 13218 63
(요청복구) カーテンのむこう NTR 커튼 너머 NTR ver.1.8
복구
sinryeong
04/25 27930 90
[기번] 사신상관EX+DLC 2.0.02
번역
풍수식노천탕
04/25 52306 185
(요청복구) 무치 무치 자매 환생 목적지에서 변태 봉사 생활
복구
sinryeong
04/25 20845 67
메르시 (오버워치)
영상
브레머튼
04/25 19737 101
(청아) 꾸준 연필 30주차
창작
지나가던사람
04/25 17152 28
[AI번역] [JUNN] 네토라레바에 - 인싸 여친의 SNS 네토라레 기록 2
동인
gkcuwuwlltnnrra
04/25 44512 153