mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-26 00:29:18 +02:00
CSS: - Remove duplicate 'background' fallbacks in base.css, header.css, search.css (solid color declared before gradient — gradient always wins) - Remove duplicate 'padding' in admin.css .admin-import-log JS (biome --write safe fixes applied): - function() → arrow functions in all IIFEs and callbacks - forEach/callback → arrow functions - evaluePtrn → parseInt(x, 10) in admin-contacts-form.js - Cleaned label text in build.mjs lint step Remaining warnings are intentional: !important overrides, descending specificity (admin.css cascade), noUnusedVariables (functions exported to window/onclick), useTemplate style preference.
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
/**
|
|
* form-language-asterisk.js — Toggle the required asterisk on the languages
|
|
* fieldset based on whether language pills or checkbox selections exist.
|
|
*
|
|
* Reads the container id from data-search-container-id on the pill-search div.
|
|
*/
|
|
(() => {
|
|
var pillDiv = document.querySelector('[data-search-container-id]');
|
|
if (!pillDiv) return;
|
|
var containerId = pillDiv.getAttribute('data-search-container-id');
|
|
var container = document.getElementById(containerId);
|
|
if (!container) return;
|
|
var pills = container.querySelector('.tag-search-pills');
|
|
if (!pills) return;
|
|
|
|
function check() {
|
|
var asteriskEl = document.getElementById('languages-required-asterisk');
|
|
if (!asteriskEl) return;
|
|
var n = pills.querySelectorAll('.tag-pill').length;
|
|
var checkboxes = document.querySelectorAll(
|
|
'#languages-fieldset input[type="checkbox"]:checked'
|
|
);
|
|
asteriskEl.innerHTML =
|
|
n === 0 && checkboxes.length === 0
|
|
? ' <span class="asterisk">*</span>'
|
|
: '';
|
|
}
|
|
|
|
var observer = new MutationObserver(check);
|
|
observer.observe(pills, { childList: true });
|
|
check();
|
|
})();
|