diff --git a/options/options.js b/options/options.js index 8e64e66..4e39775 100644 --- a/options/options.js +++ b/options/options.js @@ -887,6 +887,25 @@ var ThemeOptions = function () { if (customInput.length) { customInput.on('input change', refreshAll); } }; + // 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 + // 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 + // font-size/line-height differences — no hardcoded px). + var alignHeaderColumns = function () { + var row = globalForm.find('.top-section-header').first(); + if (!row.length) { return; } + var bgField = globalForm.find('#simple_edit_options_headerbackgroundcolor'); + var colorField = globalForm.find('#simple_edit_options_navbarfontcolor'); + if (!bgField.length || !colorField.length) { return; } + var bgCol = bgField.closest('.top-section-header .col-md-4'); + var colorWrap = colorField.closest('.mb-3'); + if (!bgCol.length || !colorWrap.length || !bgCol[0].getBoundingClientRect) { return; } + var diff = colorWrap[0].getBoundingClientRect().top - bgCol[0].getBoundingClientRect().top; + if (diff > 0) { bgCol[0].style.paddingTop = diff + 'px'; } + }; + // 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 @@ -967,6 +986,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 + safeStep('alignHeaderColumns', alignHeaderColumns); + // THEME ADDITION (row 133): restore the options tab the user was on before // Save (after a save the page reloads on the first tab) safeStep('restoreActiveTab', restoreActiveTab); diff --git a/options/options.twig b/options/options.twig index a2d8975..8e4ce98 100644 --- a/options/options.twig +++ b/options/options.twig @@ -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.14' %} +{% set OPTIONS_JS_TOKEN = '20261126.15' %} {{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} @@ -224,7 +224,7 @@ Values are stored per option key, so moving them here does not change any stored value. The order of this list is the order shown in the tab. #} {% set aTopOfPageKeys = [ - 'headerbackgroundcolor', 'headerbackgroundcolorcustom', 'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom', + 'headerfont', 'navbarfontcolor', 'navbarfontcolorcustom', 'headerbackgroundcolor', 'headerbackgroundcolorcustom', 'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile', 'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile', 'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile', @@ -370,11 +370,17 @@ {% endif %} {% elseif bTopPane %} {% if key in aLogoKeys %}{% set fSlot = 'logo' %} - {% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h1' %} - {% elseif key == 'headerbackgroundcolorcustom' %}{% set fSlot = 'h1' %} - {% elseif key == 'headerfont' %}{% set fSlot = 'hf' %} - {% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h2' %} - {% elseif key == 'navbarfontcolorcustom' %}{% set fSlot = 'h2' %} + {# row 136: header row layout — col 1 = font (headerfont) with the + menu item color (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 + stack in col 1), h2 = col 2, h3 = col 3. #} + {% elseif key == 'headerfont' %}{% set fSlot = 'h1' %} + {% elseif key == 'navbarfontcolor' %}{% set fSlot = 'h1' %} + {% elseif key == 'navbarfontcolorcustom' %}{% set fSlot = 'h1' %} + {% elseif key == 'headerbackgroundcolor' %}{% set fSlot = 'h2' %} + {% elseif key == 'headerbackgroundcolorcustom' %}{% set fSlot = 'h2' %} {% elseif key in aTopStickyKeys %}{% set fSlot = 'h3' %} {% elseif key == 'progressbarposition' %}{% set fSlot = 'ppos' %} {% elseif key == 'progressbarfont' %}{% set fSlot = 'pfont' %} @@ -399,9 +405,10 @@ {% endif %} {% else %} {# top-of-page transitions: close previous slot, open new slot. - Header: col 1 = h1, col 2 = hf stacked above h2, col 3 = h3. - Progress bar: first row = ppos in col 1, empty col 2, pfont in - col 3; then the colors row (pcol1/pcol2/pcol3). #} + Header (row 136): col 1 = h1 slot (headerfont + navbarfontcolor + stacked), col 2 = h2 slot (header background color), col 3 = h3 + (sticky). Progress bar: first row = ppos in col 1, empty col 2, + pfont in col 3; then the colors row (pcol1/pcol2/pcol3). #} {% if fLastSlot == 'h1' or fLastSlot == 'h2' %}
{{ gT("In this theme there are three positions for separate logos, but it is up to you which positions you want to fill.") }}
{{ gT("The progress bar can be switched on/off per survey in the survey settings. Here in this section you can choose how the progress bar looks when displayed.") }}