function getMenuItems(category: HTMLOListElement): MenuItem[] {
return Array.from(category.querySelectorAll(".acpPageSubMenuLink")).map((link: HTMLAnchorElement) => {
+ const children = getMenuItemActions(link);
+
return {
active: link.classList.contains("active"),
- children: [],
+ children,
counter: 0,
depth: 2,
link: link.href,
});
}
+function getMenuItemActions(link: HTMLAnchorElement): MenuItem[] {
+ const listItem = link.parentElement!;
+ if (!listItem.classList.contains("acpPageSubMenuLinkWrapper")) {
+ return [];
+ }
+
+ return Array.from(listItem.querySelectorAll(".acpPageSubMenuIcon")).map((action: HTMLAnchorElement) => {
+ return {
+ active: action.classList.contains("active"),
+ children: [],
+ counter: 0,
+ depth: 2,
+ link: action.href,
+ title: action.dataset.tooltip || action.title,
+ };
+ });
+}
+
export class AcpUiPageMenuMainBackend implements PageMenuMainProvider {
getMenuItems(_container: HTMLElement): MenuItem[] {
const menu = document.getElementById("acpPageMenu")!;
let children: MenuItem[] = [];
if (subMenu instanceof HTMLOListElement) {
let childDepth = depth;
- if (childDepth < 2) {
+ if (childDepth < 3) {
childDepth = (depth + 1) as MenuItemDepth;
}
* @woltlabExcludeBundle all
*/
-export type MenuItemDepth = 0 | 1 | 2;
+export type MenuItemDepth = 0 | 1 | 2 | 3;
export type MenuItem = {
active: boolean;
}
function getMenuItems(category) {
return Array.from(category.querySelectorAll(".acpPageSubMenuLink")).map((link) => {
+ const children = getMenuItemActions(link);
return {
active: link.classList.contains("active"),
- children: [],
+ children,
counter: 0,
depth: 2,
link: link.href,
};
});
}
+ function getMenuItemActions(link) {
+ const listItem = link.parentElement;
+ if (!listItem.classList.contains("acpPageSubMenuLinkWrapper")) {
+ return [];
+ }
+ return Array.from(listItem.querySelectorAll(".acpPageSubMenuIcon")).map((action) => {
+ return {
+ active: action.classList.contains("active"),
+ children: [],
+ counter: 0,
+ depth: 2,
+ link: action.href,
+ title: action.dataset.tooltip || action.title,
+ };
+ });
+ }
class AcpUiPageMenuMainBackend {
getMenuItems(_container) {
const menu = document.getElementById("acpPageMenu");
let children = [];
if (subMenu instanceof HTMLOListElement) {
let childDepth = depth;
- if (childDepth < 2) {
+ if (childDepth < 3) {
childDepth = (depth + 1);
}
children = Array.from(subMenu.children).map((subMenuItem) => {
.pageMenuMainItem[data-depth="2"] {
.pageMenuMainItemList {
- padding: 0;
+ padding: 0 10px;
}
.pageMenuMainItemLabel,