Mudanças entre as edições de "Widget:Teste"

De Wiki Gla
Ir para navegação Ir para pesquisar
m
Etiqueta: Revertido
m
 
(188 revisões intermediárias por 3 usuários não estão sendo mostradas)
Linha 1: Linha 1:
<script>
<style>
(function() {
     .island-grid {
    // Tab switching
        display: flex;
     const buttons = document.querySelectorAll('.character-tab-btn');
         flex-wrap: wrap;
    const contents = document.querySelectorAll('.character-tab-content');
         justify-content: center;
    buttons.forEach(btn => btn.addEventListener('click', () => {
         gap: 10px;
         buttons.forEach(b => b.classList.remove('active'));
         padding: 12px 0;
         contents.forEach(c => c.classList.remove('active'));
     }
         btn.classList.add('active');
         document.getElementById(btn.dataset.tab).classList.add('active');
     }));


     // Carousel arrows (skins)
     .island-banner {
     activateCarouselArrows();
        position: relative;
        width: 380px;
        height: 90px;
        overflow: hidden;
        border-radius: 8px;
        box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 10px;
        cursor: pointer;
        transition: transform 0.15s, box-shadow 0.15s;
        display: block;
        box-sizing: border-box;
     }


     // Ability card click/preview
     .island-banner::before {
    const skillbar = document.querySelector('.character-skillbar');
        content: "";
    const descContainer = document.querySelector('.character-description');
        position: absolute;
    const videoContainer = document.querySelector('.character-video-container');
        top: 0;
    if (skillbar && descContainer) {
        left: 0;
         const skills = [...skillbar.querySelectorAll('.character-skill')];
         right: 0;
         skills.forEach(div => {
         bottom: 0;
            const name = div.dataset.name;
        background: linear-gradient(105deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.1) 70%, transparent 100%);
            const desc = div.dataset.desc ? div.dataset.desc.replace(/'''(.*?)'''/g, '<b>$1</b>') : '';
        pointer-events: none;
            const attr = div.dataset.attr || '';
        z-index: 1;
            const video = div.dataset.video || '';
    }
 
            div.title = name;


            div.addEventListener('click', () => {
    .island-banner:hover {
                descContainer.innerHTML = `
        transform: translateY(-2px);
                    <div class="character-ability-title">
        box-shadow: rgba(0, 0, 0, 0.35) 0px 4px 12px;
                        <h3>${name || ''}</h3>
                        <div class="character-tooltip-container">
                            <button class="character-info-btn">i</button>
                            <span class="character-tooltip-text">
                                Additional info about the ability, tips or special effects.
                            </span>
                        </div>
                    </div>
                    ${generateAttributesHTML(attr)}
                    <div class="desc">${desc}</div>
                `;
                videoContainer.innerHTML = video ? `
                    <video width="100%" controls playsinline>
                        <source src="${video}" type="video/webm">
                    </video>
                ` : '';
                skills.forEach(c => c.classList.remove('active'));
                div.classList.add('active');
            });
            // Limpa data-* pra não poluir o DOM
            ['data-name', 'data-desc', 'data-attr', 'data-video', 'data-index'].forEach(attr => div.removeAttribute(attr));
        });
        // Seleciona a primeira habilidade automaticamente
        if (skills.length) skills[0].click();
     }
     }


     // Permite scroll horizontal do skillbar via roda do mouse
     .island-banner .island-chests {
    if (skillbar) {
        position: absolute;
         skillbar.addEventListener('wheel', e => {
        top: 8px;
            if (e.deltaY) {
         left: 8px;
                e.preventDefault();
        display: flex;
                skillbar.scrollLeft += e.deltaY;
        flex-wrap: wrap;
            }
        gap: 6px;
         });
        z-index: 2;
         pointer-events: none;
     }
     }


     // Oculta o título da página automaticamente
     .island-banner .island-chest-group {
    const heading = document.querySelector('.firstHeading') || document.querySelector('.mw-first-heading');
         position: relative;
    if (heading) heading.style.display = 'none';
         display: inline-block;
 
    // Faz a ficha ocupar toda a largura
    ['.mw-body', '.mw-body-content', '.mw-content-ltr'].forEach(sel => {
         document.querySelectorAll(sel).forEach(el => {
            el.style.width = '100vw';
            el.style.maxWidth = '100vw';
            el.style.margin = '0';
            el.style.padding = '0';
            el.style.background = 'transparent';
        });
    });
 
    // ========== FUNCTIONS ==========
 
    function activateCarouselArrows() {
         const carousel = document.querySelector('.character-skins-carousel');
        const wrapper = document.querySelector('.character-skins-carousel-wrapper');
        const [leftBtn, rightBtn] = ['.character-skins-arrow.left', '.character-skins-arrow.right'].map(sel => document.querySelector(sel));
        let isPredictingScroll = false;
 
        if (!carousel || !leftBtn || !rightBtn || !wrapper) return;
 
        const getScrollAmount = () => carousel.clientWidth * 0.6;
 
        const hideArrow = btn => {
            if (!btn.classList.contains('disappearing') && btn.style.display !== 'none') {
                btn.classList.add('disappearing');
                setTimeout(() => {
                    btn.style.display = 'none';
                    btn.classList.remove('disappearing');
                }, 300);
            }
        };
 
        const showArrow = btn => {
            if (btn.style.display === 'none') {
                btn.style.display = 'inline-block';
                void btn.offsetWidth;
            }
            btn.classList.remove('disappearing');
        };
 
        const setArrowsState = scrollLeft => {
            const maxScroll = carousel.scrollWidth - carousel.clientWidth;
            const hasLeft = scrollLeft > 5, hasRight = scrollLeft < maxScroll - 5;
            hasLeft ? showArrow(leftBtn) : hideArrow(leftBtn);
            hasRight ? showArrow(rightBtn) : hideArrow(rightBtn);
            wrapper.classList.toggle('has-left', hasLeft);
            wrapper.classList.toggle('has-right', hasRight);
            carousel.style.justifyContent = (!hasLeft && !hasRight) ? 'center' : '';
        };
 
        const handleArrowClick = dir => {
            isPredictingScroll = true;
            const scrollLeft = carousel.scrollLeft, maxScroll = carousel.scrollWidth - carousel.clientWidth;
            const nextScroll = dir === 'left' ? Math.max(0, scrollLeft - getScrollAmount()) : Math.min(maxScroll, scrollLeft + getScrollAmount());
            setArrowsState(nextScroll);
            carousel.scrollTo({ left: nextScroll, behavior: 'smooth' });
 
            let last = -1, still = 0;
            const wait = setInterval(() => {
                const current = Math.round(carousel.scrollLeft);
                if (current === last) {
                    if (++still >= 2) {
                        clearInterval(wait);
                        isPredictingScroll = false;
                        setArrowsState(current);
                    }
                } else {
                    last = current;
                    still = 0;
                }
            }, 50);
        };
 
        carousel.addEventListener('scroll', () => {
            if (!isPredictingScroll) setArrowsState(carousel.scrollLeft);
        });
 
        new ResizeObserver(() => {
            if (!isPredictingScroll) setArrowsState(carousel.scrollLeft);
        }).observe(carousel);
 
        leftBtn.addEventListener('click', () => handleArrowClick('left'));
        rightBtn.addEventListener('click', () => handleArrowClick('right'));
        setArrowsState(carousel.scrollLeft);
     }
     }


     function generateAttributesHTML(str) {
     .island-banner .island-chest-group img {
        if (!str) return '';
        display: block;
        const vals = str.split(',').map(v => v.trim());
        width: auto;
        const title = ['PVE Power','PVP Power','Energy','Cooldown'];
        height: auto;
        return `
            <div class="attribute-cards-container">
                ${vals.map((v, i) => {
                    let f = v === '-' ? '-' : parseInt(v);
                    if (i === 2 && !isNaN(f)) f = (f > 0 ? '+' : '') + f;
                    return `
                        <div class="attribute-card">
                            <span class="attribute-card-title">${title[i]}</span>
                            <h2 class="attribute-card-value">${f}${i === 3 && f !== '-' ? ' sec' : ''}</h2>
                        </div>
                    `;
                }).join('')}
            </div>`;
     }
     }
})();
</script>
<style>
/* Esconde o título da página */
.firstHeading, .mw-first-heading {
    display: none !important;
}
/* Ficha centralizada, não invade lateral da wiki */
.character-box {
    width: 98%;
    max-width: 1200px;
    margin: 20px auto 40px auto;
    background: #222;
    border-radius: 10px;
    box-shadow: 0 4px 32px #000a, 0 1px 8px #2227;
    padding: 0;
    position: relative;
    color: #fff;
    font-family: 'Noto Sans', sans-serif;
}
/* HEADER ESTRELADO */
.character-header {
    background: #4eb9e2 url('https://static.wikia.nocookie.net/onepiece/images/3/38/Background_Effects_Star.png') repeat;
    border-radius: 10px 10px 0 0;
    padding: 16px 24px 8px 16px;
    display: flex;
    align-items: flex-start;
    position: relative;
    min-height: 125px;
}
.character-icon {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    margin-right: 14px;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px #0006;
    background: #333;
}
.character-header-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.character-name {
    font-size: 2.8em;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 0.1em;
    color: #222;
    text-shadow: 1px 2px 0 #fff7, 2px 2px 6px #0003;
    font-family: 'Orbitron', sans-serif;
}
.character-class-list {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}


