Use native Navigator top menu entry

This commit is contained in:
Mikei386
2026-06-23 14:18:17 +02:00
parent 4d48f1665e
commit 49da6c88eb
7 changed files with 11 additions and 68 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
set -eu set -eu
PLUGIN="u-navigator" PLUGIN="u-navigator"
VERSION="2026.06.23.r035" VERSION="2026.06.23.r036"
PKG_DIR="packages" PKG_DIR="packages"
WORK_DIR=".plugin-build" WORK_DIR=".plugin-build"
PKG_NAME="${PLUGIN}-${VERSION}.tgz" PKG_NAME="${PLUGIN}-${VERSION}.tgz"
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,10 @@
Menu="Tools" Menu="Tasks:99"
Title="U-Navigator" Name="Navigator"
Icon="u-navigator/u-navigator.svg" Icon="u-navigator/u-navigator.svg"
Type="xmenu"
Tabs="true"
Code="f07b"
Tag="Navigator U-Navigator Unraid File Navigator files explorer"
--- ---
<?PHP <?PHP
$plugin = "u-navigator"; $plugin = "u-navigator";
@@ -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>
+3 -2
View File
@@ -1,7 +1,7 @@
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name "u-navigator"> <!ENTITY name "u-navigator">
<!ENTITY author "Michael Roll"> <!ENTITY author "Michael Roll">
<!ENTITY version "2026.06.23.r035"> <!ENTITY version "2026.06.23.r036">
<!ENTITY package "&name;-&version;.tgz"> <!ENTITY package "&name;-&version;.tgz">
<!ENTITY pluginURL "https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg"> <!ENTITY pluginURL "https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
<!ENTITY support "https://git.casaderoll.de/michael/Unraid-Navigator"> <!ENTITY support "https://git.casaderoll.de/michael/Unraid-Navigator">
@@ -24,13 +24,14 @@
<FILE Name="/boot/config/plugins/&name;/&package;"> <FILE Name="/boot/config/plugins/&name;/&package;">
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL> <URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
<MD5>e2a3296496baf42be1d6695613c30275</MD5> <MD5>5ddb77ea5e8b2d4d9ca48060a002c8c3</MD5>
</FILE> </FILE>
<FILE Run="/bin/bash"> <FILE Run="/bin/bash">
<INLINE> <INLINE>
mkdir -p /boot/config/plugins/&name; mkdir -p /boot/config/plugins/&name;
tar -xzf /boot/config/plugins/&name;/&package; -C / tar -xzf /boot/config/plugins/&name;/&package; -C /
rm -f /usr/local/emhttp/plugins/&name;/U-NavigatorNav.page
find /boot/config/plugins/&name; -type f -name "&name;-*.tgz" ! -name "&package;" -delete find /boot/config/plugins/&name; -type f -name "&name;-*.tgz" ! -name "&package;" -delete
echo "" echo ""
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"
+1
View File
@@ -31,6 +31,7 @@
<INLINE> <INLINE>
mkdir -p /boot/config/plugins/&name; mkdir -p /boot/config/plugins/&name;
tar -xzf /boot/config/plugins/&name;/&package; -C / tar -xzf /boot/config/plugins/&name;/&package; -C /
rm -f /usr/local/emhttp/plugins/&name;/U-NavigatorNav.page
find /boot/config/plugins/&name; -type f -name "&name;-*.tgz" ! -name "&package;" -delete find /boot/config/plugins/&name; -type f -name "&name;-*.tgz" ! -name "&package;" -delete
echo "" echo ""
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"