From 2ca9a3f3a5e870024d137098f0792d78e37b88c8 Mon Sep 17 00:00:00 2001 From: Pavan Thanuj Upadrasta <49611451+n00bcodr@users.noreply.github.com> Date: Wed, 29 Oct 2025 11:37:06 +0530 Subject: [PATCH] Prevent duplicate watchlist links being added to the sidebar for Jellyfin-Enhanced/issues/124 (#4) --- utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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');