fixed fatal pipeline flaw by correcting game-kit.js dir from static/apps/scripts to apps/dashboard/static/apps/scripts/game-kit-js; the former folder is untracked by git, so successful local code changes never registered to CI static files
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Disco DeDisco
2026-03-15 13:51:48 -04:00
parent 6d1b358b7c
commit 18ba242647

View File

@@ -0,0 +1,82 @@
(function () {
var btn = document.getElementById('id_kit_btn');
var dialog = document.getElementById('id_kit_bag_dialog');
if (!btn || !dialog) return;
dialog.addEventListener('close', function () {
btn.classList.remove('active');
clearSelection();
});
btn.addEventListener('click', function () {
if (dialog.open) {
dialog.close();
return;
}
fetch(btn.dataset.kitUrl, {
headers: { 'X-Requested-With': 'XMLHttpRequest' },
})
.then(function (r) { return r.text(); })
.then(function (html) {
dialog.innerHTML = html;
attachCardListeners();
btn.classList.add('active');
dialog.setAttribute('open', '');
})
.catch(function () {
btn.classList.remove('active');
});
});
// Escape key
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && dialog.open) {
dialog.close();
}
});
// Click outside (but not on the rails button — let that flow through)
document.addEventListener('click', function (e) {
if (!dialog.open) return;
if (dialog.contains(e.target)) return;
if (e.target === btn || btn.contains(e.target)) return;
if (e.target.closest('button.token-rails')) return;
dialog.close();
});
// Inject token_id before token-rails form submits
document.addEventListener('click', function (e) {
var rails = e.target.closest('button.token-rails');
if (!rails || !window._kitTokenId) return;
var form = rails.closest('form');
if (!form) return;
var existing = form.querySelector('input[name="token_id"]');
if (existing) existing.remove();
var hidden = document.createElement('input');
hidden.type = 'hidden';
hidden.name = 'token_id';
hidden.value = window._kitTokenId;
form.appendChild(hidden);
if (dialog.open) dialog.close();
});
function attachCardListeners() {
dialog.querySelectorAll('.kit-card').forEach(function (card) {
card.addEventListener('click', function () {
dialog.querySelectorAll('.kit-card.selected').forEach(function (c) {
c.classList.remove('selected');
});
card.classList.add('selected');
window._kitTokenId = card.dataset.tokenId;
var slot = document.querySelector('.token-slot');
if (slot) slot.classList.add('ready');
});
});
}
function clearSelection() {
window._kitTokenId = null;
var slot = document.querySelector('.token-slot');
if (slot) slot.classList.remove('ready');
}
}());