diff options
| author | historia <[not public]> | 2026-07-03 16:55:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-03 16:55:23 -0400 |
| commit | 034187d1c434b6bee32aeb539ea543f6ec537376 (patch) | |
| tree | f238a9c6a657af20edf0c53e9d0980bc58c1133a /internal/admin/static/mobeditor.js | |
| parent | 778157981cccb8cb4856e3ab5a72085830c59120 (diff) | |
| download | thehouseoficarus-034187d1c434b6bee32aeb539ea543f6ec537376.tar.gz | |
feat: card ui added to drops, hazards, techs, and mods in admin gui
Diffstat (limited to 'internal/admin/static/mobeditor.js')
| -rw-r--r-- | internal/admin/static/mobeditor.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/admin/static/mobeditor.js b/internal/admin/static/mobeditor.js index 4895c6f..4260e49 100644 --- a/internal/admin/static/mobeditor.js +++ b/internal/admin/static/mobeditor.js @@ -3,6 +3,7 @@ var mobData = null; var mobID = null; var expandedCards = {}; var addedSections = {}; +var cardWidths = {}; var MOB_SECTIONS = [ { @@ -76,7 +77,7 @@ var MOB_SECTIONS = [ ] }, { - id: 'talk', label: 'Talk', path: 'talk', + id: 'talk', label: 'Talk', path: 'talk', fullWidth: true, detect: function(d) { return d.talk && d.talk.nodes; }, fields: [] }, @@ -206,9 +207,12 @@ function renderCurrent() { function renderMobCard(sec, data) { var collapsed = expandedCards[sec.id] === false; - var h = '<div class="obj-card' + (sec.id === 'talk' ? ' obj-card-full' : '') + '" data-card="' + sec.id + '">'; + var isFull = cardWidths[sec.id] !== undefined ? cardWidths[sec.id] : (sec.fullWidth || false); + var fullClass = isFull ? ' obj-card-full' : ''; + var h = '<div class="obj-card' + fullClass + '" data-card="' + sec.id + '">'; h += '<div class="obj-card-header" onclick="toggleMobCard(\'' + sec.id + '\')">'; h += '<span class="obj-card-arrow">' + (collapsed ? '▶' : '▼') + '</span>'; + h += '<button class="btn btn-sm obj-card-expand" onclick="event.stopPropagation();toggleMobCardWidth(\'' + sec.id + '\')" title="' + (isFull ? 'Half width' : 'Full width') + '">' + (isFull ? '\u229F' : '\u229E') + '</button>'; h += '<span class="obj-card-label">' + sec.label + '</span>'; if (!sec.always) { h += '<button class="btn btn-sm btn-danger obj-card-remove" onclick="event.stopPropagation();removeMobSection(\'' + sec.id + '\')">X</button>'; @@ -555,6 +559,11 @@ function toggleMobCard(id) { renderCurrent(); } +function toggleMobCardWidth(id) { + cardWidths[id] = !cardWidths[id]; + renderCurrent(); +} + function removeMobSection(id) { var sec = MOB_SECTIONS.find(function(s) { return s.id === id; }); if (!sec) return; |
