Add open new page when configuring the menu

This commit is contained in:
Raven Scott
2024-09-26 18:19:30 -04:00
parent 2d89dcddf6
commit 6e02e0219a
5 changed files with 11 additions and 5 deletions

8
app.js
View File

@ -36,14 +36,20 @@ function loadMenuItems() {
const menuItems = [];
const titleRegex = /<!--\s*title:\s*(.*?)\s*-->/g;
const urlRegex = /<!--\s*url:\s*(.*?)\s*-->/g;
const openNewPageRegex = /<!--\s*openNewPage\s*-->/g;
let titleMatch;
let urlMatch;
let openNewPageMatch;
// Use a loop to find and process each menu item
while ((titleMatch = titleRegex.exec(content)) && (urlMatch = urlRegex.exec(content))) {
openNewPageMatch = openNewPageRegex.exec(content);
menuItems.push({
title: titleMatch[1],
url: urlMatch[1]
url: urlMatch[1],
openNewPage: openNewPageMatch !== null // If openNewPage exists, set it to true
});
}