Mudanças entre as edições de "Widget:C.Skills"

De Wiki Gla
Ir para navegação Ir para pesquisar
(Criou página com '<!-- SKINS SYSTEM --> <script> (function initSkinsPodiumUI() { 'use strict'; const podium = document.querySelector('.skins-podium'); if (!podium ||...')
 
m
Linha 1: Linha 1:
<!-- SKINS SYSTEM -->
<!-- SKILLS SYSTEM -->
<script>
<script>
     (function initSkinsPodiumUI() {
     (function () {
         'use strict';
         'use strict';
         const podium = document.querySelector('.skins-podium');
         const { $, $$, filePathURL, slugify, getLangKey, chooseDescFrom, subBarTemplateCache } = window.__CBase || {};
        if (!podium || podium.dataset.wired === '1') return;
        podium.dataset.wired = '1';


         function applyOffsetX() {
         const FLAG_ICON_FILES = {
             const allSlots = podium.querySelectorAll('.podium-slot');
             aggro: 'Enemyaggro-icon.png',
            allSlots.forEach((slot) => {
            bridge: 'Bridgemaker-icon.png',
                const offsetXAttr = slot.getAttribute('data-offset-x');
            wall: 'Destroywall-icon.png',
                 if (offsetXAttr !== null && offsetXAttr !== '' && offsetXAttr !== 'undefined') {
            quickcast: 'Quickcast-icon.png',
                    const numOffset = parseFloat(offsetXAttr);
            wallpass: 'Passthroughwall-icon.png'
                    if (!isNaN(numOffset) && numOffset !== 0) {
        };
                        const currentStyle = slot.getAttribute('style') || '';
 
                        const cleanedStyle = currentStyle
        const iconsBar = $('#skills') ? $('.icon-bar', $('#skills')) : null;
                            .replace(/margin-left\s*:[^;]+;?/gi, '')
        const descBox = $('#skills') ? $('.desc-box', $('#skills')) : null;
                            .replace(/transform\s*:[^;]+;?/gi, '')
        const videoBox = $('#skills') ? $('.video-container', $('#skills')) : null;
                            .trim();
        const skillsRoot = document.getElementById('skills');
                        const newMargin = `margin-left: ${numOffset}px`;
 
                        if (cleanedStyle && cleanedStyle.length > 0) {
        if (!iconsBar || !skillsRoot) return;
                            slot.setAttribute('style', cleanedStyle + (cleanedStyle.endsWith(';') ? ' ' : '; ') + newMargin + ';');
 
                        } else {
        const barStack = [];
                            slot.setAttribute('style', newMargin + ';');
        window.__barStack = barStack;
                        }
 
                    }
        function getLabels() {
                }
            const i18nMap = skillsRoot ? JSON.parse(skillsRoot.dataset.i18nAttrs || '{}') : {};
             });
            const lang = getLangKey ? getLangKey() : 'pt';
            return i18nMap[lang] || i18nMap.pt || {
                 cooldown: 'Recarga',
                energy_gain: 'Ganho de energia',
                energy_cost: 'Custo de energia',
                power: 'Poder',
                power_pvp: 'Poder PvP',
                level: 'Nível'
            };
        }
 
        function renderAttributes(str) {
            const L = getLabels();
            const vals = (str || '').split(',').map(v => v.trim());
            const pve = vals[0] && vals[0] !== '-' ? parseFloat(vals[0]) : NaN;
            const pvp = vals[1] && vals[1] !== '-' ? parseFloat(vals[1]) : NaN;
            const ene = vals[2] && vals[2] !== '-' ? parseFloat(vals[2]) : NaN;
            const cd = vals[3] && vals[3] !== '-' ? parseFloat(vals[3]) : NaN;
 
            const rows = [];
            if (!isNaN(cd)) rows.push([L.cooldown, cd]);
            if (!isNaN(ene) && ene !== 0) {
                rows.push([ene > 0 ? L.energy_gain : L.energy_cost, Math.abs(ene)]);
            }
            if (!isNaN(pve)) rows.push([L.power, pve]);
            if (!isNaN(pvp)) rows.push([L.power_pvp, pvp]);
 
            if (!rows.length) return '';
            return `<div class="attr-list">${rows.map(([l, v]) => `<div class="attr-row"><span class="attr-label">${l}</span><span class="attr-value">${v}</span></div>`).join('')}</div>`;
        }
 
        function renderFlagsRow(flags) {
            const arr = (flags || []).filter(Boolean);
            if (!arr.length) return '';
            const items = arr.map(k => {
                const url = filePathURL ? filePathURL(FLAG_ICON_FILES[k]) : '';
                return url ? `<img class="skill-flag" data-flag="${k}" alt="" src="${url}">` : '';
            }).join('');
             return items ? `<div class="skill-flags" role="group" aria-label="Características">${items}</div>` : '';
         }
         }


         requestAnimationFrame(() => {
         function showVideoForIcon(el) {
             applyOffsetX();
            if (!videoBox) return;
             setTimeout(applyOffsetX, 50);
            const videoURL = (el.dataset.video || '').trim();
            setTimeout(applyOffsetX, 200);
            if (!videoURL) {
        });
                videoBox.style.display = 'none';
                return;
            }
 
             let video = videoBox.querySelector(`video[data-index="${el.dataset.index}"]`);
             if (!video) {
                video = document.createElement('video');
                video.className = 'skill-video';
                video.dataset.index = el.dataset.index;
                video.setAttribute('controls', '');
                video.setAttribute('preload', 'metadata');
                video.setAttribute('playsinline', '');
                video.style.width = '100%';
                video.style.height = 'auto';
                video.style.aspectRatio = '16/9';
                video.style.objectFit = 'contain';
 
                const ext = (videoURL.split('.').pop() || '').toLowerCase().split('?')[0];
                const mimeTypes = {
                    'mp4': 'video/mp4',
                    'm4v': 'video/mp4',
                    'webm': 'video/webm',
                    'ogv': 'video/ogg',
                    'ogg': 'video/ogg',
                    'mov': 'video/quicktime'
                };
                const mimeType = mimeTypes[ext] || 'video/mp4';
                const src = document.createElement('source');
                src.src = videoURL;
                src.type = mimeType;
                video.appendChild(src);
                videoBox.appendChild(video);
            }


        if (document.readyState === 'loading') {
            videoBox.querySelectorAll('video').forEach(v => v.style.display = 'none');
             document.addEventListener('DOMContentLoaded', () => {
            video.style.display = 'block';
                requestAnimationFrame(applyOffsetX);
             videoBox.style.display = 'block';
             });
            try {
                video.currentTime = 0;
                video.play().catch(() => { });
             } catch (e) { }
         }
         }


         // YouTube integration
         function activateSkill(el, options = {}) {
        podium.querySelectorAll('.podium-slot[data-youtube]').forEach(slot => {
            const { openSubs = true } = options;
             if (slot.dataset.youtubeWired === '1') return;
            const L = getLabels();
             slot.dataset.youtubeWired = '1';
            const name = el.dataset.nome || el.dataset.name || '';
             const youtube = slot.getAttribute('data-youtube');
            const level = (el.dataset.level || '').trim();
             if (!youtube) return;
            const desc = chooseDescFrom ? chooseDescFrom({
                desc_i18n: {
                    pt: el.dataset.descPt || '',
                    en: el.dataset.descEn || '',
                    es: el.dataset.descEs || '',
                    pl: el.dataset.descPl || ''
                },
                desc: el.dataset.desc || ''
             }) : (el.dataset.desc || '');
            const descHtml = desc.replace(/'''(.*?)'''/g, '<b>$1</b>');
             const attrsHTML = el.dataset.atr ? renderAttributes(el.dataset.atr) : '';
             const flagsHTML = el.dataset.flags ? (() => {
                try {
                    const flags = JSON.parse(el.dataset.flags);
                    return renderFlagsRow(flags);
                } catch { return ''; }
             })() : '';


             slot.addEventListener('click', () => {
             if (descBox) {
                window.open(youtube, '_blank', 'noopener,noreferrer');
                descBox.innerHTML = `<div class="skill-title"><h3>${name}</h3></div>${level ? `<div class="skill-level-line"><span class="attr-label">${L.level} ${level}</span></div>` : ''}${attrsHTML}<div class="desc">${descHtml}</div>`;
             });
             }


             slot.addEventListener('keydown', (e) => {
             if (videoBox) {
                 if (e.key === 'Enter' || e.key === ' ') {
                 const oldFlags = videoBox.querySelector('.skill-flags');
                    e.preventDefault();
                if (oldFlags) oldFlags.remove();
                     window.open(youtube, '_blank', 'noopener,noreferrer');
                if (flagsHTML) {
                     videoBox.insertAdjacentHTML('beforeend', flagsHTML);
                 }
                 }
             });
             }
        });
 
            $$('.skill-icon', iconsBar).forEach(i => i.classList.remove('active'));
            el.classList.add('active');
            window.__lastActiveSkillIcon = el;
 
            showVideoForIcon(el);
 
            const subsRaw = el.dataset.subs || el.getAttribute('data-subs');
            const isBack = el.dataset.back === 'true' || el.dataset.back === 'yes' || el.dataset.back === '1';


        // Tooltip i18n
            if (isBack && barStack.length) {
        const tooltipEl = document.createElement('div');
                const prev = barStack.pop();
        tooltipEl.className = 'skin-tooltip';
                renderBarFromItems(prev.items);
        tooltipEl.style.display = 'none';
                return;
        document.body.appendChild(tooltipEl);
            }


        function getLangKey() {
            if (openSubs && subsRaw && subsRaw.trim() !== '') {
            const raw = (document.documentElement.lang || 'pt').toLowerCase();
                if (barStack.length && barStack[barStack.length - 1].parentIcon === el) return;
            return raw === 'pt-br' ? 'pt' : (raw.split('-')[0] || 'pt');
                try {
                    const subs = JSON.parse(subsRaw);
                    pushSubBarFrom(subs, el);
                } catch { }
            }
         }
         }


         podium.querySelectorAll('.podium-slot').forEach(slot => {
         function snapshotCurrentBarItemsFromDOM() {
            if (slot.dataset.tooltipWired === '1') return;
            return $$('.skill-icon', iconsBar).filter(el => el.dataset.weaponToggle !== '1').map(el => {
            slot.dataset.tooltipWired = '1';
                const img = el.querySelector('img');
                const iconURL = img ? img.src : '';
                const subsRaw = el.dataset.subs || el.getAttribute('data-subs') || '';
                let subs = null;
                try {
                    subs = subsRaw ? JSON.parse(subsRaw) : null;
                } catch { subs = null; }


            const tooltipRaw = slot.getAttribute('data-skin-tooltip') || '';
                let flags = null;
            const tooltipI18n = slot.getAttribute('data-skin-tooltip-i18n');
                if (el.dataset.flags) {
 
                    try {
            function showTooltip(e) {
                        flags = JSON.parse(el.dataset.flags);
                const lang = getLangKey();
                    } catch { }
                 let text = tooltipRaw;
                 }


                 if (tooltipI18n) {
                let weapon = null;
                 if (el.dataset.weapon) {
                     try {
                     try {
                         const pack = JSON.parse(tooltipI18n);
                         weapon = JSON.parse(el.dataset.weapon);
                        text = pack[lang] || pack.pt || pack.en || pack.es || pack.pl || tooltipRaw;
                     } catch { }
                     } catch (e) {
                        // fallback to raw
                    }
                 }
                 }


                 if (!text) return;
                return {
                    name: el.dataset.nome || el.dataset.name || '',
                    index: el.dataset.index || '',
                    level: el.dataset.level || '',
                    desc: el.dataset.desc || '',
                    descPt: el.dataset.descPt || '',
                    descEn: el.dataset.descEn || '',
                    descEs: el.dataset.descEs || '',
                    descPl: el.dataset.descPl || '',
                    attrs: el.dataset.atr || '',
                    video: el.dataset.video || '',
                    iconURL,
                    subs,
                    flags,
                    weapon
                };
            });
        }
 
        function renderBarFromItems(items) {
            iconsBar.innerHTML = '';
            items.forEach((it) => {
                const node = document.createElement('div');
                node.className = 'skill-icon';
                node.dataset.nome = it.name || '';
                if (it.index) node.dataset.index = it.index;
                if (it.level) node.dataset.level = it.level;
                if (it.desc) node.dataset.desc = it.desc;
                if (it.descPt) node.dataset.descPt = it.descPt;
                if (it.descEn) node.dataset.descEn = it.descEn;
                if (it.descEs) node.dataset.descEs = it.descEs;
                if (it.descPl) node.dataset.descPl = it.descPl;
                if (it.attrs) node.dataset.atr = it.attrs;
                if (it.video) node.dataset.video = it.video;
                if (it.subs) node.dataset.subs = JSON.stringify(it.subs);
                if (it.flags) node.dataset.flags = JSON.stringify(it.flags);
                if (it.weapon) node.dataset.weapon = JSON.stringify(it.weapon);
                 if (!it.index) node.dataset.nested = '1';
 
                const img = document.createElement('img');
                img.alt = '';
                img.src = it.iconURL || (it.icon ? (filePathURL ? filePathURL(it.icon) : '') : '');
                img.decoding = 'async';
                img.loading = 'lazy';
                node.appendChild(img);
                iconsBar.appendChild(node);
            });


                 tooltipEl.innerHTML = text;
            wireClicksForCurrentBar();
                 tooltipEl.style.display = 'block';
        }
                 const rect = slot.getBoundingClientRect();
 
                 tooltipEl.style.left = rect.left + 'px';
        function pushSubBarFrom(subs, parentIconEl) {
                tooltipEl.style.top = (rect.top - tooltipEl.offsetHeight - 10) + 'px';
            const parentIndexSnapshot = parentIconEl ? (parentIconEl.dataset.index || '') : '';
             }
            barStack.push({
                items: snapshotCurrentBarItemsFromDOM(),
                parentIcon: parentIconEl,
                 parentIndex: parentIndexSnapshot
            });
 
            const L = getLabels();
            const items = (subs || []).map(s => {
                 const name = (s.name || s.n || '').trim();
                 const desc = chooseDescFrom ? chooseDescFrom(s) : '';
                 return {
                    name,
                    level: (s.level || '').toString().trim(),
                    desc,
                    descPt: (s.desc_i18n && s.desc_i18n.pt) || '',
                    descEn: (s.desc_i18n && s.desc_i18n.en) || '',
                    descEs: (s.desc_i18n && s.desc_i18n.es) || '',
                    descPl: (s.desc_i18n && s.desc_i18n.pl) || '',
                    attrs: '',
                    icon: (s.icon || ''),
                    iconURL: (s.icon && s.icon !== 'Nada.png') ? (filePathURL ? filePathURL(s.icon) : '') : '',
                    video: s.video ? (filePathURL ? filePathURL(s.video) : '') : '',
                    subs: Array.isArray(s.subs) ? s.subs : null,
                    flags: Array.isArray(s.flags) ? s.flags : null,
                    back: (s.back === true || s.back === 'true' || s.back === 'yes' || s.back === '1') ? 'true' : null,
                    weapon: s.weapon || null
                };
             });
 
            renderBarFromItems(items);
        }


             function hideTooltip() {
        function wireClicksForCurrentBar() {
                 tooltipEl.style.display = 'none';
             $$('.skill-icon', iconsBar).forEach(el => {
             }
                 if (el.dataset.weaponToggle === '1') return;
                if (el.dataset.wired) return;
                el.dataset.wired = '1';
                const label = el.dataset.nome || el.dataset.name || '';
                el.setAttribute('aria-label', label);
                el.addEventListener('click', () => {
                    activateSkill(el, { openSubs: true });
                });
             });
        }


            slot.addEventListener('mouseenter', showTooltip);
        // Initialize
             slot.addEventListener('mouseleave', hideTooltip);
        wireClicksForCurrentBar();
         });
        const firstIcon = $$('.skill-icon', iconsBar)[0];
        if (firstIcon) {
             activateSkill(firstIcon, { openSubs: false });
         }
     })();
     })();
