feat(options): rename navbarfontcolor to "Text color in header"; re-measure header alignment on tab show

Row 142, two changes:
1. The navbarfontcolor option is renamed "Menu item color in header" ->
   "Text color in header" (child: "Custom text color in header ..."). Labels
   are read live from config.xml, no reset needed.
2. The header background color column alignment (row 136) is now re-measured
   when the Top-of-page tab is shown (shown.bs.tab) and on window resize, and
   after the stored-tab restore (row 133) when that tab is Top-of-page. Reason:
   at page load the Top-of-page pane is usually hidden (display:none), where
   getBoundingClientRect returns 0 — so the one-shot measurement in run()
   computed a 0 offset and the background column was never lowered on the real
   page. OPTIONS_JS_TOKEN -> 20261126.17. Verified: render tc=663 (new label,
   old label gone, options.js?v=20261126.17), jsdom 7/7 incl. new pins (padding
   re-applied on shown.bs.tab, label renamed), export exit 0. Variants not
   rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-26 20:04:33 +01:00
commit cd62f2f752
3 changed files with 26 additions and 8 deletions

View file

@ -257,7 +257,7 @@
"Default background color", "Color 1", "Color 2", "Color 3",
"Other ..." — options.js appends each entry's live hexcode in brackets
(for "Other ..." the custom color's hex) and bolds the default. -->
<navbarfontcolor type="dropdown" category="Colors" width="12" title="Menu item color in header" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">default
<navbarfontcolor type="dropdown" category="Colors" width="12" title="Text color in header" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">default
<dropdownoptions>
<option value="default" data-default="1">[Default font color]</option>
<option value="defaultbackgroundcolor">Default background color</option>
@ -266,7 +266,7 @@
<option value="color3">Color 3</option>
<option value="other">Other ...</option>
</dropdownoptions></navbarfontcolor>
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom menu item color (used when 'Other ...' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom text color in header (used when 'Other ...' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
<sliderhandlecolor type="colorpicker" category="Colors" width="12" title="Slider handle color" options="on|off" optionlabels="Yes|No">#5e1c64</sliderhandlecolor>
<!-- Row 135: progress bar colors as color-choosers. Layout in the "Top of the
page" tab (options.twig slots): progress bar color = COLUMN 1, progress

View file

@ -888,7 +888,7 @@ var ThemeOptions = function () {
};
// THEME ADDITION (row 136): in the "Top of the page" tab the header row is
// col 1 = font + menu item color, col 2 = header background color. Lower the
// col 1 = font + text color in header, col 2 = header background color. Lower the
// background column so its option aligns with the color option in col 1:
// measure the vertical distance between the navbarfontcolor block's top and
// the background column's top and apply it as padding-top (robust against
@ -906,6 +906,18 @@ var ThemeOptions = function () {
if (diff > 0) { bgCol[0].style.paddingTop = diff + 'px'; }
};
// THEME ADDITION (row 142): re-measure the header column alignment when the
// Top-of-page tab is (re)shown or the window resizes — at page load that pane
// is usually hidden (display:none), where getBoundingClientRect returns 0 and
// no offset would be applied, so the one-shot run() call alone is not enough.
var bindHeaderAlignTriggers = function () {
document.addEventListener('shown.bs.tab', function (e) {
var t = e.target && e.target.getAttribute ? e.target.getAttribute('data-bs-target') : null;
if (t === '#top-of-page') { setTimeout(alignHeaderColumns, 0); }
});
window.addEventListener('resize', function () { alignHeaderColumns(); });
};
// Shared delegated handlers for ALL chooser dropdowns (row 122/135): a REAL user
// change event bubbles natively to document even when an earlier direct handler
// threw (jQuery only aborts synthetic triggers), so the active outline still moves
@ -986,9 +998,10 @@ var ThemeOptions = function () {
});
safeStep('bindColorModeDelegates', bindColorModeDelegates);
// THEME ADDITION (row 136): align the header background color (col 2) with
// the menu item color option (col 1) in the Top-of-the-page tab
// THEME ADDITION (row 136/142): align the header background color (col 2) with
// the text color option (col 1) in the Top-of-the-page tab
safeStep('alignHeaderColumns', alignHeaderColumns);
safeStep('bindHeaderAlignTriggers', bindHeaderAlignTriggers);
// THEME ADDITION (row 133): restore the options tab the user was on before
// Save (after a save the page reloads on the first tab)
@ -1033,7 +1046,12 @@ var ThemeOptions = function () {
var restoreActiveTab = function () {
try {
var id = sessionStorage.getItem(tabStorageKey());
if (id) { activateTab(id); }
if (id) {
activateTab(id);
// row 142: if the restored tab is Top-of-page, re-measure the header
// column alignment now that the pane is visible
if (id === 'tab-top-of-page') { setTimeout(alignHeaderColumns, 0); }
}
} catch (e) { /* storage unavailable — keep the first tab */ }
};
var bindTabPersistence = function () {

View file

@ -43,7 +43,7 @@
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control).
Re-register it with a version token: bump OPTIONS_JS_TOKEN below whenever
options/options.js changes, so every browser fetches the new file once. #}
{% set OPTIONS_JS_TOKEN = '20261126.16' %}
{% set OPTIONS_JS_TOKEN = '20261126.17' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
@ -371,7 +371,7 @@
{% elseif bTopPane %}
{% if key in aLogoKeys %}{% set fSlot = 'logo' %}
{# row 136: header row layout — col 1 = font (headerfont) with the
menu item color (navbarfontcolor + custom) stacked below it,
text color in header (navbarfontcolor + custom) stacked below it,
col 2 = header background color (aligned with the color option
via a measured padding-top, see alignHeaderColumns in options.js),
col 3 = sticky. Slots: h1 opens the row + col 1 (further h1 keys