@@ -673,6 +673,68 @@ window.Spicetify = {
673673
674674 if ( ! Spicetify . ContextMenuV2 . _context ) Spicetify . ContextMenuV2 . _context = Spicetify . React . createContext ( { } ) ;
675675
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+
676738 ( function waitForSnackbar ( ) {
677739 if ( ! Object . keys ( Spicetify . Snackbar ) . length ) {
678740 setTimeout ( waitForSnackbar , 100 ) ;
@@ -1845,10 +1907,13 @@ Spicetify._renderNavLinks = (list, isTouchScreenUi) => {
18451907 const [ refreshCount , refresh ] = Spicetify . React . useReducer ( ( x ) => x + 1 , 0 ) ;
18461908 refreshNavLinks = refresh ;
18471909
1910+ console . log ( Spicetify . ReactComponent . ScrollableContainer ) ;
1911+
18481912 if (
18491913 ! Spicetify . ReactComponent . ButtonTertiary ||
18501914 ! Spicetify . ReactComponent . Navigation ||
18511915 ! Spicetify . ReactComponent . TooltipWrapper ||
1916+ ! Spicetify . ReactComponent . ScrollableContainer ||
18521917 ! Spicetify . Platform . History ||
18531918 ! Spicetify . Platform . LocalStorageAPI
18541919 )
0 commit comments