.character-class {
    .island-banner .island-chest-count {
     font-size: 1em;
    position: absolute;
    left: 0;          /* era right: 0 */
    bottom: 0;
     font-size: 12.5px; /* era 11px */
     font-weight: bold;
     font-weight: bold;
    background: #17a2b8;
     color: #fff;
     color: #fff;
     border-radius: 6px;
    background: rgba(0, 0, 0, 0.75);
     padding: 3px 12px;
    padding: 1px 3px;
     box-shadow: 0 1px 3px #0002;
     border-radius: 3px;
     border: none;
     line-height: 1;
    white-space: nowrap;
     box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
     z-index: 10;
}
}


.character-description-top {
     .island-banner .island-title {
     font-size: 1.08em;
        position: absolute;
    margin-bottom: 2px;
        bottom: 10px;
    color: #333;
        left: 8px;
    background: #bbf7f6;
        font-size: 1.35em;
    padding: 2px 14px;
        font-weight: bold;
    border-radius: 8px;
        color: #fff;
    display: inline-block;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
}
        line-height: 1.2;
 
        z-index: 2;
/* TABS */
        pointer-events: none;
.character-tabs {
        text-transform: uppercase;
    display: flex;
     }
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 6px;
    margin-left: 4px;
}
 
.character-tab-btn {
    padding: 5px 20px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.09em;
    cursor: pointer;
    transition: background 0.15s;
}
 
