forked from fa/breadcrumb-the-shire
CSS: - Remove duplicate li::before block in app-search.css - Fix typo: search-reuslt → search-result in app-search.css - Remove commented-out CSS rules in app-flash.css - Add descriptive header comment to all 27 CSS component files JS: - Complete WAI-ARIA Tabs pattern: generate IDs, add aria-controls on tab buttons and aria-labelledby on tab panels (app-tabs.js) - Add JSDoc header comments to ~33 JS files (core + components) - Add explanatory block comment to app-boot.js (why classic IIFE) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
1014 B
JavaScript
34 lines
1014 B
JavaScript
/**
|
|
* Tracks settings page interactions for telemetry.
|
|
*/
|
|
const initTelemetrySettings = () => {
|
|
const toggle = document.querySelector('[data-telemetry-enabled-toggle]');
|
|
const samplingFieldset = document.querySelector('[data-telemetry-sampling-fieldset]');
|
|
const samplingRow = document.querySelector('[data-telemetry-sampling-row]');
|
|
const samplingSelect = document.querySelector('[data-telemetry-sampling-select]');
|
|
|
|
if (!toggle || !samplingFieldset) {
|
|
return;
|
|
}
|
|
|
|
const syncSamplingVisibility = () => {
|
|
const active = Boolean(toggle.checked);
|
|
samplingFieldset.hidden = !active;
|
|
if (samplingRow) {
|
|
samplingRow.hidden = !active;
|
|
}
|
|
if (samplingSelect) {
|
|
samplingSelect.disabled = !active || toggle.disabled;
|
|
}
|
|
};
|
|
|
|
toggle.addEventListener('change', syncSamplingVisibility);
|
|
syncSamplingVisibility();
|
|
};
|
|
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', initTelemetrySettings);
|
|
} else {
|
|
initTelemetrySettings();
|
|
}
|