mirror of
https://github.com/ranaldsgift/KefinTweaks.git
synced 2026-11-05 15:52:47 +01:00
Prevent duplicate watchlist links being added to the sidebar for Jellyfin-Enhanced/issues/124 (#4)
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user