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:
parent
53a11e14e1
commit
cd62f2f752
2 changed files with 26 additions and 8 deletions
|
|
@ -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 () {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue