@@ -5,8 +5,12 @@ const { setupSongControls } = require("./providers/song-controls-front");
55const { ipcRenderer } = require ( "electron" ) ;
66const is = require ( "electron-is" ) ;
77
8+ const { startingPages } = require ( "./providers/extracted-data" ) ;
9+
810const plugins = config . plugins . getEnabled ( ) ;
911
12+ const $ = document . querySelector . bind ( document ) ;
13+
1014let api ;
1115
1216plugins . forEach ( async ( [ plugin , options ] ) => {
@@ -79,14 +83,14 @@ document.addEventListener("DOMContentLoaded", () => {
7983} ) ;
8084
8185function listenForApiLoad ( ) {
82- api = document . querySelector ( '#movie_player' ) ;
86+ api = $ ( '#movie_player' ) ;
8387 if ( api ) {
8488 onApiLoaded ( ) ;
8589 return ;
8690 }
8791
8892 const observer = new MutationObserver ( ( ) => {
89- api = document . querySelector ( '#movie_player' ) ;
93+ api = $ ( '#movie_player' ) ;
9094 if ( api ) {
9195 observer . disconnect ( ) ;
9296 onApiLoaded ( ) ;
@@ -97,7 +101,7 @@ function listenForApiLoad() {
97101}
98102
99103function onApiLoaded ( ) {
100- const video = document . querySelector ( "video" ) ;
104+ const video = $ ( "video" ) ;
101105 const audioContext = new AudioContext ( ) ;
102106 const audioSource = audioContext . createMediaElementSource ( video ) ;
103107 audioSource . connect ( audioContext . destination ) ;
@@ -127,9 +131,15 @@ function onApiLoaded() {
127131 document . dispatchEvent ( new CustomEvent ( 'apiLoaded' , { detail : api } ) ) ;
128132 ipcRenderer . send ( 'apiLoaded' ) ;
129133
134+ // Navigate to "Starting page"
135+ const startingPage = config . get ( "options.startingPage" ) ;
136+ if ( startingPage && startingPages [ startingPage ] ) {
137+ $ ( 'ytmusic-app' ) ?. navigate_ ( startingPages [ startingPage ] ) ;
138+ }
139+
130140 // Remove upgrade button
131141 if ( config . get ( "options.removeUpgradeButton" ) ) {
132- const upgradeButton = document . querySelector ( 'ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]' )
142+ const upgradeButton = $ ( 'ytmusic-pivot-bar-item-renderer[tab-id="SPunlimited"]' )
133143 if ( upgradeButton ) {
134144 upgradeButton . style . display = "none" ;
135145 }
@@ -139,7 +149,7 @@ function onApiLoaded() {
139149 // Hide / Force show like buttons
140150 const likeButtonsOptions = config . get ( "options.likeButtons" ) ;
141151 if ( likeButtonsOptions ) {
142- const likeButtons = document . querySelector ( "ytmusic-like-button-renderer" ) ;
152+ const likeButtons = $ ( "ytmusic-like-button-renderer" ) ;
143153 if ( likeButtons ) {
144154 likeButtons . style . display =
145155 {
0 commit comments