diff --git a/utils.js b/utils.js index 7fbc8dd..c4dec8f 100644 --- a/utils.js +++ b/utils.js @@ -236,6 +236,15 @@ */ function addLinkToContainer(container, name, icon, url, openInNewTab) { try { + // Check if link already exists to prevent duplicates + const existingLinks = container.querySelectorAll('a[href="' + url + '"]'); + const existingByText = Array.from(container.querySelectorAll('.navMenuOptionText')).find(el => el.textContent === name); + + if (existingLinks.length > 0 || existingByText) { + LOG(`Custom menu link already exists, skipping: ${name}`); + return true; + } + // Create the menu link element const link = document.createElement('a'); link.setAttribute('is', 'emby-linkbutton');