Move Navigator out of Tools menu

This commit is contained in:
Mikei386
2026-06-23 14:09:56 +02:00
parent 53f2e645a9
commit 3b8976591c
7 changed files with 10 additions and 71 deletions
@@ -1,4 +1,4 @@
Menu="Tools"
Menu="Navigator"
Title="U-Navigator"
Icon="u-navigator/u-navigator.svg"
---
@@ -1,63 +0,0 @@
Menu="Buttons:99"
Title="Navigator"
Icon="icon-u-folder"
Code="f07b"
---
<script>
(() => {
const targetHref = '/Tools/U-Navigator';
const targetText = 'NAVIGATOR';
function normalize(text) {
return String(text || '').trim().toUpperCase();
}
function injectUNavigatorNav() {
if (document.querySelector('a[href="/Tools/U-Navigator"], a[data-u-navigator-nav="true"]')) {
return;
}
const links = [...document.querySelectorAll('a')];
const toolsLink = links.find((link) => {
const text = normalize(link.textContent);
const href = link.getAttribute('href') || '';
return text === 'WERKZEUGE' || text === 'TOOLS' || href === '/Tools';
});
if (!toolsLink) {
return;
}
const wrapper = toolsLink.parentElement?.tagName === 'LI' ? toolsLink.parentElement : toolsLink;
const isListItem = wrapper.tagName === 'LI';
const item = isListItem ? document.createElement('li') : document.createElement('a');
const link = isListItem ? document.createElement('a') : item;
link.className = toolsLink.className || '';
link.href = targetHref;
link.textContent = targetText;
link.setAttribute('data-u-navigator-nav', 'true');
link.classList.remove('active', 'selected', 'on');
if (isListItem) {
item.className = wrapper.className || '';
item.classList.remove('active', 'selected', 'on');
item.appendChild(link);
}
if (location.pathname === targetHref) {
toolsLink.classList.remove('active', 'selected', 'on');
wrapper.classList?.remove('active', 'selected', 'on');
link.classList.add('active');
item.classList?.add('active');
}
wrapper.insertAdjacentElement('afterend', item);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', injectUNavigatorNav);
} else {
injectUNavigatorNav();
}
})();
</script>