()
| 3887 | separator.style.cssText = 'height: 1px; background-color: #444; margin: 4px 0;'; |
| 3888 | dropdown.appendChild(separator); |
| 3889 | } else { |
| 3890 | const menuItem = document.createElement('div'); |
| 3891 | menuItem.textContent = item.label; |
| 3892 | menuItem.style.cssText = 'padding: 8px 12px; color: #e0e0e0; cursor: pointer; font-size: 13px;'; |
| 3893 | menuItem.onmouseover = () => menuItem.style.backgroundColor = '#3a3a3a'; |
| 3894 | menuItem.onmouseout = () => menuItem.style.backgroundColor = 'transparent'; |
| 3895 | menuItem.onclick = () => { |
| 3896 | if (item.action) { |
| 3897 | item.action(); |
| 3898 | } |
| 3899 | dropdown.style.display = 'none'; |
| 3900 | }; |
| 3901 | dropdown.appendChild(menuItem); |
| 3902 | } |
| 3903 | }); |
| 3904 | |
| 3905 | menuButton.onclick = (e) => { |
| 3906 | e.stopPropagation(); |
| 3907 | const isVisible = dropdown.style.display === 'block'; |
| 3908 | // Close all other dropdowns |
| 3909 | document.querySelectorAll('#server-menu-bar [style*="display: block"]').forEach(el => { |
| 3910 | if (el !== dropdown && el.style.display === 'block') el.style.display = 'none'; |
| 3911 | }); |
| 3912 | dropdown.style.display = isVisible ? 'none' : 'block'; |
| 3913 | }; |
| 3914 | |
| 3915 | // Close dropdown when clicking outside |
| 3916 | document.addEventListener('click', (e) => { |
| 3917 | if (!menuContainer.contains(e.target)) { |
| 3918 | dropdown.style.display = 'none'; |
| 3919 | } |
| 3920 | }); |
| 3921 | |
| 3922 | menuContainer.appendChild(menuButton); |
| 3923 | menuContainer.appendChild(dropdown); |
| 3924 | |
| 3925 | return menuContainer; |
| 3926 | } |
| 3927 | |
| 3928 | // Show/hide direction description paragraphs when "Use folder path" dropdown changes (STL Home dialog) |
| 3929 | function updateStlHomePathDirectionDesc() { |
| 3930 | const sel = document.getElementById('stl-home-path-direction'); |
| 3931 | const fromModelDesc = document.getElementById('stl-home-path-desc-from-model'); |
| 3932 | const fromRootDesc = document.getElementById('stl-home-path-desc-from-root'); |
| 3933 | if (!sel || !fromModelDesc || !fromRootDesc) return; |
| 3934 | const isFromRoot = sel.value === 'fromRoot'; |
| 3935 | fromModelDesc.style.display = isFromRoot ? 'none' : ''; |
| 3936 | fromRootDesc.style.display = isFromRoot ? '' : 'none'; |
| 3937 | } |
| 3938 | window.updateStlHomePathDirectionDesc = updateStlHomePathDirectionDesc; |
| 3939 | |
| 3940 | // Gray out path-metadata options when "Enable" is unchecked (used by STL Home dialog) |
| 3941 | function updateStlHomePathMetadataGrayed() { |
| 3942 | const enableEl = document.getElementById('stl-home-path-metadata-enabled'); |
| 3943 | const optionsEl = document.getElementById('stl-home-path-metadata-options'); |
| 3944 | if (optionsEl) optionsEl.classList.toggle('grayed', !enableEl?.checked); |
| 3945 | } |
| 3946 | window.updateStlHomePathMetadataGrayed = updateStlHomePathMetadataGrayed; |
no outgoing calls
no test coverage detected