.character-tab-btn.active {
    background: #156bc7;
    font-weight: bold;
}
 
/* TABS CONTEÚDO */
.character-tab-content {
    display: none;
    background: #232124;
    padding: 20px 10px 18px 14px;
    border-radius: 0 0 10px 10px;
}
 
.character-tab-content.active {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
 
/* HABILIDADES */
.character-skillbar {
    display: flex;
    flex-direction: row;
    gap: 8px;
    background: #232124;
    border-radius: 8px;
    padding: 5px 6px;
    margin-bottom: 7px;
     overflow-x: auto;
    max-width: 92vw;
}


.character-skill {
    @media (max-width: 768px) {
    width: 44px;
        .island-grid {
    height: 44px;
            flex-direction: column;
    border-radius: 5px;
            align-items: stretch;
    background: #222;
        }
    border: 2px solid #fbcc47;
    box-shadow: 0 2px 6px #0004;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


.character-skill.active, .character-skill:hover {
        .island-banner {
    border-color: #f9e98f;
            width: 100%;
    box-shadow: 0 0 8px #FFD70099;
            max-width: none;
    transform: scale(1.08);
        }
}
 
.character-skill-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
 
.character-details {
    background: #231e1c;
    border-radius: 10px;
    box-shadow: 0 1px 4px #0002;
    padding: 22px 18px;
    flex: 1;
    min-width: 320px;
    max-width: 600px;
}
 
.character-ability-title h3 {
    font-size: 2.2em;
    color: #fff;
    margin: 0 0 14px 0;
    font-weight: 700;
}
 
.attribute-cards-container {
    display: flex;
    gap: 18px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
 
.attribute-card {
    background: #33292c;
    border-radius: 7px;
    padding: 6px 12px;
    text-align: center;
    min-width: 90px;
}
 
.attribute-card-title {
    font-size: 0.95em;
    color: #d4d4d4;
    font-weight: bold;
}
 
.attribute-card-value {
    font-size: 1.18em;
    color: #fff;
    font-weight: bold;
}
 
.desc {
    margin-top: 11px;
    color: #f4f4f4;
    font-size: 1.13em;
    line-height: 1.6;
}
 
.character-video-container {
    flex: 1;
    background: #151415;
    border-radius: 10px;
    padding: 0 12px 0 10px;
    box-shadow: 0 1px 6px #0002;
    min-width: 260px;
    max-width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
}
 
.character-video-container video {
    width: 100%;
    border-radius: 8px;
    background: #000;
    box-shadow: 0 2px 7px #0004;
}
 
@media (max-width: 900px) {
    .character-box {
        width: 99vw;
        max-width: 99vw;
        padding: 0;
     }
     }
    .character-header { flex-direction: column; align-items: center; text-align: center; }
    .character-header-right { align-items: center; }
    .character-details, .character-video-container { min-width: 170px; max-width: 100vw; padding: 10px 5px; }
    .character-tab-content.active { flex-direction: column; }
}
</style>
</style>
<script>
    (function () {
        function applyBackgrounds() {
            document.querySelectorAll('.island-banner[data-bgimg]').forEach(function (el) {
                var filename = el.getAttribute('data-bgimg');
                if (!filename) return;
                var url;
                if (typeof mw !== 'undefined' && mw.util && mw.util.getUrl) {
                    url = mw.util.getUrl('Especial:FilePath/' + filename);
                } else {
                    url = '/index.php?title=Especial:FilePath/' + encodeURIComponent(filename);
                }
                el.style.backgroundImage = 'url(' + url + ')';
                el.style.backgroundSize = 'cover';
                el.style.backgroundPosition = 'center';
                el.style.backgroundRepeat = 'no-repeat';
            });
        }
        function initClickable() {
            document.querySelectorAll('.island-banner[data-href]').forEach(function (el) {
                if (el._icClick) return;
                el._icClick = true;
                el.setAttribute('role', 'link');
                el.setAttribute('tabindex', '0');
                el.addEventListener('click', function () {
                    var href = el.getAttribute('data-href');
                    if (href) window.location.href = href;
                });
                el.addEventListener('keydown', function (e) {
                    if (e.key === 'Enter' || e.key === ' ') {
                        e.preventDefault();
                        var href = el.getAttribute('data-href');
                        if (href) window.location.href = href;
                    }
                });
            });
        }
        function run() {
            applyBackgrounds();
            initClickable();
        }
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', run);
        } else {
            run();
        }
    })();
</script>

Edição atual tal como às 00h06min de 13 de março de 2026

<style>

   .island-grid {
       display: flex;
       flex-wrap: wrap;
       justify-content: center;
       gap: 10px;
       padding: 12px 0;
   }
   .island-banner {
       position: relative;
       width: 380px;
       height: 90px;
       overflow: hidden;
       border-radius: 8px;
       box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 10px;
       cursor: pointer;
       transition: transform 0.15s, box-shadow 0.15s;
       display: block;
       box-sizing: border-box;
   }
   .island-banner::before {
       content: "";
       position: absolute;
       top: 0;
       left: 0;
       right: 0;
       bottom: 0;
       background: linear-gradient(105deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.1) 70%, transparent 100%);
       pointer-events: none;
       z-index: 1;
   }
   .island-banner:hover {
       transform: translateY(-2px);
       box-shadow: rgba(0, 0, 0, 0.35) 0px 4px 12px;
   }
   .island-banner .island-chests {
       position: absolute;
       top: 8px;
       left: 8px;
       display: flex;
       flex-wrap: wrap;
       gap: 6px;
       z-index: 2;
       pointer-events: none;
   }
   .island-banner .island-chest-group {
       position: relative;
       display: inline-block;
   }
   .island-banner .island-chest-group img {
       display: block;
       width: auto;
       height: auto;
   }
   .island-banner .island-chest-count {
   position: absolute;
   left: 0;          /* era right: 0 */
   bottom: 0;
   font-size: 12.5px;  /* era 11px */
   font-weight: bold;
   color: #fff;
   background: rgba(0, 0, 0, 0.75);
   padding: 1px 3px;
   border-radius: 3px;
   line-height: 1;
   white-space: nowrap;
   box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
   z-index: 10;

}

   .island-banner .island-title {
       position: absolute;
       bottom: 10px;
       left: 8px;
       font-size: 1.35em;
       font-weight: bold;
       color: #fff;
       text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
       line-height: 1.2;
       z-index: 2;
       pointer-events: none;
       text-transform: uppercase;
   }
   @media (max-width: 768px) {
       .island-grid {
           flex-direction: column;
           align-items: stretch;
       }
       .island-banner {
           width: 100%;
           max-width: none;
       }
   }

</style> <script>

   (function () {
       function applyBackgrounds() {
           document.querySelectorAll('.island-banner[data-bgimg]').forEach(function (el) {
               var filename = el.getAttribute('data-bgimg');
               if (!filename) return;
               var url;
               if (typeof mw !== 'undefined' && mw.util && mw.util.getUrl) {
                   url = mw.util.getUrl('Especial:FilePath/' + filename);
               } else {
                   url = '/index.php?title=Especial:FilePath/' + encodeURIComponent(filename);
               }
               el.style.backgroundImage = 'url(' + url + ')';
               el.style.backgroundSize = 'cover';
               el.style.backgroundPosition = 'center';
               el.style.backgroundRepeat = 'no-repeat';
           });
       }
       function initClickable() {
           document.querySelectorAll('.island-banner[data-href]').forEach(function (el) {
               if (el._icClick) return;
               el._icClick = true;
               el.setAttribute('role', 'link');
               el.setAttribute('tabindex', '0');
               el.addEventListener('click', function () {
                   var href = el.getAttribute('data-href');
                   if (href) window.location.href = href;
               });
               el.addEventListener('keydown', function (e) {
                   if (e.key === 'Enter' || e.key === ' ') {
                       e.preventDefault();
                       var href = el.getAttribute('data-href');
                       if (href) window.location.href = href;
                   }
               });
           });
       }
       function run() {
           applyBackgrounds();
           initClickable();
       }
       if (document.readyState === 'loading') {
           document.addEventListener('DOMContentLoaded', run);
       } else {
           run();
       }
   })();

</script>