@@ -673,6 +673,68 @@ window.Spicetify = {
673
673
674
674
if ( ! Spicetify . ContextMenuV2 . _context ) Spicetify . ContextMenuV2 . _context = Spicetify . React . createContext ( { } ) ;
675
675
676
+ ( function waitForChunks ( ) {
677
+ const listOfComponents = [
678
+ "ScrollableContainer" ,
679
+ "Slider" ,
680
+ "Toggle" ,
681
+ "Cards.Artist" ,
682
+ "Cards.Audiobook" ,
683
+ "Cards.Profile" ,
684
+ "Cards.Show" ,
685
+ "Cards.Track" ,
686
+ ] ;
687
+ if ( listOfComponents . every ( ( component ) => Spicetify . ReactComponent [ component ] !== undefined ) ) return ;
688
+ const cache = Object . keys ( require . m ) . map ( ( id ) => require ( id ) ) ;
689
+ const modules = cache
690
+ . filter ( ( module ) => typeof module === "object" )
691
+ . flatMap ( ( module ) => {
692
+ try {
693
+ return Object . values ( module ) ;
694
+ } catch { }
695
+ } ) ;
696
+ const functionModules = modules . filter ( ( module ) => typeof module === "function" ) ;
697
+ const cardTypesToFind = [ "artist" , "audiobook" , "profile" , "show" , "track" ] ;
698
+ const cards = [
699
+ ...functionModules
700
+ . flatMap ( ( m ) => {
701
+ return cardTypesToFind . map ( ( type ) => {
702
+ if ( m . toString ( ) . includes ( `featureIdentifier:"${ type } "` ) ) {
703
+ cardTypesToFind . splice ( cardTypesToFind . indexOf ( type ) , 1 ) ;
704
+ return [ type [ 0 ] . toUpperCase ( ) + type . slice ( 1 ) , m ] ;
705
+ }
706
+ } ) ;
707
+ } )
708
+ . filter ( Boolean ) ,
709
+ ...modules
710
+ . flatMap ( ( m ) => {
711
+ return cardTypesToFind . map ( ( type ) => {
712
+ try {
713
+ if ( m ?. type ?. toString ( ) . includes ( `featureIdentifier:"${ type } "` ) ) {
714
+ cardTypesToFind . splice ( cardTypesToFind . indexOf ( type ) , 1 ) ;
715
+ return [ type [ 0 ] . toUpperCase ( ) + type . slice ( 1 ) , m ] ;
716
+ }
717
+ } catch { }
718
+ } ) ;
719
+ } )
720
+ . filter ( Boolean ) ,
721
+ ] ;
722
+
723
+ Spicetify . ReactComponent . Slider = wrapProvider ( functionModules . find ( ( m ) => m . toString ( ) . includes ( "progressBarRef" ) ) ) ;
724
+ Spicetify . ReactComponent . Toggle = functionModules . find ( ( m ) => m . toString ( ) . includes ( "onSelected" ) && m . toString ( ) . includes ( 'type:"checkbox"' ) ) ;
725
+ Spicetify . ReactComponent . ScrollableContainer = functionModules . find (
726
+ ( m ) => m . toString ( ) . includes ( "scrollLeft" ) && m . toString ( ) . includes ( "showButtons" )
727
+ ) ;
728
+ Object . assign ( Spicetify . ReactComponent . Cards , Object . fromEntries ( cards ) ) ;
729
+
730
+ if ( ! listOfComponents . every ( ( component ) => Spicetify . ReactComponent [ component ] !== undefined ) ) {
731
+ setTimeout ( waitForChunks , 100 ) ;
732
+ return ;
733
+ }
734
+
735
+ if ( Spicetify . ReactComponent . ScrollableContainer ) setTimeout ( refreshNavLinks ?. ( ) , 100 ) ;
736
+ } ) ( ) ;
737
+
676
738
( function waitForSnackbar ( ) {
677
739
if ( ! Object . keys ( Spicetify . Snackbar ) . length ) {
678
740
setTimeout ( waitForSnackbar , 100 ) ;
@@ -1845,10 +1907,13 @@ Spicetify._renderNavLinks = (list, isTouchScreenUi) => {
1845
1907
const [ refreshCount , refresh ] = Spicetify . React . useReducer ( ( x ) => x + 1 , 0 ) ;
1846
1908
refreshNavLinks = refresh ;
1847
1909
1910
+ console . log ( Spicetify . ReactComponent . ScrollableContainer ) ;
1911
+
1848
1912
if (
1849
1913
! Spicetify . ReactComponent . ButtonTertiary ||
1850
1914
! Spicetify . ReactComponent . Navigation ||
1851
1915
! Spicetify . ReactComponent . TooltipWrapper ||
1916
+ ! Spicetify . ReactComponent . ScrollableContainer ||
1852
1917
! Spicetify . Platform . History ||
1853
1918
! Spicetify . Platform . LocalStorageAPI
1854
1919
)
0 commit comments