Inject U-Navigator into main navigation
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
PLUGIN="u-navigator"
|
PLUGIN="u-navigator"
|
||||||
VERSION="0.2.1"
|
VERSION="0.2.2"
|
||||||
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,4 +1,4 @@
|
|||||||
Menu="U-Navigator"
|
Menu="Tools"
|
||||||
Title="U-Navigator"
|
Title="U-Navigator"
|
||||||
Icon="folder-open"
|
Icon="folder-open"
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
Menu="Buttons:99"
|
||||||
|
Title="U-Navigator"
|
||||||
|
Icon="icon-u-folder"
|
||||||
|
Code="f07b"
|
||||||
|
---
|
||||||
|
<script>
|
||||||
|
(() => {
|
||||||
|
const targetHref = '/Tools/U-Navigator';
|
||||||
|
const targetText = 'U-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 item = wrapper.cloneNode(true);
|
||||||
|
const link = item.tagName === 'A' ? item : item.querySelector('a');
|
||||||
|
if (!link) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
link.href = targetHref;
|
||||||
|
link.textContent = targetText;
|
||||||
|
link.setAttribute('data-u-navigator-nav', 'true');
|
||||||
|
link.classList.remove('active', 'selected');
|
||||||
|
item.classList?.remove('active', 'selected');
|
||||||
|
wrapper.insertAdjacentElement('afterend', item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', injectUNavigatorNav);
|
||||||
|
} else {
|
||||||
|
injectUNavigatorNav();
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE PLUGIN [
|
<!DOCTYPE PLUGIN [
|
||||||
<!ENTITY name "u-navigator">
|
<!ENTITY name "u-navigator">
|
||||||
<!ENTITY author "michael">
|
<!ENTITY author "michael">
|
||||||
<!ENTITY version "0.2.1">
|
<!ENTITY version "0.2.2">
|
||||||
<!ENTITY package "&name;-&version;.tgz">
|
<!ENTITY package "&name;-&version;.tgz">
|
||||||
]>
|
]>
|
||||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<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>07964e296752a1f40eaf1930dfe2bdbf</MD5>
|
<MD5>0cb8fe513addbd7435a8c79107ae7973</MD5>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
|
||||||
<FILE Run="/bin/bash">
|
<FILE Run="/bin/bash">
|
||||||
|
|||||||
Reference in New Issue
Block a user