mirror of
https://github.com/ranaldsgift/KefinTweaks.git
synced 2026-11-05 15:52:47 +01:00
Properly handle viewMoreUrl for Spotlight sections
This commit is contained in:
+40
-3
@@ -659,9 +659,46 @@
|
||||
|
||||
// Add section title in top left corner (absolute positioning, aligned with controls)
|
||||
if (title) {
|
||||
const sectionTitleEl = document.createElement('div');
|
||||
sectionTitleEl.className = 'spotlight-section-title';
|
||||
sectionTitleEl.textContent = title;
|
||||
let sectionTitleEl;
|
||||
|
||||
if (viewMoreUrl) {
|
||||
// Create clickable title
|
||||
const titleLink = document.createElement('a');
|
||||
titleLink.className = 'spotlight-section-title spotlight-title-link';
|
||||
titleLink.textContent = title;
|
||||
titleLink.title = 'See All';
|
||||
titleLink.style.textDecoration = 'none';
|
||||
|
||||
const cssStyle = document.createElement('style');
|
||||
cssStyle.textContent = `
|
||||
.spotlight-title-link:hover {
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
`;
|
||||
titleLink.appendChild(cssStyle);
|
||||
|
||||
// Handle both URL and function
|
||||
if (typeof viewMoreUrl === 'function') {
|
||||
titleLink.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
viewMoreUrl();
|
||||
});
|
||||
} else {
|
||||
titleLink.href = viewMoreUrl;
|
||||
titleLink.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
});
|
||||
}
|
||||
|
||||
sectionTitleEl = titleLink;
|
||||
} else {
|
||||
// Regular non-clickable title
|
||||
sectionTitleEl = document.createElement('div');
|
||||
sectionTitleEl.className = 'spotlight-section-title';
|
||||
sectionTitleEl.textContent = title;
|
||||
}
|
||||
|
||||
bannerContainer.appendChild(sectionTitleEl);
|
||||
}
|
||||
|
||||
|
||||
@@ -5649,6 +5649,9 @@
|
||||
case 'Parent':
|
||||
viewMoreUrl = `#/list.html?parentId=${source}&serverId=${ApiClient.serverId()}`;
|
||||
break;
|
||||
case 'Tag':
|
||||
viewMoreUrl = `#/list.html?type=tag&tag=${source}&serverId=${ApiClient.serverId()}`;
|
||||
break;
|
||||
default:
|
||||
viewMoreUrl = null;
|
||||
break;
|
||||
@@ -5671,7 +5674,8 @@
|
||||
interval: 5000,
|
||||
showDots: true,
|
||||
showNavButtons: true,
|
||||
showClearArt: true
|
||||
showClearArt: true,
|
||||
viewMoreUrl: viewMoreUrl
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user