</script>
</script>

Edição das 21h37min de 31 de dezembro de 2025

<script>

   (function () {
       'use strict';
       const { $, $$, filePathURL, slugify, getLangKey, chooseDescFrom, subBarTemplateCache } = window.__CBase || {};
       const FLAG_ICON_FILES = {
           aggro: 'Enemyaggro-icon.png',
           bridge: 'Bridgemaker-icon.png',
           wall: 'Destroywall-icon.png',
           quickcast: 'Quickcast-icon.png',
           wallpass: 'Passthroughwall-icon.png'
       };
       const iconsBar = $('#skills') ? $('.icon-bar', $('#skills')) : null;
       const descBox = $('#skills') ? $('.desc-box', $('#skills')) : null;
       const videoBox = $('#skills') ? $('.video-container', $('#skills')) : null;
       const skillsRoot = document.getElementById('skills');
       if (!iconsBar || !skillsRoot) return;
       const barStack = [];
       window.__barStack = barStack;
       function getLabels() {
           const i18nMap = skillsRoot ? JSON.parse(skillsRoot.dataset.i18nAttrs || '{}') : {};
           const lang = getLangKey ? getLangKey() : 'pt';
           return i18nMap[lang] || i18nMap.pt || {
               cooldown: 'Recarga',
               energy_gain: 'Ganho de energia',
               energy_cost: 'Custo de energia',
               power: 'Poder',
               power_pvp: 'Poder PvP',
               level: 'Nível'
           };
       }
       function renderAttributes(str) {
           const L = getLabels();
           const vals = (str || ).split(',').map(v => v.trim());
           const pve = vals[0] && vals[0] !== '-' ? parseFloat(vals[0]) : NaN;
           const pvp = vals[1] && vals[1] !== '-' ? parseFloat(vals[1]) : NaN;
           const ene = vals[2] && vals[2] !== '-' ? parseFloat(vals[2]) : NaN;
           const cd = vals[3] && vals[3] !== '-' ? parseFloat(vals[3]) : NaN;
           const rows = [];
           if (!isNaN(cd)) rows.push([L.cooldown, cd]);
           if (!isNaN(ene) && ene !== 0) {
               rows.push([ene > 0 ? L.energy_gain : L.energy_cost, Math.abs(ene)]);
           }
           if (!isNaN(pve)) rows.push([L.power, pve]);
           if (!isNaN(pvp)) rows.push([L.power_pvp, pvp]);
           if (!rows.length) return ;

return `

${rows.map(([l, v]) => `
${l}${v}
`).join()}

`;

       }
       function renderFlagsRow(flags) {
           const arr = (flags || []).filter(Boolean);
           if (!arr.length) return ;
           const items = arr.map(k => {
               const url = filePathURL ? filePathURL(FLAG_ICON_FILES[k]) : ;
               return url ? `<img class="skill-flag" data-flag="${k}" alt="" src="${url}">` : ;
           }).join();

return items ? `

${items}

` : ;

       }
       function showVideoForIcon(el) {
           if (!videoBox) return;
           const videoURL = (el.dataset.video || ).trim();
           if (!videoURL) {
               videoBox.style.display = 'none';
               return;
           }
           let video = videoBox.querySelector(`video[data-index="${el.dataset.index}"]`);
           if (!video) {
               video = document.createElement('video');
               video.className = 'skill-video';
               video.dataset.index = el.dataset.index;
               video.setAttribute('controls', );
               video.setAttribute('preload', 'metadata');
               video.setAttribute('playsinline', );
               video.style.width = '100%';
               video.style.height = 'auto';
               video.style.aspectRatio = '16/9';
               video.style.objectFit = 'contain';
               const ext = (videoURL.split('.').pop() || ).toLowerCase().split('?')[0];
               const mimeTypes = {
                   'mp4': 'video/mp4',
                   'm4v': 'video/mp4',
                   'webm': 'video/webm',
                   'ogv': 'video/ogg',
                   'ogg': 'video/ogg',
                   'mov': 'video/quicktime'
               };
               const mimeType = mimeTypes[ext] || 'video/mp4';
               const src = document.createElement('source');
               src.src = videoURL;
               src.type = mimeType;
               video.appendChild(src);
               videoBox.appendChild(video);
           }
           videoBox.querySelectorAll('video').forEach(v => v.style.display = 'none');
           video.style.display = 'block';
           videoBox.style.display = 'block';
           try {
               video.currentTime = 0;
               video.play().catch(() => { });
           } catch (e) { }
       }
       function activateSkill(el, options = {}) {
           const { openSubs = true } = options;
           const L = getLabels();
           const name = el.dataset.nome || el.dataset.name || ;
           const level = (el.dataset.level || ).trim();
           const desc = chooseDescFrom ? chooseDescFrom({
               desc_i18n: {
                   pt: el.dataset.descPt || ,
                   en: el.dataset.descEn || ,
                   es: el.dataset.descEs || ,
                   pl: el.dataset.descPl || 
               },
               desc: el.dataset.desc || 
           }) : (el.dataset.desc || );
           const descHtml = desc.replace(/(.*?)/g, '$1');
           const attrsHTML = el.dataset.atr ? renderAttributes(el.dataset.atr) : ;
           const flagsHTML = el.dataset.flags ? (() => {
               try {
                   const flags = JSON.parse(el.dataset.flags);
                   return renderFlagsRow(flags);
               } catch { return ; }
           })() : ;
           if (descBox) {

descBox.innerHTML = `

${name}

${level ? `

${L.level} ${level}

` : }${attrsHTML}

${descHtml}

`;

           }
           if (videoBox) {
               const oldFlags = videoBox.querySelector('.skill-flags');
               if (oldFlags) oldFlags.remove();
               if (flagsHTML) {
                   videoBox.insertAdjacentHTML('beforeend', flagsHTML);
               }
           }
           $$('.skill-icon', iconsBar).forEach(i => i.classList.remove('active'));
           el.classList.add('active');
           window.__lastActiveSkillIcon = el;
           showVideoForIcon(el);
           const subsRaw = el.dataset.subs || el.getAttribute('data-subs');
           const isBack = el.dataset.back === 'true' || el.dataset.back === 'yes' || el.dataset.back === '1';
           if (isBack && barStack.length) {
               const prev = barStack.pop();
               renderBarFromItems(prev.items);
               return;
           }
           if (openSubs && subsRaw && subsRaw.trim() !== ) {
               if (barStack.length && barStack[barStack.length - 1].parentIcon === el) return;
               try {
                   const subs = JSON.parse(subsRaw);
                   pushSubBarFrom(subs, el);
               } catch { }
           }
       }
       function snapshotCurrentBarItemsFromDOM() {
           return $$('.skill-icon', iconsBar).filter(el => el.dataset.weaponToggle !== '1').map(el => {
               const img = el.querySelector('img');
               const iconURL = img ? img.src : ;
               const subsRaw = el.dataset.subs || el.getAttribute('data-subs') || ;
               let subs = null;
               try {
                   subs = subsRaw ? JSON.parse(subsRaw) : null;
               } catch { subs = null; }
               let flags = null;
               if (el.dataset.flags) {
                   try {
                       flags = JSON.parse(el.dataset.flags);
                   } catch { }
               }
               let weapon = null;
               if (el.dataset.weapon) {
                   try {
                       weapon = JSON.parse(el.dataset.weapon);
                   } catch { }
               }
               return {
                   name: el.dataset.nome || el.dataset.name || ,
                   index: el.dataset.index || ,
                   level: el.dataset.level || ,
                   desc: el.dataset.desc || ,
                   descPt: el.dataset.descPt || ,
                   descEn: el.dataset.descEn || ,
                   descEs: el.dataset.descEs || ,
                   descPl: el.dataset.descPl || ,
                   attrs: el.dataset.atr || ,
                   video: el.dataset.video || ,
                   iconURL,
                   subs,
                   flags,
                   weapon
               };
           });
       }
       function renderBarFromItems(items) {
           iconsBar.innerHTML = ;
           items.forEach((it) => {
               const node = document.createElement('div');
               node.className = 'skill-icon';
               node.dataset.nome = it.name || ;
               if (it.index) node.dataset.index = it.index;
               if (it.level) node.dataset.level = it.level;
               if (it.desc) node.dataset.desc = it.desc;
               if (it.descPt) node.dataset.descPt = it.descPt;
               if (it.descEn) node.dataset.descEn = it.descEn;
               if (it.descEs) node.dataset.descEs = it.descEs;
               if (it.descPl) node.dataset.descPl = it.descPl;
               if (it.attrs) node.dataset.atr = it.attrs;
               if (it.video) node.dataset.video = it.video;
               if (it.subs) node.dataset.subs = JSON.stringify(it.subs);
               if (it.flags) node.dataset.flags = JSON.stringify(it.flags);
               if (it.weapon) node.dataset.weapon = JSON.stringify(it.weapon);
               if (!it.index) node.dataset.nested = '1';
               const img = document.createElement('img');
               img.alt = ;
               img.src = it.iconURL || (it.icon ? (filePathURL ? filePathURL(it.icon) : ) : );
               img.decoding = 'async';
               img.loading = 'lazy';
               node.appendChild(img);
               iconsBar.appendChild(node);
           });
           wireClicksForCurrentBar();
       }
       function pushSubBarFrom(subs, parentIconEl) {
           const parentIndexSnapshot = parentIconEl ? (parentIconEl.dataset.index || ) : ;
           barStack.push({
               items: snapshotCurrentBarItemsFromDOM(),
               parentIcon: parentIconEl,
               parentIndex: parentIndexSnapshot
           });
           const L = getLabels();
           const items = (subs || []).map(s => {
               const name = (s.name || s.n || ).trim();
               const desc = chooseDescFrom ? chooseDescFrom(s) : ;
               return {
                   name,
                   level: (s.level || ).toString().trim(),
                   desc,
                   descPt: (s.desc_i18n && s.desc_i18n.pt) || ,
                   descEn: (s.desc_i18n && s.desc_i18n.en) || ,
                   descEs: (s.desc_i18n && s.desc_i18n.es) || ,
                   descPl: (s.desc_i18n && s.desc_i18n.pl) || ,
                   attrs: ,
                   icon: (s.icon || ),
                   iconURL: (s.icon && s.icon !== 'Nada.png') ? (filePathURL ? filePathURL(s.icon) : ) : ,
                   video: s.video ? (filePathURL ? filePathURL(s.video) : ) : ,
                   subs: Array.isArray(s.subs) ? s.subs : null,
                   flags: Array.isArray(s.flags) ? s.flags : null,
                   back: (s.back === true || s.back === 'true' || s.back === 'yes' || s.back === '1') ? 'true' : null,
                   weapon: s.weapon || null
               };
           });
           renderBarFromItems(items);
       }
       function wireClicksForCurrentBar() {
           $$('.skill-icon', iconsBar).forEach(el => {
               if (el.dataset.weaponToggle === '1') return;
               if (el.dataset.wired) return;
               el.dataset.wired = '1';
               const label = el.dataset.nome || el.dataset.name || ;
               el.setAttribute('aria-label', label);
               el.addEventListener('click', () => {
                   activateSkill(el, { openSubs: true });
               });
           });
       }
       // Initialize
       wireClicksForCurrentBar();
       const firstIcon = $$('.skill-icon', iconsBar)[0];
       if (firstIcon) {
           activateSkill(firstIcon, { openSubs: false });
       }
   })();

</script>