Files
Eagler-Archive/offline-minecraft-skin-converter/files/index.html
T

912 lines
40 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Offline Minecraft Skin Converter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Generate your Minecraft Java Edition Resource Pack with your custom PNG skin. Completely offline and with no data submission. Supports all 9 default skins.">
<meta name="keywords" content="Minecraft, Skin Converter, Resource Pack Generator, Offline, PNG, Steve, Alex, Ari, Kai, Noor, Sunny, Zuri, Efe, Makena">
<meta property="og:title" content="Offline Minecraft Skin Converter">
<meta property="og:description" content="Generate your Minecraft Java Edition Resource Pack with your custom PNG skin. Completely offline and with no data submission. Supports all 9 default skins.">
<meta property="og:type" content="website">
<meta property="og:image" content="https://1337rod.github.io/Offline-Minecraft-Skin-Converter/social_image.png">
<meta property="og:url" content="https://1337rod.github.io/Offline-Minecraft-Skin-Converter/">
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
<style>
/* =======================================================
Minecraft Font and GUI Variables
======================================================= */
@font-face {
font-family: 'Minecraft Font';
src: url('assets/fonts/minecraft_font.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
:root {
--radius: 0;
--transition: 0s;
/* Classic GUI Colors (Fixed Dark Mode) */
--mc-window-bg: #353535;
--mc-text-color: #E0E0E0;
--mc-text-outline: #000000;
--mc-highlight-bg: #4C4C4C;
--mc-panel-border-dark: #000000;
--mc-panel-border-light: #D0D0D0;
/* Default Button Style */
--mc-btn-bg: #5D5D5D;
--mc-btn-border-dark: #565656;
--mc-btn-border-light: #AAA;
--mc-btn-hover-border-dark: #59639A;
--mc-btn-hover-border-light: #BDC6FF;
/* Accent Colors */
--mc-accent-color: #3CB055;
--mc-danger-color: #FF5454;
/* Stone Texture Base64 */
--mc-stone-texture-base64: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUAAAMQAAAAPCAAAAACe4j/AAAAEuElEQVRIx1WWS5Ibuw5EtddrdRRJJE4iSKrb4c2/AUuy30iK+jEBHCTwAICMCgAKiGhKVQUwKzJHQo4mQGBy7AIvk1E2AQKhFt6bUGD1gILy0DkD4dmzACkGyzCScgFgQmLZr4LpQpC56QB2wgSYE8i1fd6xd9xPHIAKwAs14Undx2LIHK0X6vdBbzTa6CNBLQE8Y5rapn7oAl3KSDKC6cLfL6sLnIVG7ffnyUgvQ6rwLjUZdIVqWz0iEXXCZ+TJsV8feUdoPHDk+a/IeAbq0ldLT59jtHweHwmKS6gFSUYCqKcVsPami1pEnqolkCMBiAS87FXTICp03geYUr+TV8un3KuyC0BfTUzihOCdwjUya1bkT1VWe+AaFOoJzHdtERXRe3eulyEDhC6pjYwr+JQuIDU9/0wQBnJEAkd+9i6IRTJrV7YWnGfwLA6ESphkBoCu88M0YH1CTTOiRUpBdwpGnkP5yL9phhwn+QVxDarAXq513y9bLKgxBGR/CjDyMl4ECd6lO82CaMLbEHGHp1R8ePDERj392ssaCOigNjJ+dXXl6OLUFfVx6dA1BFJLlHpkUHPam095C3QJLIjn6OLIOB3xe0JS85Zd+govg1/z/UhtG3RdVW98yxNp5I0Vtf/U+6y/dJ/yHtSK4q7G9ARscC3/Df/kXTwiT3d6ovjEISLJIVEvBwWeCXlALZTbpy85xqGuf3sNiBBUmYjI+BqN6aNQqDWpipSYf3W1nOV/WALoykjIiCPreSn97UigsjZdPA5s3AmCDIxaVO0Fa1fV/qkaiijPPz/bEeRyLSBDI8K8j37TO8aH7vmOqUUQ1DboYhvqd+FlFGEo+2T75MbLGnjvPeu7Pl521Ap14dcR3h7p75qv4xieqnNDoyCPLt/yKkf5gOUXl+6S3d9Syq/982fz+fhpsm28C5EhJcxsWWQke6KoPMA7tqm7kKcrn6FLhWcoqCNCxDPyQ8wEKR73nIlEX8GpARSJX7/rzeNtWPD/Dl2IwtOYMwV7osGsHYJanzeU7KqIZVCTcrT0IEbyD4d1e1dkBtW2qLhLXK7a1ogDqsjI1DR4PY7nHEqfF9tn8HUJL+eQ/lGOXdwI1++57CqgmDaReM9CZYLAk4D4ymqti4KZI9Htz9OnrcuOhCQEqJfXaxHPAFG/l/ee1GFJPXmPryYUiUGPutnRGXkagmnjHk5RNpm7xxiclm6CjJEQ4+MD4xPmuT9Ef4b3YT3B51a7d4Np76PF0cavuC+SoaH6PlilipEakoJBJETWT3k7Hf+1REPj2fIx95t5ct6u9S5v3KM2fv2Ve29ax9yC98zT2IZot61MHyYtdPF92nguZ29xfcVxSu9Nj5Gl8GGwcVoW8n1Q/f6BHFEAyy5R2aRIdYH8XfV4453vHKcnqarXPD6mdrD0rlVV5xBPF2xuJM5Oo0SdaaqGMjJva7ii6bYv74IzPMo5pGebpu72ghypwTR+WWDuhQOkFijGyAzF3GXh11lEH0hkPINZivpTqLEtVm2j1hVcn/S0//q0es5dbyxOErxKivQ+bHotvzcT3/XztPf20XqG6fJZMePT2X6ts+nlm9LoSYHMiHuJjGXniB7v2fo/5qT4nuxYg6AAAAAASUVORK5CYII=);
}
/* =======================================================
Base Styles
======================================================= */
* { box-sizing: border-box; }
body {
font-family: 'Minecraft Font', 'Press Start 2P', monospace;
background-color: #1A1A1A;
color: var(--mc-text-color);
margin: 0;
display: flex; align-items: center; justify-content: center; min-height: 100vh;
text-rendering: optimizeSpeed;
}
#game-screen-bg {
background-image: url('assets/images/dirty_bg.png');
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
width: 100%;
min-height: 100vh;
display: flex; align-items: center; justify-content: center;
}
.pixel-text { font-family: 'Minecraft Font', 'Press Start 2P', monospace; }
.text-shadow { text-shadow: 2px 2px 0 var(--mc-text-outline); color: var(--mc-text-color); }
.text-shadow-large { text-shadow: 4px 4px 0 var(--mc-text-outline); color: var(--mc-text-color); }
/* =======================================================
Main Window (GUI)
======================================================= */
#gui-window {
width: 95%;
max-width: 500px;
padding: 16px;
border: 4px solid var(--mc-panel-border-dark);
box-shadow:
4px 4px 0 0 var(--mc-panel-border-light),
-4px -4px 0 0 var(--mc-panel-border-light),
4px -4px 0 0 var(--mc-panel-border-light),
-4px 4px 0 0 var(--mc-panel-border-light);
background: rgba(32, 32, 32, 0.8);
display: flex;
flex-direction: column;
gap: 12px;
}
/* Inner Panel/Card */
.mc-panel {
background: var(--mc-window-bg);
padding: 16px;
border: 2px solid;
border-color: var(--mc-panel-border-light) var(--mc-panel-border-dark) var(--mc-panel-border-dark) var(--mc-panel-border-light);
}
/* Drop and Preview Area */
#drop-area, #loaded-state { text-align: center; }
/* Content alignment in Loaded Skin screen */
#loaded-state {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
}
#drop-area {
cursor: pointer;
padding: 40px 20px;
border: 2px dashed var(--mc-panel-border-dark);
display: block;
}
#drop-area.highlight {
background-color: rgba(0, 170, 0, 0.2);
border-color: var(--mc-accent-color);
}
/* =======================================================
Buttons and Selects
======================================================= */
.mc-btn, .mc-select {
font-family: 'Minecraft Font', 'Press Start 2P', monospace;
cursor: pointer;
text-shadow: 2px 2px 0 var(--mc-text-outline);
color: var(--mc-text-color);
padding: 8px 16px;
border-width: 2px;
/* Center text correctly */
display: flex;
justify-content: center;
align-items: center;
background-image: var(--mc-stone-texture-base64);
background-color: var(--mc-btn-bg);
background-repeat: repeat;
background-size: auto;
border-style: solid;
border-color: var(--mc-btn-border-light) var(--mc-btn-border-dark) var(--mc-btn-border-dark) var(--mc-btn-border-light);
}
.mc-btn:hover, .mc-select:hover, #drop-area:hover {
background-position: 0 -15px;
border-color: var(--mc-btn-hover-border-light) var(--mc-btn-hover-border-dark) var(--mc-btn-hover-border-dark) var(--mc-btn-hover-light);
}
.mc-btn:active, .mc-select:active, #drop-area:active {
border-color: var(--mc-btn-hover-border-dark) var(--mc-btn-hover-border-light) var(--mc-btn-hover-border-light) var(--mc-btn-hover-border-dark);
transform: translateY(1px);
}
.mc-btn-download { background-color: var(--mc-accent-color); }
.mc-btn-remove { background-color: var(--mc-danger-color); }
/* Language Select */
.mc-select {
-webkit-appearance: none; appearance: none;
padding: 6px 10px;
height: 34px;
line-height: 14px;
}
/* Ko-fi/Language Bar (Container) */
.lang-kofi-bar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
/* KO-FI Button Style */
#kofi-mc-btn {
height: 34px;
line-height: 14px;
text-decoration: none;
flex-grow: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
/* Copying button styles for the Ko-fi link */
background-image: var(--mc-stone-texture-base64);
background-color: var(--mc-btn-bg);
background-repeat: repeat;
background-size: auto;
border-width: 2px;
border-style: solid;
border-color: var(--mc-btn-border-light) var(--mc-btn-border-dark) var(--mc-btn-border-dark) var(--mc-btn-border-light);
text-shadow: 2px 2px 0 var(--mc-text-outline);
color: var(--mc-text-color);
}
/* Details / How To Use / Structure */
.details-content, .privacy-content {
font-size: 12px; color: #E0E0E0; text-shadow: none; line-height: 1.4;
}
/* NEW: Instruction list item style (pixelated marker) */
.how-to-item {
font-size: 12px;
color: #E0E0E0;
text-shadow: none;
line-height: 1.4;
padding-left: 12px;
position: relative;
}
/* The pixelated marker */
.how-to-item::before {
content: "■";
color: var(--mc-text-color);
font-size: 10px;
position: absolute;
left: 0;
top: 0;
}
/* Details Titles */
.details-title {
font-size: 14px; margin-top:0;
}
/* ZIP STRUCTURE */
#zip-structure-code {
background:#1A1A1A;
padding:10px;
margin: 5px 0;
border: 1px solid #000;
overflow-x: auto;
font-size: 12px;
line-height: 1.4;
}
/* Footer Link */
.mc-link {
color: var(--mc-text-color);
text-shadow: 1px 1px 0 var(--mc-text-outline);
text-decoration: none;
font-size: 10px;
}
/* =======================================================
Modal Styles (Privacy and Secret Feature)
======================================================= */
.privacy-modal {
position: fixed;
z-index: 1000;
left: 0; top: 0;
width: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.75);
display: flex; align-items: center; justify-content: center;
}
.modal-inner {
position: relative;
width: 90%;
max-width: 480px;
padding: 16px;
border: 4px solid var(--mc-panel-border-dark);
box-shadow:
4px 4px 0 0 var(--mc-panel-border-light),
-4px -4px 0 0 var(--mc-panel-border-light),
4px -4px 0 0 var(--mc-panel-border-light),
-4px 4px 0 0 var(--mc-panel-border-light);
background: var(--mc-window-bg);
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
}
/* =======================================================
NEW: Error Toast / Achievement Warning
======================================================= */
#error-toast {
position: fixed;
top: -100px;
left: 50%;
transform: translateX(-50%);
z-index: 10000;
width: 90%;
max-width: 400px;
padding: 10px 16px;
border: 4px solid var(--mc-panel-border-dark);
box-shadow:
4px 4px 0 0 var(--mc-panel-border-light),
-4px -4px 0 0 var(--mc-panel-border-light),
4px -4px 0 0 var(--mc-panel-border-light),
-4px 4px 0 0 var(--mc-panel-border-light);
background: var(--mc-window-bg);
}
@keyframes slide-in {
0% { top: -100px; }
10% { top: 10px; }
90% { top: 10px; }
100% { top: -100px; }
}
.toast-show {
animation: slide-in 3.5s ease-in-out forwards;
}
</style>
</head>
<body>
<div id="game-screen-bg">
<div id="gui-window">
<div id="upload-section" class="mc-panel">
<input type="file" id="file-input" accept="image/png" style="display:none;">
<label for="file-input" id="drop-area" role="button" tabindex="0">
<p id="drop-text" class="pixel-text text-shadow">Drag and Drop Your PNG Skin</p>
<p class="details-content"></p>
</label>
<div id="loaded-state" style="display:none;">
<div style="display:flex; flex-direction: column; align-items: center; gap: 10px;">
<img id="skin-preview" alt="Skin Preview" style="width: 128px; height: 128px; image-rendering: pixelated; margin-bottom: 8px; border: 4px solid; border-color: var(--mc-panel-border-dark) var(--mc-panel-border-light) var(--mc-panel-border-light) var(--mc-panel-border-dark); background: var(--mc-highlight-bg);">
<p id="file-name-display" class="pixel-text text-shadow" style="font-size:14px;"></p>
</div>
<div style="display:flex; justify-content: center; gap: 8px; margin-top: 10px;">
<button id="remove-btn" class="mc-btn pixel-text" style="width: 120px;">REMOVE</button>
<button id="download-btn" class="mc-btn pixel-text" style="width: 120px;">DOWNLOAD</button>
</div>
</div>
<div id="success-message" style="display:none; padding: 20px;">
<p class="pixel-text text-shadow" style="color:#FFFF55; text-align:center;">Skin pack downloaded successfully!</p>
</div>
</div>
<button id="toggle-details-btn" class="mc-btn pixel-text">SHOW DETAILS</button>
<div id="details-container" class="mc-panel" style="display: none; flex-direction: column; gap: 10px;">
<h2 id="how-to-title" class="pixel-text text-shadow details-title">HOW TO USE</h2>
<div id="how-to-list-container" style="display: flex; flex-direction: column; gap: 8px;">
</div>
<h2 id="zip-structure-title" class="pixel-text text-shadow details-title">ZIP STRUCTURE</h2>
<pre class="details-content" id="zip-structure-code" style="background:#1A1A1A; padding:10px; margin: 5px 0; border: 1px solid #000; overflow-x: auto;"></pre>
</div>
<div class="lang-kofi-bar">
<a href="https://ko-fi.com/V7V61KZ9FL" target="_blank" rel="noopener noreferrer" class="mc-btn pixel-text" id="kofi-mc-btn">
<span id="kofi-text">SUPPORT ON KO-FI</span>
</a>
<select id="lang-select" class="mc-select pixel-text">
<option value="en">English</option>
<option value="pt-br">Português</option>
<option value="es">Español</option>
</select>
</div>
<p style="text-align: center; margin-top: 4px; margin-bottom: 0;">
<a href="#" id="privacy-link" class="mc-link">Privacy and Terms</a>
<span class="mc-link">| v2.0.2</span>
</p>
</div>
</div>
<div id="privacy-modal" class="privacy-modal" style="display: none;">
<div class="modal-inner">
<button class="mc-btn pixel-text"
style="position: absolute; top: 4px; right: 4px;
padding: 4px 4px; width: 20px; height: 20px;
line-height: 1; font-size: 10px; text-align: center;"
id="modal-close-btn">
x
</button>
<h2 class="pixel-text text-shadow" id="privacy-title" style="text-align: center;">Privacy Policy and Terms of Service</h2>
<div class="details-content" id="privacy-text">
<p>This website does not collect, store, or process any personal data. All skin processing is done directly in your browser.</p>
<p>The generated files remain only on your computer and are not sent to the internet.</p>
<p>The use of the tool is completely free and does not require an account or login.</p>
</div>
</div>
</div>
<div id="error-toast" style="display:none;" class="mc-panel">
<p id="error-toast-text" class="pixel-text" style="color:var(--mc-danger-color); text-shadow: 2px 2px 0 var(--mc-text-outline); font-size: 14px; text-align:center; margin: 0;"></p>
</div>
<div class="privacy-modal" id="secret-feature-overlay" style="display: none;">
<div class="modal-inner" style="max-width: 560px; aspect-ratio: 16/9; padding: 0; background: none; border: none; box-shadow: none;">
<div id="secret-feature-player" style="width: 100%; height: 100%;"></div>
<button class="mc-btn pixel-text" style="position: absolute; top: 0px; right: 0px; padding: 4px 8px; z-index: 10;" id="secret-feature-close">&times;</button>
</div>
</div>
<audio id="mc-achievement-sound" src="assets/audio/achievement.mp3" preload="auto"></audio>
<audio id="mc-click-sound" src="assets/audio/click.mp3" preload="auto"></audio>
<audio id="mc-download-sound" src="assets/audio/download.mp3" preload="auto"></audio>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://www.youtube.com/iframe_api"></script>
<script>
// =======================================================
// JAVASCRIPT LOGIC
// =======================================================
// Selectors
const langSelect = document.getElementById('lang-select');
const dropArea = document.getElementById('drop-area');
const fileInput = document.getElementById('file-input');
const loadedState = document.getElementById('loaded-state');
const successMessage = document.getElementById('success-message');
const fileNameDisplay = document.getElementById('file-name-display');
const preview = document.getElementById('skin-preview');
const removeButton = document.getElementById('remove-btn');
const downloadButton = document.getElementById('download-btn');
const toggleDetailsBtn = document.getElementById('toggle-details-btn');
const detailsContainer = document.getElementById('details-container');
const howToListContainer = document.getElementById('how-to-list-container');
const privacyModal = document.getElementById('privacy-modal');
const privacyLink = document.getElementById('privacy-link');
const modalCloseBtn = document.getElementById('modal-close-btn');
const secretFeatureOverlay = document.getElementById('secret-feature-overlay');
const secretFeatureCloseButton = document.getElementById('secret-feature-close');
// Titles and Ko-fi Selectors
const kofiTextSpan = document.getElementById('kofi-text');
const howToTitle = document.getElementById('how-to-title');
const zipStructureTitle = document.getElementById('zip-structure-title');
const privacyTitle = document.getElementById('privacy-title');
const privacyTextContainer = document.getElementById('privacy-text');
// Audio Selectors
const clickSound = document.getElementById('mc-click-sound');
const achievementSound = document.getElementById('mc-achievement-sound');
const downloadSound = document.getElementById('mc-download-sound');
// Error Toast Selectors
const errorToast = document.getElementById('error-toast');
const errorToastText = document.getElementById('error-toast-text');
let skinFile = null;
let currentFileName = '';
let player = null;
let secretFeatureActive = false;
let sequence = '';
let isYouTubeApiReady = false;
const allNames = ["Steve", "Alex", "Ari", "Kai", "Noor", "Sunny", "Zuri", "Efe", "Makena"];
// Function to play click sound
function playClickSound() {
if (clickSound) {
clickSound.currentTime = 0;
clickSound.play().catch(e => console.log('Click Playback Blocked', e));
}
}
// Function to play achievement sound (used for Error Toast)
function playAchievementSound() {
if (achievementSound) {
achievementSound.currentTime = 0;
achievementSound.play().catch(e => console.log('Achievement Playback Blocked', e));
}
}
// Function to play download sound (XP)
function playDownloadSound() {
if (downloadSound) {
downloadSound.currentTime = 0;
downloadSound.play().catch(e => console.log('Download Playback Blocked', e));
}
}
// Helper function to control interactivity
function setInteractivity(enabled) {
langSelect.disabled = !enabled;
if (skinFile) {
downloadButton.disabled = !enabled;
}
}
// Function to display the achievement-style warning toast
function showErrorToast(message) {
playAchievementSound();
setInteractivity(false);
errorToastText.textContent = message;
errorToast.style.display = 'block';
errorToast.classList.add('toast-show');
setTimeout(() => {
errorToast.classList.remove('toast-show');
errorToast.style.display = 'none';
setInteractivity(true);
}, 3600);
}
// Translation Data
const translations = {
'pt-br': {
dropText: 'Arraste e Solte Sua Skin PNG',
dropDetails: '',
kofiText: 'APOIE NO KO-FI',
removeText: 'REMOVER',
downloadText: 'BAIXAR',
successText: 'Pacote de skins baixado com sucesso!',
howToTitle: 'COMO USAR',
howToList: ['Baixe o .zip e ative como Resource Pack.', 'Skins padrão (Steve, Alex, Ari, etc.) serão substituídas pela sua.'],
zipStructureTitle: 'ESTRUTURA DO ZIP:',
zipStructureText: `skin_pack/
pack.mcmeta
README.txt
assets/minecraft/textures/entity/
├ steve.png
├ alex.png
├ ... (todas as 9 skins)
├ player/
├ wide/
├ steve.png
├ ...
└ slim/
├ alex.png
└ ...`,
fileNamePrefix: 'Arquivo carregado: ',
alertWrongFormat: 'A imagem precisa ter 64×64 pixels.',
alertSelectPng: 'Por favor, selecione um arquivo PNG.',
readme: 'Este é um pacote de recursos para o Minecraft Java Edition, gerado localmente para funcionar offline. Ele substitui todas as 9 skins padrão do jogo (incluindo Steve, Alex, Ari, etc.) pela sua skin personalizada.\n\nCriado pelo 1337rod :)',
mcmetaDesc: 'Pacote de skins gerado localmente para substituir as skins padrão do Minecraft. Funciona offline.',
toggleBtnText: 'MOSTRAR DETALHES',
toggleBtnTextAlt: 'OCULTAR DETALHES',
privacyLink: 'Privacidade e Termos',
privacyTitle: 'Política de Privacidade e Termos de Serviço',
privacyText: ['Este site não coleta, armazena ou processa qualquer dado pessoal. Todo o processamento da sua skin é feito diretamente no seu navegador.', 'Os arquivos gerados ficam apenas no seu computador e não são enviados para a internet.', 'O uso da ferramenta é inteiramente gratuito e não requer conta ou login.']
},
'en': {
dropText: 'Drag and Drop Your PNG Skin',
dropDetails: '',
kofiText: 'SUPPORT ON KO-FI',
removeText: 'REMOVE',
downloadText: 'DOWNLOAD',
successText: 'Skin pack downloaded successfully!',
howToTitle: 'HOW TO USE',
howToList: ['Download the .zip and activate it as a Resource Pack.', 'Default skins (Steve, Alex, Ari, etc.) will be replaced with your skin.'],
zipStructureTitle: 'ZIP STRUCTURE:',
zipStructureText: `skin_pack/
pack.mcmeta
README.txt
assets/minecraft/textures/entity/
├ steve.png
├ alex.png
├ ... (all 9 skins)
├ player/
├ wide/
├ steve.png
├ ...
└ slim/
├ alex.png
└ ...`,
fileNamePrefix: 'File loaded: ',
alertWrongFormat: 'The image needs to be 64×64 pixels.',
alertSelectPng: 'Please select a PNG file.',
readme: 'This is a resource pack for Minecraft Java Edition, generated locally to work offline. It replaces all 9 default game skins (including Steve, Alex, Ari, etc.) with your custom skin.\n\nCreated by 1337rod :)',
mcmetaDesc: 'Locally generated skin pack to replace default Minecraft skins. Works offline.',
toggleBtnText: 'SHOW DETAILS',
toggleBtnTextAlt: 'HIDE DETAILS',
privacyLink: 'Privacy and Terms',
privacyTitle: 'Privacy Policy and Terms of Service',
privacyText: ['This website does not collect, store, or process any personal data. All skin processing is done directly in your browser.', 'The generated files remain only on your computer and are not sent to the internet.', 'The use of the tool is completely free and does not require an account or login.']
},
'es': {
dropText: 'Arrastra y Suelta Tu Skin PNG',
dropDetails: '',
kofiText: 'APOYA EN KO-FI',
removeText: 'QUITAR',
downloadText: 'DESCARGAR',
successText: '¡Paquete de skins descargado con éxito!',
howToTitle: 'CÓMO USAR',
howToList: ['Descarga el .zip y actívalo como Paquete de Recursos.', 'Las skins predeterminadas (Steve, Alex, Ari, etc.) serán reemplazadas por la tuya.'],
zipStructureTitle: 'ESTRUCTURA DEL ZIP:',
zipStructureText: `skin_pack/
pack.mcmeta
README.txt
assets/minecraft/textures/entity/
├ steve.png
├ alex.png
├ ... (todas las 9 skins)
├ player/
├ wide/
├ steve.png
├ ...
└ slim/
├ alex.png
└ ...`,
fileNamePrefix: 'Archivo cargado: ',
alertWrongFormat: 'La imagen debe tener 64×64 píxeles.',
alertSelectPng: 'Por favor, selecciona un archivo PNG.',
readme: 'Este es un paquete de recursos para Minecraft Java Edition, generado localmente para funcionar sin conexión. Reemplaza las 9 skins predeterminadas del juego (incluyendo Steve, Alex, Ari, etc.) con tu skin personalizada.\n\nCreado por 1337rod :)',
mcmetaDesc: 'Paquete de skins generado localmente para reemplazar las skins predeterminadas de Minecraft. Funciona sin conexión.',
toggleBtnText: 'MOSTRAR DETALLES',
toggleBtnTextAlt: 'OCULTAR DETALLES',
privacyLink: 'Privacidad y Términos',
privacyTitle: 'Política de Privacidad y Términos de Servicio',
privacyText: ['Este sitio no recopila, almacena ni processa ningún dato personal. Todo el procesamiento de su skin se realiza directamente en su navegador.', 'Los archivos generados permanecen solo en su computadora **y no se envían** a Internet.',
'El uso de la herramienta es completamente gratuito **y no requiere** una cuenta ni inicio de sesión.'
]
}
};
function updateText(lang) {
const texts = translations[lang];
// Main texts and buttons
dropArea.querySelector('#drop-text').textContent = texts.dropText;
dropArea.querySelector('.details-content').textContent = texts.dropDetails;
kofiTextSpan.textContent = texts.kofiText;
removeButton.textContent = texts.removeText;
downloadButton.textContent = texts.downloadText;
// Details Toggle
const isVisible = detailsContainer.style.display === 'flex';
toggleDetailsBtn.textContent = isVisible ? texts.toggleBtnTextAlt : texts.toggleBtnText;
// Details Titles and Content
howToTitle.textContent = texts.howToTitle;
zipStructureTitle.textContent = texts.zipStructureTitle;
// Render HOW TO USE as paragraphs with pixelated marker
howToListContainer.innerHTML = texts.howToList
.map(item => `<p class="how-to-item">${item}</p>`)
.join('');
// ZIP STRUCTURE
document.getElementById('zip-structure-code').textContent = texts.zipStructureText;
// Privacy
document.getElementById('privacy-link').textContent = texts.privacyLink;
privacyTitle.textContent = texts.privacyTitle;
privacyTextContainer.innerHTML = texts.privacyText.map(p => `<p>${p}</p>`).join('');
// Loaded State
if (skinFile) {
fileNameDisplay.textContent = texts.fileNamePrefix + currentFileName;
} else {
fileNameDisplay.textContent = '';
}
if (successMessage.style.display === "block") {
successMessage.querySelector('.text-shadow').textContent = texts.successText;
}
}
function showState(state) {
dropArea.style.display = "none";
loadedState.style.display = "none";
successMessage.style.display = "none";
if (state === "drop") {
dropArea.style.display = "block";
fileInput.value = "";
skinFile = null;
currentFileName = '';
} else if (state === "loaded") {
loadedState.style.display = "flex";
} else if (state === "success") {
successMessage.style.display = "block";
setTimeout(() => showState("drop"), 3000);
}
updateText(langSelect.value);
}
function handleFile(file) {
const currentLangTexts = translations[langSelect.value];
if (!file || file.type !== "image/png") {
showErrorToast(currentLangTexts.alertSelectPng);
return;
}
const reader = new FileReader();
reader.onload = e => {
const img = new Image();
img.onload = () => {
if (img.width === 64 && img.height === 64) {
skinFile = file;
currentFileName = skinFile.name;
preview.src = e.target.result;
showState("loaded");
} else {
showErrorToast(currentLangTexts.alertWrongFormat);
fileInput.value = "";
}
};
img.src = e.target.result;
};
reader.readAsDataURL(file);
}
async function processSkinAndCreateZip() {
downloadButton.disabled = true;
const reader = new FileReader();
reader.readAsDataURL(skinFile);
reader.onload = async e => {
const base64Data = e.target.result.replace(/^data:image\/png;base64,/, "");
const lang = langSelect.value;
const texts = translations[lang];
const zip = new JSZip();
const packFolder = zip.folder("skin_pack");
packFolder.file("README.txt", texts.readme.replace(/\\n/g, '\n'));
packFolder.file("pack.mcmeta", JSON.stringify({
pack: { pack_format: 14, description: [{ text: texts.mcmetaDesc }] }
}, null, 2));
const entityFolder = packFolder.folder("assets/minecraft/textures/entity");
const slimFolder = entityFolder.folder("player/slim");
const wideFolder = entityFolder.folder("player/wide");
allNames.forEach(name => {
const fileName = name.toLowerCase() + ".png";
entityFolder.file(fileName, base64Data, { base64: true });
slimFolder.file(fileName, base64Data, { base64: true });
wideFolder.file(fileName, base64Data, { base64: true });
});
const content = await zip.generateAsync({ type: "blob" });
const url = URL.createObjectURL(content);
const a = document.createElement("a");
a.href = url;
a.download = "skin_pack.zip";
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
showState("success");
downloadButton.disabled = false;
playDownloadSound();
};
}
// =======================================================
// EVENT LISTENERS
// =======================================================
// Initialization
langSelect.value = 'en';
langSelect.addEventListener('change', (event) => {
updateText(event.target.value);
playClickSound();
});
updateText(langSelect.value);
showState("drop");
// Ko-fi Link
document.getElementById('kofi-mc-btn').addEventListener('click', (e) => {
e.preventDefault();
window.open('https://ko-fi.com/V7V61KZ9FL', '_blank');
playClickSound();
});
// Upload Drag/Drop/Select
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(ev => {
dropArea.addEventListener(ev, e => { e.preventDefault(); e.stopPropagation(); });
});
['dragenter', 'dragover'].forEach(ev => dropArea.addEventListener(ev, () => dropArea.classList.add('highlight')));
['dragleave', 'drop'].forEach(ev => dropArea.addEventListener(ev, () => dropArea.classList.remove('highlight')));
dropArea.addEventListener('drop', e => {
handleFile(e.dataTransfer.files[0]);
playClickSound();
});
fileInput.addEventListener('change', e => {
handleFile(e.target.files[0]);
playClickSound();
});
// Accessibility Fix: Keyboard listener
dropArea.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
fileInput.click();
playClickSound();
}
});
// Actions
removeButton.addEventListener('click', () => {
showState("drop");
playClickSound();
});
downloadButton.addEventListener('click', () => {
processSkinAndCreateZip();
playClickSound();
});
// Details Toggle
toggleDetailsBtn.addEventListener('click', () => {
playClickSound();
const isVisible = detailsContainer.style.display === 'flex';
// 1. Change the state of the container
detailsContainer.style.display = isVisible ? 'none' : 'flex';
// 2. Update the button text based on the new state
toggleDetailsBtn.textContent = isVisible
? translations[langSelect.value].toggleBtnText
: translations[langSelect.value].toggleBtnTextAlt;
});
// Privacy Modal
privacyLink.addEventListener('click', (e) => {
e.preventDefault();
privacyModal.style.display = 'flex';
playClickSound();
});
modalCloseBtn.addEventListener('click', () => {
privacyModal.style.display = 'none';
playClickSound();
});
window.addEventListener('click', (e) => {
if (e.target === privacyModal) {
privacyModal.style.display = 'none';
playClickSound();
}
});
// =======================================================
// SECRET FEATURE (EASTER EGG)
// =======================================================
// 1. Function that CREATES and INITIALIZES the YouTube Player
function initializePlayer() {
if (typeof YT === 'undefined' || typeof YT.Player !== 'function') {
console.error("YouTube IFrame API not loaded.");
return;
}
player = new YT.Player('secret-feature-player', {
videoId: 'VqAGrH-qVwE',
playerVars: {
'autoplay': 1,
'rel': 0,
'showinfo': 0,
'modestbranding': 1
},
events: {
'onStateChange': onPlayerStateChange
}
});
}
// 2. Flag to check if the API is ready.
window.onYouTubeIframeAPIReady = () => {
isYouTubeApiReady = true;
}
document.addEventListener('keydown', (e) => {
if (secretFeatureActive) return;
const key = e.key;
// Checks for '1337' sequence (L33T)
if (key === '1' || key === '3' || key === '7') {
sequence += key;
if (sequence.includes('1337')) {
// Logic to OPEN the Modal
secretFeatureOverlay.style.display = 'flex';
secretFeatureActive = true;
sequence = '';
// Initialize the player ONLY the first time
if (!player && isYouTubeApiReady) {
initializePlayer();
} else if (player) {
player.playVideo();
}
}
} else {
sequence = '';
}
});
function onPlayerStateChange(event) {
// Closes if video ends
if (event.data === YT.PlayerState.ENDED) { closeSecretFeature(); }
}
secretFeatureCloseButton.addEventListener('click', () => closeSecretFeature());
function closeSecretFeature() {
secretFeatureOverlay.style.display = 'none';
secretFeatureActive = false;
if (player) {
player.stopVideo();
}
}
</script>
</body>
</html>