Prevent duplicate watchlist links being added to the sidebar for Jellyfin-Enhanced/issues/124 (#4)

This commit is contained in:
Pavan Thanuj Upadrasta
2025-10-29 02:07:06 -04:00
committed by GitHub
parent 629f524b4c
commit 2ca9a3f3a5
+9
View File
@@ -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');