Hermes Agent commited on
Commit
0f35f65
·
1 Parent(s): dc0ce3f

fix(ui): permanent card deduplication, blank poster fallback badges, topbar display timing, and mobile grid alignment

Browse files
Files changed (2) hide show
  1. apex/ui/abyss.css +79 -10
  2. apex/ui/spotlight-loader.js +64 -10
apex/ui/abyss.css CHANGED
@@ -4549,21 +4549,18 @@ body.show-apex-topbar #apex-tv-topbar,
4549
  }
4550
  }
4551
 
4552
- /* Never display topbar on splash screen, login screen, server selection, server mismatch, or wizard */
4553
- #loginPage ~ #apex-tv-topbar,
4554
- #serverMismatchPage ~ #apex-tv-topbar,
4555
- #selectServerPage ~ #apex-tv-topbar,
4556
- .serverMismatchPage #apex-tv-topbar,
4557
- #serverMismatchPage #apex-tv-topbar,
4558
- body:has(#serverMismatchPage) #apex-tv-topbar,
4559
- body:has(.serverMismatchPage) #apex-tv-topbar,
4560
  body:has(#loginPage:not(.hide)) #apex-tv-topbar,
4561
  body:has(.loginPage:not(.hide)) #apex-tv-topbar,
4562
  body:has(#selectServerPage:not(.hide)) #apex-tv-topbar,
4563
  body:has(.selectServerPage:not(.hide)) #apex-tv-topbar,
4564
  body:has(#forgotPasswordPage:not(.hide)) #apex-tv-topbar,
4565
- body:has(.manualLoginForm) #apex-tv-topbar,
4566
- body:has(.manualServerContainer) #apex-tv-topbar,
4567
  body:has(.splashLogo:not(.hide):not(:empty)) #apex-tv-topbar,
4568
  body.is-logged-out #apex-tv-topbar,
4569
  body.hide-apex-topbar #apex-tv-topbar,
@@ -5435,3 +5432,75 @@ div[data-category="cast"] .cardScalable,
5435
  justify-content: center !important;
5436
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6) !important;
5437
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4549
  }
4550
  }
4551
 
4552
+ /* Never display topbar on splash screen, login screen, server selection, server mismatch, wizard, or video */
4553
+ #loginPage:not(.hide) ~ #apex-tv-topbar,
4554
+ #serverMismatchPage:not(.hide) ~ #apex-tv-topbar,
4555
+ #selectServerPage:not(.hide) ~ #apex-tv-topbar,
4556
+ body:has(#serverMismatchPage:not(.hide)) #apex-tv-topbar,
4557
+ body:has(.serverMismatchPage:not(.hide)) #apex-tv-topbar,
 
 
4558
  body:has(#loginPage:not(.hide)) #apex-tv-topbar,
4559
  body:has(.loginPage:not(.hide)) #apex-tv-topbar,
4560
  body:has(#selectServerPage:not(.hide)) #apex-tv-topbar,
4561
  body:has(.selectServerPage:not(.hide)) #apex-tv-topbar,
4562
  body:has(#forgotPasswordPage:not(.hide)) #apex-tv-topbar,
4563
+ body:has(#itemDetailPage:not(.hide)) #apex-tv-topbar,
 
4564
  body:has(.splashLogo:not(.hide):not(:empty)) #apex-tv-topbar,
4565
  body.is-logged-out #apex-tv-topbar,
4566
  body.hide-apex-topbar #apex-tv-topbar,
 
5432
  justify-content: center !important;
5433
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6) !important;
5434
  }
5435
+
5436
+
5437
+ /* ========================================================
5438
+ APEX FALLBACK CARD POSTERS & MOBILE MULTI-COLUMN GRID
5439
+ ======================================================== */
5440
+ .apex-fallback-art {
5441
+ position: absolute !important;
5442
+ inset: 0 !important;
5443
+ display: flex !important;
5444
+ flex-direction: column !important;
5445
+ align-items: center !important;
5446
+ justify-content: center !important;
5447
+ padding: 12px 8px !important;
5448
+ text-align: center !important;
5449
+ background: linear-gradient(145deg, #181926 0%, #0e0f17 100%) !important;
5450
+ box-sizing: border-box !important;
5451
+ border-radius: 12px !important;
5452
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
5453
+ z-index: 1 !important;
5454
+ }
5455
+ .apex-art-icon {
5456
+ margin-bottom: 8px !important;
5457
+ opacity: 0.8 !important;
5458
+ }
5459
+ .apex-art-title {
5460
+ font-size: 0.78rem !important;
5461
+ font-weight: 600 !important;
5462
+ color: #ffffff !important;
5463
+ line-height: 1.25 !important;
5464
+ max-height: 2.5em !important;
5465
+ overflow: hidden !important;
5466
+ display: -webkit-box !important;
5467
+ -webkit-line-clamp: 2 !important;
5468
+ -webkit-box-orient: vertical !important;
5469
+ }
5470
+
5471
+ /* Multi-column grid for Series & Movies in library and catalog views (no single-column rows) */
5472
+ @media (max-width: 600px) and (orientation: portrait) {
5473
+ .itemsContainer-vertical,
5474
+ .itemsContainer-cards,
5475
+ .libraryPage .itemsContainer,
5476
+ #moviesPage .itemsContainer,
5477
+ #tvShowsPage .itemsContainer {
5478
+ display: grid !important;
5479
+ grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
5480
+ gap: 12px 10px !important;
5481
+ padding: 8px 12px !important;
5482
+ width: 100% !important;
5483
+ box-sizing: border-box !important;
5484
+ }
5485
+ .itemsContainer-vertical > .card,
5486
+ .itemsContainer-cards > .card,
5487
+ .libraryPage .card {
5488
+ width: 100% !important;
5489
+ max-width: 100% !important;
5490
+ margin: 0 !important;
5491
+ }
5492
+ }
5493
+ @media (orientation: landscape) and (max-height: 500px) {
5494
+ .itemsContainer-vertical,
5495
+ .itemsContainer-cards,
5496
+ .libraryPage .itemsContainer,
5497
+ #moviesPage .itemsContainer,
5498
+ #tvShowsPage .itemsContainer {
5499
+ display: grid !important;
5500
+ grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)) !important;
5501
+ gap: 12px 10px !important;
5502
+ padding: 8px 16px !important;
5503
+ width: 100% !important;
5504
+ box-sizing: border-box !important;
5505
+ }
5506
+ }
apex/ui/spotlight-loader.js CHANGED
@@ -721,6 +721,57 @@ function findHomeTab() {
721
  );
722
  }
