Mudanças entre as edições de "Widget:Droflax"
Ir para navegação
Ir para pesquisar
| Linha 3: | Linha 3: | ||
<div class="personaje-topbar"> | <div class="personaje-topbar"> | ||
<div class="personaje-nome-box"> | <div class="personaje-nome-box"> | ||
<img src="/images/6/63/Franky_ts_medal.png" class="topbar-icon"> | <img src="/images/6/63/Franky_ts_medal.png" class="topbar-icon" alt="Ícono"> | ||
<div class="personaje-nome-category"> | <div class="personaje-nome-category"> | ||
<div class="nome"></div> | <div class="nome"></div> | ||
| Linha 9: | Linha 9: | ||
</div> | </div> | ||
</div> | </div> | ||
<div class="topbar-description">Franky (TS) é um personagem do tier diamante.</div> | |||
</div> | </div> | ||
<div class="personaje-tabs"> | <div class="personaje-tabs"> | ||
<button class="tab-btn" data-tab="arma">Arma</button> | <button class="tab-btn" data-tab="arma">Arma</button> | ||
| Linha 27: | Linha 27: | ||
</div> | </div> | ||
</div> | </div> | ||
<div class="tab-content" id="skins"></div> | |||
<div class="tab-content" id="skins"> | |||
</div> | </div> | ||
| Linha 35: | Linha 33: | ||
(function () { | (function () { | ||
const dataEl = document.getElementById('persona-data'); | const dataEl = document.getElementById('persona-data'); | ||
if (!dataEl) | if (!dataEl) return console.error('Persona widget: no se encontró #persona-data'); | ||
// | // Extracción de datos optimizada | ||
const nome = | const { nome = '', tier = '', classe = '', image = '', habilidadesRaw = '', skinsRaw = '' } = dataEl.dataset; | ||
const rawHabs = habilidadesRaw.replace(/<!--[\s\S]*?-->/g, '').trim(); | |||
const rawSkins = skinsRaw.replace(/<!--[\s\S]*?-->/g, '').trim(); | |||
// Procesamiento de habilidades | |||
const habilidades = rawHabs.split('||').filter(Boolean).map(line => { | |||
const habData = {}; | const habData = {}; | ||
line.split('|').filter(Boolean).forEach(part => { | |||
const [key, ...valParts] = part.split('='); | const [key, ...valParts] = part.split('='); | ||
if ( | if (key && valParts.length) habData[key.trim()] = valParts.join('=').trim(); | ||
}); | }); | ||
const { nome, icon, level, desc = '', atr, video = '' } = habData; | const { nome, icon, level, desc = '', atr, video = '' } = habData; | ||
if (!nome || !icon || !level || !atr) { | |||
if (nome | return console.warn("Habilidad omitida por falta de campos obligatorios:", line), null; | ||
console.warn("Habilidad omitida por falta de campos obligatorios:", line); | |||
} | } | ||
return { | |||
nome, icon, level: parseInt(level), | |||
descripcion: desc.replace(/'''(.*?)'''/g, '<b>$1</b>'), | |||
atributos: atr, video | |||
}; | |||
}).filter(Boolean); | |||
} | |||
// Procesamiento de skins | |||
const skins = rawSkins.split('||').filter(Boolean).map(line => { | |||
const obj = {}; | const obj = {}; | ||
line.split('|').forEach(part => { | line.split('|').filter(Boolean).forEach(part => { | ||
const [key, ...rest] = part.split('='); | const [key, ...rest] = part.split('='); | ||
if (key && rest.length) | if (key && rest.length) obj[key.trim()] = rest.join('=').trim(); | ||
}); | }); | ||
return obj.image && obj.tooltip ? { image: obj.image, tooltip: obj.tooltip } : | |||
(console.error("Error en la skin (falta image o tooltip):", line), null); | |||
}).filter(Boolean); | |||
// Asignación de tier | |||
const tierClass = ({ | |||
'bronze': 'tier-bronze', 'bronce': 'tier-bronze', | |||
'silver': 'tier-silver', 'prata': 'tier-silver', | |||
'gold': 'tier-gold', 'ouro': 'tier-gold', | |||
}) | 'diamond': 'tier-diamond', 'diamante': 'tier-diamond' | ||
})[tier.toLowerCase()] || ''; | |||
// Actualización del DOM | |||
document.querySelector('.nome').textContent = nome; | document.querySelector('.nome').textContent = nome; | ||
document.querySelector('img.art-personaje').src = image; | document.querySelector('img.art-personaje').src = image; | ||
if (tierClass) document.querySelector('.personaje-box').classList.add(tierClass); | |||
// Manejo de pestañas | |||
document.querySelectorAll('.tab-btn').forEach(btn => { | |||
btn.addEventListener('click', () => { | btn.addEventListener('click', () => { | ||
document.querySelectorAll('.tab-btn, .tab-content').forEach(el => | |||
el.classList.remove('active')); | |||
btn.classList.add('active'); | btn.classList.add('active'); | ||
document.getElementById(btn.dataset.tab).classList.add('active'); | document.getElementById(btn.dataset.tab).classList.add('active'); | ||
| Linha 218: | Linha 93: | ||
}); | }); | ||
// Renderización de skins | |||
// | |||
document.getElementById('skins').innerHTML = generarHTMLSkins(skins); | document.getElementById('skins').innerHTML = generarHTMLSkins(skins); | ||
activarFlechasCarrusel(); | activarFlechasCarrusel(); | ||
// | // Renderización de habilidades | ||
const cuadrosContainer = document.querySelector('.cuadros-container'); | const cuadrosContainer = document.querySelector('.cuadros-container'); | ||
const descripcionContainer = | const [descripcionContainer, videoContainer] = [ | ||
'.descripcion-container', '.video-container' | |||
].map(sel => document.querySelector(sel)); | |||
habilidades. | const cuadros = habilidades.map(hab => { | ||
const div = document.createElement('div'); | const div = document.createElement('div'); | ||
div.className = 'cuadro'; | div.className = 'cuadro'; | ||
div.innerHTML = `<img src="${hab.icon}" alt="${hab.nome}" | div.innerHTML = `<img src="${hab.icon}" alt="${hab.nome}" loading="lazy">`; | ||
div.title = hab.nome; | div.title = hab.nome; | ||
div.addEventListener('click', () => { | div.addEventListener('click', () => { | ||
descripcionContainer.innerHTML = `<div class="titulo-habilidad"> | descripcionContainer.innerHTML = ` | ||
<div class="titulo-habilidad"> | |||
<h3>${hab.nome}</h3> | |||
<div class="tooltip-container"> | |||
<button class="info-btn">i</button> | |||
<span class="tooltip-text"> | |||
Información adicional sobre la habilidad, consejos o efectos especiales. | |||
</span> | |||
</div> | |||
</div> | </div> | ||
${generarHTMLAtributos(hab.atributos)} | |||
<div class="desc">${hab.descripcion}</div>`; | |||
videoContainer.innerHTML = hab.video ? ` | |||
<video width="100%" controls playsinline> | |||
<source src="${hab.video}" type="video/webm"> | |||
</video>` : ''; | |||
cuadros.forEach(c => c.classList.remove('activo')); | cuadros.forEach(c => c.classList.remove('activo')); | ||
div.classList.add('activo'); | div.classList.add('activo'); | ||
}); | }); | ||
return div; | |||
}); | }); | ||
cuadros.forEach(c => cuadrosContainer.appendChild(c)); | |||
if (cuadros.length) cuadros[0].click(); | if (cuadros.length) cuadros[0].click(); | ||
// Funciones auxiliares | |||
function generarHTMLAtributos(str) { | function generarHTMLAtributos(str) { | ||
const vals = str.split(',').map(v => v.trim()) | const [vals, labels, icons] = [ | ||
str.split(',').map(v => v.trim()), | |||
['Poder PVE', 'Poder PVP', 'Energía', 'Recarga'], | |||
[ | |||
'/images/7/7a/Icon-pve.png', | |||
'/images/5/5f/Icon-pvp.png', | |||
'/images/3/38/Icon-energy.png', | |||
'/images/b/b1/Icon-cooldown.png' | |||
] | |||
]; | ]; | ||
return ` | |||
return `<div class="attribute--cardsContainer">${vals.map((v, i) => { | |||
let f = v === '-' ? '-' : parseInt(v); | let f = v === '-' ? '-' : parseInt(v); | ||
if (i === 1 && !isNaN(f)) f = (f > 0 ? '+' : '') + f; | if (i === 1 && !isNaN(f)) f = (f > 0 ? '+' : '') + f; | ||
return ` | return `<span class="simple-tooltip" data-tooltip="<p><b>${labels[i]}</b></p>"> | ||
<div class="cardAttribute"> | <div class="cardAttribute"> | ||
<img src="${icons[i]}" class="cardAttribute--icon" loading="lazy"> | |||
<h2 class="cardAttribute--value">${f}${i === 0 && f !== '-' ? ' seg' : ''}</h2> | |||
</div> | </div> | ||
</span>`; | |||
}).join('')} | }).join('')}</div>`; | ||
} | } | ||
function generarHTMLSkins(lista) { | function generarHTMLSkins(lista) { | ||
return ` | return `<div class="card-skins"> | ||
<span class="card-skins-title">SKINS & SPOTLIGHTS</span> | <span class="card-skins-title">SKINS & SPOTLIGHTS</span> | ||
<div class="skins-carousel-wrapper"> | <div class="skins-carousel-wrapper"> | ||
<button class="skins-arrow left">«</button> | <button class="skins-arrow left">«</button> | ||
<div class="skins-carousel"> | <div class="skins-carousel"> | ||
${lista.map(skin => `<div class="skin-card"> | |||
<img class="skins--imageBanner" src="https://one-piece-artworks.com/app/view/assets/img/geNiZAK" alt="banner" loading="lazy"> | |||
<img class="skins--imageSkin" src="${skin.image}" alt="skin" loading="lazy"> | |||
</div>`).join('')} | |||
</div> | |||
</div> | </div> | ||
<button class="skins-arrow right">»</button> | <button class="skins-arrow right">»</button> | ||
</div> | </div> | ||
</div>`; | |||
} | |||
function activarFlechasCarrusel() { | |||
const carousel = document.querySelector('.skins-carousel'); | |||
const [leftBtn, rightBtn] = ['.skins-arrow.left', '.skins-arrow.right'].map(sel => | |||
document.querySelector(sel)); | |||
const getScrollAmount = () => carousel.clientWidth * 0.6; | |||
const updateArrows = (scrollLeft) => { | |||
const maxScrollLeft = carousel.scrollWidth - carousel.clientWidth; | |||
const hasLeft = scrollLeft > 5; | |||
const hasRight = scrollLeft < maxScrollLeft - 5; | |||
[leftBtn, rightBtn].forEach((btn, i) => { | |||
btn.style.display = [hasLeft, hasRight][i] ? 'inline-block' : 'none'; | |||
}); | |||
carousel.parentElement.classList.toggle('has-left', hasLeft); | |||
carousel.parentElement.classList.toggle('has-right', hasRight); | |||
}; | |||
const handleArrowClick = (direction) => { | |||
const scrollLeft = carousel.scrollLeft; | |||
const maxScrollLeft = carousel.scrollWidth - carousel.clientWidth; | |||
const nextScroll = direction === 'left' ? | |||
Math.max(0, scrollLeft - getScrollAmount()) : | |||
Math.min(maxScrollLeft, scrollLeft + getScrollAmount()); | |||
carousel.scrollTo({ left: nextScroll, behavior: 'smooth' }); | |||
updateArrows(nextScroll); | |||
}; | |||
leftBtn.addEventListener('click', () => handleArrowClick('left')); | |||
rightBtn.addEventListener('click', () => handleArrowClick('right')); | |||
carousel.addEventListener('scroll', () => updateArrows(carousel.scrollLeft)); | |||
new ResizeObserver(() => updateArrows(carousel.scrollLeft)).observe(carousel); | |||
updateArrows(carousel.scrollLeft); | |||
} | } | ||
cuadrosContainer.addEventListener('wheel', (e) => { | cuadrosContainer.addEventListener('wheel', (e) => { | ||
if (e.deltaY | if (e.deltaY) { | ||
e.preventDefault(); | e.preventDefault(); | ||
cuadrosContainer.scrollLeft += e.deltaY; | cuadrosContainer.scrollLeft += e.deltaY; | ||
} | } | ||
}); | }); | ||
dataEl.remove(); | dataEl.remove(); | ||
})(); | })(); | ||
</script> | </script> | ||
<style> | <style> | ||
.personaje-box { | .personaje-box { | ||
padding: 16px; | padding: 16px; | ||
color: # | color: #000; | ||
font-family: 'Segoe UI', sans-serif; | font-family: 'Segoe UI', sans-serif; | ||
width: 90%; | width: 90%; | ||
margin: auto; | margin: auto; | ||
} | |||
.personaje-header { | |||
display: flex; | |||
flex-direction: column; | |||
gap: 10px; | |||
} | } | ||
| Linha 377: | Linha 262: | ||
.nome { | .nome { | ||
font | font: 900 60px/1 'Orbitron', sans-serif; | ||
} | } | ||
| Linha 388: | Linha 271: | ||
width: fit-content; | width: fit-content; | ||
padding-inline: 16px; | padding-inline: 16px; | ||
border | border-radius: 0 10px 10px 0; | ||
} | } | ||
| Linha 405: | Linha 280: | ||
top: 0.8%; | top: 0.8%; | ||
z-index: 9; | z-index: 9; | ||
} | } | ||
.personaje-tabs { | .personaje-tabs { | ||
margin | margin: 4px 0 4px 8px; | ||
display: flex; | display: flex; | ||
gap: 12px; | gap: 12px; | ||
justify-content: flex-start; | justify-content: flex-start; | ||
} | } | ||
| Linha 442: | Linha 306: | ||
.tab-content { | .tab-content { | ||
display: none; | display: none; | ||
background: #26211cd6; | background: #26211cd6; | ||
padding | padding: 0 8px 8px; | ||
} | } | ||
| Linha 472: | Linha 334: | ||
width: 56%; | width: 56%; | ||
overflow-x: auto; | overflow-x: auto; | ||
padding: 10px 0 3px 1px; | |||
padding | |||
scrollbar-width: thin; | scrollbar-width: thin; | ||
scrollbar-color: #ababab transparent; | scrollbar-color: #ababab transparent; | ||
margin-bottom: 6px; | margin-bottom: 6px; | ||
scroll-behavior: smooth; | scroll-behavior: smooth; | ||
} | } | ||
| Linha 484: | Linha 343: | ||
.cuadros-container::-webkit-scrollbar { | .cuadros-container::-webkit-scrollbar { | ||
height: 6px; | height: 6px; | ||
} | } | ||
| Linha 495: | Linha 350: | ||
} | } | ||
.cuadro { | |||
flex: 0 0 auto; | flex: 0 0 auto; | ||
width: 50px; | width: 50px; | ||
| Linha 504: | Linha 359: | ||
} | } | ||
.cuadro.activo { | |||
box-shadow: 0 0 10px 3px rgba(255, 255, 0, 0.5); | box-shadow: 0 0 10px 3px rgba(255, 255, 0, 0.5); | ||
border: 1px solid #FFD700; | border: 1px solid #FFD700; | ||
| Linha 542: | Linha 397: | ||
width: 44px; | width: 44px; | ||
height: 44px; | height: 44px; | ||
font | font: bold 40px/24px 'Noto Sans'; | ||
cursor: pointer; | cursor: pointer; | ||
transition: 0.2s; | transition: 0.2s; | ||
box-shadow: 0 0 3px # | box-shadow: 0 0 3px #000; | ||
text-align: center; | text-align: center; | ||
} | } | ||
| Linha 575: | Linha 427: | ||
visibility: visible; | visibility: visible; | ||
opacity: 1; | opacity: 1; | ||
} | } | ||
| Linha 594: | Linha 432: | ||
min-height: 25.1rem; | min-height: 25.1rem; | ||
max-height: 50%; | max-height: 50%; | ||
padding: 4px 16px !important; | padding: 4px 16px 20px !important; | ||
background: #26211C; | background: #26211C; | ||
border-radius: 8px; | border-radius: 8px; | ||
position: relative; | position: relative; | ||
box-shadow: 0 0 7px rgba(255, 255, 255, 0.82), 0 0 5px rgba(255, 255, 255, 0.96); | |||
box-shadow: 0 0 7px | |||
color: #fff; | color: #fff; | ||
backdrop-filter: blur(2px); | backdrop-filter: blur(2px); | ||
transition: all 0.3s ease; | transition: all 0.3s ease; | ||
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; | |||
text-shadow: | |||
} | } | ||
.desc { | .desc { | ||
overflow-y: auto | overflow-y: auto; | ||
max-height: inherit; | max-height: inherit; | ||
margin | margin: 10px 0 0; | ||
} | } | ||
.desc, | |||
.desc * { | .desc * { | ||
font-size: inherit !important; | font-size: inherit !important; | ||
line-height: inherit; | line-height: inherit; | ||
} | } | ||
| Linha 715: | Linha 462: | ||
justify-content: center; | justify-content: center; | ||
background-color: #000; | background-color: #000; | ||
border-radius: 2%; | border-radius: 2%; | ||
box-shadow: 0 0 7px | box-shadow: 0 0 7px rgba(255, 255, 255, 0.82), 0 0 5px rgba(255, 255, 255, 0.96); | ||
z-index: 999; | z-index: 999; | ||
} | } | ||
| Linha 728: | Linha 472: | ||
gap: 20px; | gap: 20px; | ||
flex-wrap: wrap; | flex-wrap: wrap; | ||
} | } | ||
| Linha 745: | Linha 487: | ||
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); | box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); | ||
transition: transform 0.2s; | transition: transform 0.2s; | ||
border: 1px solid | border: 1px solid rgba(0, 0, 0, 0.28); | ||
} | } | ||
| Linha 754: | Linha 496: | ||
.cardAttribute--value { | .cardAttribute--value { | ||
font | font: bold 14px/1 sans-serif; | ||
margin: 0; | |||
margin: 0 | |||
color: white; | color: white; | ||
} | } | ||
.attribute-title, | .attribute-title, | ||
.card-skins-title { | .card-skins-title { | ||
font | font: 1.4em/1 sans-serif; | ||
text-align: center; | text-align: center; | ||
letter-spacing: 1px; | letter-spacing: 1px; | ||
border-bottom: 2px solid #9d9c9c; | border-bottom: 2px solid #9d9c9c; | ||
color: white !important; | color: white !important; | ||
| Linha 781: | Linha 519: | ||
} | } | ||
.skins-carousel-wrapper::before { | .skins-carousel-wrapper { | ||
min-height: 21.1rem; | |||
max-height: 60%; | |||
padding: 4px 16px 20px !important; | |||
background: #26211C; | |||
border-radius: 8px; | |||
position: relative; | |||
box-shadow: 0 0 7px rgba(255, 255, 255, 0.82), 0 0 5px rgba(255, 255, 255, 0.96); | |||
color: #fff; | |||
backdrop-filter: blur(2px); | |||
display: flex; | |||
gap: 10px; | |||
justify-content: center; | |||
align-items: center; | |||
z-index: 99; | |||
} | |||
.skins-carousel-wrapper::before, | |||
.skins-carousel-wrapper::after { | |||
content: ''; | content: ''; | ||
position: absolute; | position: absolute; | ||
top: 0; | top: 0; | ||
width: 60px; | width: 60px; | ||
height: 100%; | height: 100%; | ||
pointer-events: none; | pointer-events: none; | ||
transition: opacity 0.4s ease; | transition: opacity 0.4s ease; | ||
z-index: 3; | z-index: 3; | ||
} | } | ||
.skins-carousel-wrapper | .skins-carousel-wrapper::before { | ||
opacity: | left: 0; | ||
background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%); | |||
opacity: 0; | |||
} | } | ||
.skins-carousel-wrapper::after { | .skins-carousel-wrapper::after { | ||
right: 0; | right: 0; | ||
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%); | background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%); | ||
opacity: 0; | opacity: 0; | ||
} | } | ||
.skins-carousel-wrapper.has-left::before, | |||
.skins-carousel-wrapper.has-right::after { | .skins-carousel-wrapper.has-right::after { | ||
opacity: 1; | opacity: 1; | ||
} | } | ||
| Linha 894: | Linha 572: | ||
padding: 10px 0; | padding: 10px 0; | ||
flex-grow: 1; | flex-grow: 1; | ||
-ms-overflow-style: none; | |||
scrollbar-width: none; | |||
} | } | ||
.skins-carousel::-webkit-scrollbar { | .skins-carousel::-webkit-scrollbar { | ||
| Linha 925: | Linha 588: | ||
border-radius: 8px; | border-radius: 8px; | ||
overflow: hidden; | overflow: hidden; | ||
box-shadow: 0 0 8px | box-shadow: 0 0 8px rgba(0, 242, 255, 0.44); | ||
background: #111; | background: #111; | ||
} | } | ||
| Linha 984: | Linha 647: | ||
} | } | ||
.tier-diamond .personaje-header { | |||
. | background: | ||
linear-gradient(145deg, rgba(160, 250, 255, 0.2), rgba(80, 180, 200, 0.5)), | |||
url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='15,2 18,11 28,11 20,17 23,27 15,21 7,27 10,17 2,11 12,11' fill='%23ffffff' fill-opacity='0.25'/%3E%3C/svg%3E"); | |||
background-color: #4b8292; | |||
background-blend-mode: soft-light; | |||
background-size: 45px 45px; | |||
box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.1), 0 0 15px rgba(100, 255, 255, 0.25); | |||
animation: moveStars 5s linear infinite; | |||
padding-bottom: 10px; | |||
position: relative; | |||
overflow: hidden; | |||
} | } | ||
@keyframes glow { | |||
0%, | 0%, | ||
100% { | 100% { | ||
box-shadow: | box-shadow: 0 0 2px 1px rgba(255, 255, 0, 0.35); | ||
} | } | ||
50% { | 50% { | ||
box-shadow: | box-shadow: 0 0 4px 2px rgba(255, 255, 0, 0.7); | ||
} | } | ||
} | } | ||
| Linha 1 022: | Linha 680: | ||
100% { | 100% { | ||
background-position: 90px -90px; | background-position: 90px -90px; | ||
} | } | ||
} | } | ||
@media (max-aspect-ratio: 3/4) { | @media (max-aspect-ratio: 3/4) { | ||
.habilidades-container { | .habilidades-container { | ||
flex-direction: column-reverse; | flex-direction: column-reverse; | ||
} | } | ||
.habilidades-details { | .habilidades-details { | ||
width: 96%; | width: 96%; | ||
align-self: center; | align-self: center; | ||
| Linha 1 070: | Linha 695: | ||
.video-container { | .video-container { | ||
width: 80%; | width: 80%; | ||
border-radius: 3%; | border-radius: 3%; | ||
margin-top: 2%; | margin-top: 2%; | ||
| Linha 1 086: | Linha 705: | ||
} | } | ||
. | .tab-btn { | ||
font-size: 30px; | font-size: 30px; | ||
padding: 14px 22px; | |||
} | } | ||
.cuadro { | |||
width: 80px; | width: 80px; | ||
height: 80px; | height: 80px; | ||
| Linha 1 103: | Linha 717: | ||
.personaje-box { | .personaje-box { | ||
padding: 32px; | padding: 32px; | ||
} | |||
.descripcion-container { | |||
padding: 22px !important; | |||
} | } | ||
| Linha 1 110: | Linha 728: | ||
} | } | ||
. | .desc { | ||
font-size: | font-size: 30px; | ||
line-height: 1.5; | |||
width: 100%; | |||
} | } | ||
} | } | ||
</style> | </style> | ||
Edição das 18h18min de 19 de julho de 2025
<button class="tab-btn" data-tab="arma">Arma</button>
<button class="tab-btn active" data-tab="habilidades">Habilidades</button>
<button class="tab-btn" data-tab="skins">Skins</button>
<img class="art-personaje" alt="Arte del personaje">
<script type="text/javascript">
(function () {
const dataEl = document.getElementById('persona-data');
if (!dataEl) return console.error('Persona widget: no se encontró #persona-data');
// Extracción de datos optimizada
const { nome = , tier = , classe = , image = , habilidadesRaw = , skinsRaw = } = dataEl.dataset;
const rawHabs = habilidadesRaw.replace(//g, ).trim();
const rawSkins = skinsRaw.replace(//g, ).trim();
// Procesamiento de habilidades
const habilidades = rawHabs.split('||').filter(Boolean).map(line => {
const habData = {};
line.split('|').filter(Boolean).forEach(part => {
const [key, ...valParts] = part.split('=');
if (key && valParts.length) habData[key.trim()] = valParts.join('=').trim();
});
const { nome, icon, level, desc = , atr, video = } = habData;
if (!nome || !icon || !level || !atr) {
return console.warn("Habilidad omitida por falta de campos obligatorios:", line), null;
}
return {
nome, icon, level: parseInt(level),
descripcion: desc.replace(/(.*?)/g, '$1'),
atributos: atr, video
};
}).filter(Boolean);
// Procesamiento de skins
const skins = rawSkins.split('||').filter(Boolean).map(line => {
const obj = {};
line.split('|').filter(Boolean).forEach(part => {
const [key, ...rest] = part.split('=');
if (key && rest.length) obj[key.trim()] = rest.join('=').trim();
});
return obj.image && obj.tooltip ? { image: obj.image, tooltip: obj.tooltip } :
(console.error("Error en la skin (falta image o tooltip):", line), null);
}).filter(Boolean);
// Asignación de tier
const tierClass = ({
'bronze': 'tier-bronze', 'bronce': 'tier-bronze',
'silver': 'tier-silver', 'prata': 'tier-silver',
'gold': 'tier-gold', 'ouro': 'tier-gold',
'diamond': 'tier-diamond', 'diamante': 'tier-diamond'
})[tier.toLowerCase()] || ;
// Actualización del DOM
document.querySelector('.nome').textContent = nome;
document.querySelector('img.art-personaje').src = image;
if (tierClass) document.querySelector('.personaje-box').classList.add(tierClass);
// Manejo de pestañas
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.tab-btn, .tab-content').forEach(el =>
el.classList.remove('active'));
btn.classList.add('active');
document.getElementById(btn.dataset.tab).classList.add('active');
});
});
// Renderización de skins
document.getElementById('skins').innerHTML = generarHTMLSkins(skins);
activarFlechasCarrusel();
// Renderización de habilidades
const cuadrosContainer = document.querySelector('.cuadros-container');
const [descripcionContainer, videoContainer] = [
'.descripcion-container', '.video-container'
].map(sel => document.querySelector(sel));
const cuadros = habilidades.map(hab => {
const div = document.createElement('div');
div.className = 'cuadro';
div.innerHTML = `<img src="${hab.icon}" alt="${hab.nome}" loading="lazy">`;
div.title = hab.nome;
div.addEventListener('click', () => {
descripcionContainer.innerHTML = `
${hab.nome}
<button class="info-btn">i</button>
Información adicional sobre la habilidad, consejos o efectos especiales.
${generarHTMLAtributos(hab.atributos)}
${hab.descripcion}
`;
videoContainer.innerHTML = hab.video ? `
<video width="100%" controls playsinline>
<source src="${hab.video}" type="video/webm">
</video>` : ;
cuadros.forEach(c => c.classList.remove('activo'));
div.classList.add('activo');
});
return div;
});
cuadros.forEach(c => cuadrosContainer.appendChild(c));
if (cuadros.length) cuadros[0].click();
// Funciones auxiliares
function generarHTMLAtributos(str) {
const [vals, labels, icons] = [
str.split(',').map(v => v.trim()),
['Poder PVE', 'Poder PVP', 'Energía', 'Recarga'],
[
'/images/7/7a/Icon-pve.png',
'/images/5/5f/Icon-pvp.png',
'/images/3/38/Icon-energy.png',
'/images/b/b1/Icon-cooldown.png'
]
];
return `
${vals.map((v, i) => {
let f = v === '-' ? '-' : parseInt(v);
if (i === 1 && !isNaN(f)) f = (f > 0 ? '+' : ) + f;
return `<span class="simple-tooltip" data-tooltip="${labels[i]}
"> <img src="${icons[i]}" class="cardAttribute--icon" loading="lazy">
${f}${i === 0 && f !== '-' ? ' seg' : }
`;}).join()}
`;
}
function generarHTMLSkins(lista) {
return `
SKINS & SPOTLIGHTS
<button class="skins-arrow left">«</button>
${lista.map(skin => `
`).join()}
<img class="skins--imageBanner" src="https://one-piece-artworks.com/app/view/assets/img/geNiZAK" alt="banner" loading="lazy"> <img class="skins--imageSkin" src="${skin.image}" alt="skin" loading="lazy">
<button class="skins-arrow right">»</button>
`;
}
function activarFlechasCarrusel() {
const carousel = document.querySelector('.skins-carousel');
const [leftBtn, rightBtn] = ['.skins-arrow.left', '.skins-arrow.right'].map(sel =>
document.querySelector(sel));
const getScrollAmount = () => carousel.clientWidth * 0.6;
const updateArrows = (scrollLeft) => {
const maxScrollLeft = carousel.scrollWidth - carousel.clientWidth;
const hasLeft = scrollLeft > 5;
const hasRight = scrollLeft < maxScrollLeft - 5;
[leftBtn, rightBtn].forEach((btn, i) => {
btn.style.display = [hasLeft, hasRight][i] ? 'inline-block' : 'none';
});
carousel.parentElement.classList.toggle('has-left', hasLeft);
carousel.parentElement.classList.toggle('has-right', hasRight);
};
const handleArrowClick = (direction) => {
const scrollLeft = carousel.scrollLeft;
const maxScrollLeft = carousel.scrollWidth - carousel.clientWidth;
const nextScroll = direction === 'left' ?
Math.max(0, scrollLeft - getScrollAmount()) :
Math.min(maxScrollLeft, scrollLeft + getScrollAmount());
carousel.scrollTo({ left: nextScroll, behavior: 'smooth' });
updateArrows(nextScroll);
};
leftBtn.addEventListener('click', () => handleArrowClick('left'));
rightBtn.addEventListener('click', () => handleArrowClick('right'));
carousel.addEventListener('scroll', () => updateArrows(carousel.scrollLeft));
new ResizeObserver(() => updateArrows(carousel.scrollLeft)).observe(carousel);
updateArrows(carousel.scrollLeft);
}
cuadrosContainer.addEventListener('wheel', (e) => {
if (e.deltaY) {
e.preventDefault();
cuadrosContainer.scrollLeft += e.deltaY;
}
});
dataEl.remove(); })();
</script> <style>
.personaje-box {
padding: 16px;
color: #000;
font-family: 'Segoe UI', sans-serif;
width: 90%;
margin: auto;
}
.personaje-header {
display: flex;
flex-direction: column;
gap: 10px;
}
.personaje-topbar {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 8px 16px;
}
.personaje-nome-box {
display: flex;
align-items: center;
gap: 8px;
}
.topbar-icon {
width: 90px;
height: 90px;
object-fit: none;
background: #60dae2;
}
.nome {
font: 900 60px/1 'Orbitron', sans-serif;
}
.topbar-description {
font-size: 16px;
margin-top: 6px;
background: #6AF3FB;
width: fit-content;
padding-inline: 16px;
border-radius: 0 10px 10px 0;
}
.art-personaje {
width: 665px;
position: absolute;
right: 5%;
top: 0.8%;
z-index: 9;
}
.personaje-tabs {
margin: 4px 0 4px 8px;
display: flex;
gap: 12px;
justify-content: flex-start;
}
.tab-btn {
padding: 8px 20px;
background: #333;
color: white;
border: none;
border-radius: 8px;
font-size: 20px;
cursor: pointer;
}
.tab-btn.active {
background: #156bc7;
font-weight: bold;
}
.tab-content {
display: none;
background: #26211cd6;
padding: 0 8px 8px;
}
.tab-content.active {
display: block;
}
.habilidades-container {
display: flex;
gap: 20px;
}
.habilidades-details {
flex: 1;
display: flex;
flex-direction: column;
gap: 10px;
width: 50%;
justify-content: center;
}
.cuadros-container {
display: flex;
flex-wrap: nowrap;
gap: 10px;
width: 56%;
overflow-x: auto;
padding: 10px 0 3px 1px;
scrollbar-width: thin;
scrollbar-color: #ababab transparent;
margin-bottom: 6px;
scroll-behavior: smooth;
}
.cuadros-container::-webkit-scrollbar {
height: 6px;
}
.cuadros-container::-webkit-scrollbar-thumb {
background-color: #151515;
border-radius: 3px;
}
.cuadro {
flex: 0 0 auto;
width: 50px;
height: 50px;
border-radius: 5px;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.cuadro.activo {
box-shadow: 0 0 10px 3px rgba(255, 255, 0, 0.5);
border: 1px solid #FFD700;
animation: glow 2s ease-in-out infinite;
}
.titulo-habilidad {
position: relative;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 8px;
padding-right: 32px;
}
.titulo-habilidad h3 {
font-size: 1.6em;
color: white;
text-align: center;
margin: 0;
width: 100%;
}
.tooltip-container {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}
.info-btn {
border: none;
color: #D3DBDC;
background-color: #787878;
font-weight: bold;
border-radius: 50%;
width: 44px;
height: 44px;
font: bold 40px/24px 'Noto Sans';
cursor: pointer;
transition: 0.2s;
box-shadow: 0 0 3px #000;
text-align: center;
}
.tooltip-text {
visibility: hidden;
width: 220px;
background-color: #222;
color: #fff;
text-align: left;
padding: 8px 10px;
border-radius: 8px;
position: absolute;
z-index: 10;
bottom: 130%;
left: 50%;
transform: translate(-85%, 110%);
opacity: 0;
transition: opacity 0.3s;
font-size: 12px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
pointer-events: none;
}
.tooltip-container:hover .tooltip-text {
visibility: visible;
opacity: 1;
}
.descripcion-container {
min-height: 25.1rem;
max-height: 50%;
padding: 4px 16px 20px !important;
background: #26211C;
border-radius: 8px;
position: relative;
box-shadow: 0 0 7px rgba(255, 255, 255, 0.82), 0 0 5px rgba(255, 255, 255, 0.96);
color: #fff;
backdrop-filter: blur(2px);
transition: all 0.3s ease;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.desc {
overflow-y: auto;
max-height: inherit;
margin: 10px 0 0;
}
.desc,
.desc * {
font-size: inherit !important;
line-height: inherit;
}
.video-container {
width: 43%;
height: fit-content;
display: flex;
align-items: center;
justify-content: center;
background-color: #000;
border-radius: 2%;
box-shadow: 0 0 7px rgba(255, 255, 255, 0.82), 0 0 5px rgba(255, 255, 255, 0.96);
z-index: 999;
}
.attribute--cardsContainer {
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
}
.cardAttribute {
width: 80px;
height: 90px;
background-color: #473838;
border-radius: 8px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
padding: 5px;
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5);
transition: transform 0.2s;
border: 1px solid rgba(0, 0, 0, 0.28);
}
.cardAttribute--icon {
height: 28px;
margin-bottom: 14px;
}
.cardAttribute--value {
font: bold 14px/1 sans-serif;
margin: 0;
color: white;
}
.attribute-title,
.card-skins-title {
font: 1.4em/1 sans-serif;
text-align: center;
letter-spacing: 1px;
border-bottom: 2px solid #9d9c9c;
color: white !important;
padding-bottom: 8px;
margin-bottom: 16px;
width: 75%;
}
.card-skins {
padding: 16px;
border-radius: 12px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.skins-carousel-wrapper {
min-height: 21.1rem;
max-height: 60%;
padding: 4px 16px 20px !important;
background: #26211C;
border-radius: 8px;
position: relative;
box-shadow: 0 0 7px rgba(255, 255, 255, 0.82), 0 0 5px rgba(255, 255, 255, 0.96);
color: #fff;
backdrop-filter: blur(2px);
display: flex;
gap: 10px;
justify-content: center;
align-items: center;
z-index: 99;
}
.skins-carousel-wrapper::before,
.skins-carousel-wrapper::after {
content: ;
position: absolute;
top: 0;
width: 60px;
height: 100%;
pointer-events: none;
transition: opacity 0.4s ease;
z-index: 3;
}
.skins-carousel-wrapper::before {
left: 0;
background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%);
opacity: 0;
}
.skins-carousel-wrapper::after {
right: 0;
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%);
opacity: 0;
}
.skins-carousel-wrapper.has-left::before,
.skins-carousel-wrapper.has-right::after {
opacity: 1;
}
.skins-carousel {
display: flex;
gap: 16px;
overflow-x: auto;
scroll-behavior: smooth;
padding: 10px 0;
flex-grow: 1;
-ms-overflow-style: none;
scrollbar-width: none;
}
.skins-carousel::-webkit-scrollbar {
display: none;
}
.skin-card {
position: relative;
width: 200px;
height: 320px;
flex: 0 0 auto;
border: 2px solid #697EC9;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 0 8px rgba(0, 242, 255, 0.44);
background: #111;
}
.skin-card::before {
content: ;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
border-radius: inherit;
z-index: 2;
box-shadow: inset 0 0 12px 6px rgba(180, 180, 180, 0.25);
}
.skins--imageBanner {
width: 100%;
height: 109%;
scale: 1.1;
object-fit: cover;
filter: brightness(0.5);
}
.skins--imageSkin {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
height: 140px;
width: auto;
z-index: 2;
transition: transform 0.2s;
}
.skins--imageSkin:hover {
transform: translateX(-50%) scale(1.05);
}
.skins-arrow {
background: none;
border: none;
color: white;
font-size: 36px;
cursor: pointer;
padding: 8px;
z-index: 5;
transition: 0.2s;
}
.skins-arrow.left {
margin-right: 8px;
}
.skins-arrow.right {
margin-left: 8px;
}
.tier-diamond .personaje-header {
background:
linear-gradient(145deg, rgba(160, 250, 255, 0.2), rgba(80, 180, 200, 0.5)),
url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='15,2 18,11 28,11 20,17 23,27 15,21 7,27 10,17 2,11 12,11' fill='%23ffffff' fill-opacity='0.25'/%3E%3C/svg%3E");
background-color: #4b8292;
background-blend-mode: soft-light;
background-size: 45px 45px;
box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.1), 0 0 15px rgba(100, 255, 255, 0.25);
animation: moveStars 5s linear infinite;
padding-bottom: 10px;
position: relative;
overflow: hidden;
}
@keyframes glow {
0%,
100% {
box-shadow: 0 0 2px 1px rgba(255, 255, 0, 0.35);
}
50% {
box-shadow: 0 0 4px 2px rgba(255, 255, 0, 0.7);
}
}
@keyframes moveStars {
0% {
background-position: 0 0;
}
100% {
background-position: 90px -90px;
}
}
@media (max-aspect-ratio: 3/4) {
.habilidades-container {
flex-direction: column-reverse;
}
.habilidades-details {
width: 96%;
align-self: center;
}
.video-container {
width: 80%;
border-radius: 3%;
margin-top: 2%;
}
.art-personaje {
right: 2%;
width: 290px;
top: 1.45vh;
}
.tab-btn {
font-size: 30px;
padding: 14px 22px;
}
.cuadro {
width: 80px;
height: 80px;
}
.personaje-box {
padding: 32px;
}
.descripcion-container {
padding: 22px !important;
}
.descripcion-container h3 {
font-size: 2.5em;
margin-top: -12px;
}
.desc {
font-size: 30px;
line-height: 1.5;
width: 100%;
}
}
</style>