diff options
| author | historia <[not public]> | 2026-07-13 18:36:29 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-13 18:36:29 -0400 |
| commit | 1bedf06969b8ab8e51dd4301a0831200df5c8f59 (patch) | |
| tree | acdcbcc3a26896c678edeffad0cb0d8ec9b2857b /internal/admin/static/cardeditor.js | |
| parent | 8952653be9bfeeb9aadf59f845de507630d65dc4 (diff) | |
| download | thehouseoficarus-1bedf06969b8ab8e51dd4301a0831200df5c8f59.tar.gz | |
feat(admin): tooltips added for confusing fields, hide more optional fields with buttons
Diffstat (limited to 'internal/admin/static/cardeditor.js')
| -rw-r--r-- | internal/admin/static/cardeditor.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/admin/static/cardeditor.js b/internal/admin/static/cardeditor.js index 6a8cda7..cf3a8b7 100644 --- a/internal/admin/static/cardeditor.js +++ b/internal/admin/static/cardeditor.js @@ -301,7 +301,7 @@ function ced_updateSearchHighlight(results) { // ---- Generic field renderer (used by all card-based editors) ---- function ced_renderField(sec, f, data, idx, subPath, optStyle, cardPathFn, fieldIDFn, getValFn) { - var key = f[0], label = f[1], type = f[2], hint = f[3], wide = f[4], showIf = f[5], searchEntity = f[6]; + var key = f[0], label = f[1], type = f[2], hint = f[3], wide = f[4], showIf = f[5], searchEntity = f[6], tooltip = f[7]; var fp = subPath ? subPath + '.' + key : key; var fid = fieldIDFn(sec, fp, idx); var val; @@ -343,8 +343,13 @@ function ced_renderField(sec, f, data, idx, subPath, optStyle, cardPathFn, field return '<label class="' + cls + w + '"' + hiddenStyle + s + '>' + inner + '</label>'; } + function lblSpan() { + if (tooltip) return '<span title="' + escAttr(tooltip) + '">' + esc(label) + '</span>'; + return '<span>' + esc(label) + '</span>'; + } + if (type === 'checkbox') { - return wrap('obj-field obj-check', '<input type="checkbox" id="' + fid + '"' + (val ? ' checked' : '') + dpAttr + '> <span>' + esc(label) + '</span>'); + return wrap('obj-field obj-check', '<input type="checkbox" id="' + fid + '"' + (val ? ' checked' : '') + dpAttr + '> ' + lblSpan()); } if (type === 'json') { var jstr = typeof val === 'object' ? JSON.stringify(val) : String(val); @@ -356,7 +361,7 @@ function ced_renderField(sec, f, data, idx, subPath, optStyle, cardPathFn, field } if (type === 'select') { if (hint && hint.indexOf('dyn:') === 0) { - var inner = '<span>' + esc(label) + '</span>' + ced_buildDynamicSelect(fid, dpAttr, val, hint.substring(4)); + var inner = lblSpan() + ced_buildDynamicSelect(fid, dpAttr, val, hint.substring(4)); return wrap('obj-field', inner); } var opts = hint ? hint.split('|') : []; @@ -672,13 +677,11 @@ function ced_collectAtkType(widgetID) { function ced_renderTagHelp(type) { var h = '<div style="margin-top:8px;font-size:10px;color:#aaa;line-height:1.5">'; if (type === 'color') { - h += 'Name is displayed without an article (e.g. "John Smith" instead of "a John Smith")<br>'; - h += 'Cannot be attacked by players. Combat level hidden<br>'; h += 'Text fields support color tags: <code style="color:#aaa;font-family:monospace">{NN}text{/}</code> where <code style="color:#aaa;font-family:monospace">NN</code> is a hex color index (00–FF).'; } else if (type === 'crafting') { h += 'Message fields support template variables:<br>%i1 = first ingredient name<br>%i2 = second ingredient name<br>%n = output item name.<br>Color tags are also supported: {NN}text{/} where NN is a hex color index (00–FF).'; } else if (type === 'gather') { - h += 'Message fields support template variables: {name} = object name.<br>Color tags are also supported: {NN}text{/} where NN is a hex color index (00–FF).'; + h += 'Message fields support template variables: {name} = object name.<br/>Color tags are also supported: {NN}text{/} where NN is a hex color index (00–FF).'; } h += '</div>'; return h; |