723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  function ensureTopNavigation() {
725
  safe(function () {
726
  discoverLibraries();
@@ -763,30 +814,31 @@ function findHomeTab() {
763
  }
764
 
765
  if (tvTopbar) {
766
- var isVideo = !!document.querySelector(".videoPlayerContainer:not(.hide), #videoOsdPage:not(.hide), video");
 
767
  var hash = (window.location.hash || "").toLowerCase();
768
 
769
- // Strictly detect auth / startup / error / server mismatch pages
770
- var isMismatch = !!document.querySelector("#serverMismatchPage, .serverMismatchPage") || (document.body.innerText && document.body.innerText.indexOf("Server Mismatch") !== -1);
771
- var isAuthScreen = !!document.querySelector("#loginPage:not(.hide), .loginPage:not(.hide), #selectServerPage:not(.hide), .selectServerPage:not(.hide), .manualLoginForm, .manualServerContainer");
772
  var isAuthRoute = hash.indexOf("login") !== -1 || hash.indexOf("selectserver") !== -1 || hash.indexOf("servermismatch") !== -1 || hash.indexOf("forgotpassword") !== -1;
773
- var isDetailPage = !!document.querySelector("#itemDetailPage:not(.hide), .itemDetailPage:not(.hide)") || hash.indexOf("details") !== -1;
774
  var isSettingsRoute = hash.indexOf("dashboard") !== -1 || hash.indexOf("settings") !== -1;
775
 
776
- // Positive check for main catalog / home navigation
777
- var isHomeOrLibrary = !!document.querySelector("#indexPage, .homePage, #homeTab, .pageTabContent, .itemsContainer, iframe.featurediframe, #moviesPage, #tvShowsPage");
778
 
779
- if (isVideo || isMismatch || isAuthScreen || isAuthRoute || isDetailPage || isSettingsRoute) {
780
  tvTopbar.classList.remove("is-visible");
781
  document.body.classList.remove("show-apex-topbar");
782
  tvTopbar.style.display = "none";
783
  tvTopbar.style.visibility = "hidden";
784
- return;
785
- } else if (isHomeOrLibrary) {
786
  tvTopbar.classList.add("is-visible");
787
  document.body.classList.add("show-apex-topbar");
788
  tvTopbar.style.display = "flex";
789
  tvTopbar.style.visibility = "visible";
 
790
  }
791
  }
792
 
@@ -802,6 +854,8 @@ function findHomeTab() {
802
  ghostLogos[gl].remove();
803
  }
804
 
 
 
805
  // 1.5 Suppress and purge floating Play / Shuffle buttons from catalog/library views
806
  var strayPlayBtns = document.querySelectorAll(
807
  ':is(.view, .page, [data-role="page"], .libraryPage):not(#itemDetailPage):not(#videoOsdPage) :is(.btnPlay, .btnShuffle, button[data-action="playall"], button[data-action="shuffleall"], button[title*="Play all" i], button[title*="Shuffle all" i]), ' +
 
721
  );
722
  }
723
 
724
+
725
+ // ========================================================
726
+ // AUTOMATIC CARD DEDUPLICATION & FALLBACK ART ENRICHMENT
727
+ // ========================================================
728
+ function deduplicateAndEnrichCards() {
729
+ try {
730
+ var containers = document.querySelectorAll('.itemsContainer, .verticalSection .cardBoxParent, .section1, .section2, .section3, .section4, .section5, .section6, .section7');
731
+ containers.forEach(function(container) {
732
+ var cards = container.querySelectorAll('.card');
733
+ if (!cards || !cards.length) return;
734
+ var seen = {};
735
+ cards.forEach(function(card) {
736
+ var titleEl = card.querySelector('.cardText-first, .cardTitle, .cardText');
737
+ if (!titleEl) return;
738
+ var rawTitle = titleEl.textContent.trim();
739
+ var key = rawTitle.toLowerCase().replace(/[^a-z0-9]/g, '');
740
+ if (!key) return;
741
+
742
+ var hasImg = !!card.querySelector('img[src]:not([src=""])');
743
+
744
+ if (seen[key]) {
745
+ if (hasImg && !seen[key].hasImg) {
746
+ seen[key].card.remove();
747
+ seen[key] = { card: card, hasImg: hasImg };
748
+ } else {
749
+ card.remove();
750
+ }
751
+ } else {
752
+ seen[key] = { card: card, hasImg: hasImg };
753
+ }
754
+ });
755
+ });
756
+
757
+ // Enrich cards that lack poster images with structured visual cards
758
+ var blankCards = document.querySelectorAll('.card:not(.has-apex-poster)');
759
+ blankCards.forEach(function(card) {
760
+ var img = card.querySelector('img[src]:not([src=""])');
761
+ var imgContainer = card.querySelector('.cardImageContainer');
762
+ if (!img && imgContainer && !imgContainer.querySelector('.apex-fallback-art')) {
763
+ var titleEl = card.querySelector('.cardText-first, .cardTitle, .cardText');
764
+ var titleText = titleEl ? titleEl.textContent.trim() : 'Media';
765
+ var fallback = document.createElement('div');
766
+ fallback.className = 'apex-fallback-art';
767
+ fallback.innerHTML = '<div class="apex-art-icon"><svg viewBox="0 0 24 24" width="28" height="28" fill="rgba(255,255,255,0.7)"><path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"/></svg></div><div class="apex-art-title">' + titleText + '</div>';
768
+ imgContainer.appendChild(fallback);
769
+ card.classList.add('has-apex-poster');
770
+ }
771
+ });
772
+ } catch (e) {}
773
+ }
774
+
775
  function ensureTopNavigation() {
776
  safe(function () {
777
  discoverLibraries();
 
814
  }
815
 
816
  if (tvTopbar) {
817
+ var activePage = document.querySelector(".page:not(.hide), .view:not(.hide)");
818
+ var activeId = activePage ? activePage.id : "";
819
  var hash = (window.location.hash || "").toLowerCase();
820
 
821
+ var isVideo = !!document.querySelector(".videoPlayerContainer:not(.hide), #videoOsdPage:not(.hide)");
822
+ var isMismatch = !!document.querySelector("#serverMismatchPage:not(.hide), .serverMismatchPage:not(.hide)");
823
+ var isAuthScreen = !!document.querySelector("#loginPage:not(.hide), .loginPage:not(.hide), #selectServerPage:not(.hide), .selectServerPage:not(.hide)");
824
  var isAuthRoute = hash.indexOf("login") !== -1 || hash.indexOf("selectserver") !== -1 || hash.indexOf("servermismatch") !== -1 || hash.indexOf("forgotpassword") !== -1;
825
+ var isDetailPage = activeId === "itemDetailPage" || !!document.querySelector("#itemDetailPage:not(.hide), .itemDetailPage:not(.hide)") || hash.indexOf("details") !== -1;
826
  var isSettingsRoute = hash.indexOf("dashboard") !== -1 || hash.indexOf("settings") !== -1;
827
 
828
+ var isCatalog = activeId === "indexPage" || activeId === "moviesPage" || activeId === "tvShowsPage" ||
829
+ !!document.querySelector("#indexPage:not(.hide), .homePage:not(.hide), #moviesPage:not(.hide), #tvShowsPage:not(.hide), .libraryPage:not(.hide), #homeTab, .itemsContainer:not(.hide)");
830
 
831
+ if (isVideo || isMismatch || isAuthScreen || isAuthRoute || isDetailPage || isSettingsRoute || !isCatalog) {
832
  tvTopbar.classList.remove("is-visible");
833
  document.body.classList.remove("show-apex-topbar");
834
  tvTopbar.style.display = "none";
835
  tvTopbar.style.visibility = "hidden";
836
+ } else {
 
837
  tvTopbar.classList.add("is-visible");
838
  document.body.classList.add("show-apex-topbar");
839
  tvTopbar.style.display = "flex";
840
  tvTopbar.style.visibility = "visible";
841
+ tvTopbar.style.opacity = "1";
842
  }
843
  }
844
 
 
854
  ghostLogos[gl].remove();
855
  }
856
 
857
+ deduplicateAndEnrichCards();
858
+
859
  // 1.5 Suppress and purge floating Play / Shuffle buttons from catalog/library views
860
  var strayPlayBtns = document.querySelectorAll(
861
  ':is(.view, .page, [data-role="page"], .libraryPage):not(#itemDetailPage):not(#videoOsdPage) :is(.btnPlay, .btnShuffle, button[data-action="playall"], button[data-action="shuffleall"], button[title*="Play all" i], button[title*="Shuffle all" i]), ' +