@@ -338,9 +338,11 @@ <h2 class="text-xl font-bold mb-4">Create QR Codes from Playlist</h2>
338338 document . getElementById ( 'playlistModal' ) . style . display = 'none' ;
339339 }
340340
341- // Add this to initialize the slider
342- document . getElementById ( 'songSlider' ) . addEventListener ( 'input' , function ( e ) {
343- document . getElementById ( 'songCount' ) . textContent = e . target . value ;
341+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
342+ document . getElementById ( 'songSlider' ) . addEventListener ( 'input' , function ( e ) {
343+ document . getElementById ( 'songCount' ) . textContent = e . target . value ;
344+ } ) ;
345+ document . getElementById ( 'createQRButton' ) . onclick = showPlaylistModal ;
344346 } ) ;
345347
346348 async function processPlaylist ( ) {
@@ -397,18 +399,14 @@ <h2 class="text-xl font-bold mb-4">Create QR Codes from Playlist</h2>
397399 }
398400 }
399401
400- // Update the click handler for the createQRButton
401- document . getElementById ( 'createQRButton' ) . onclick = showPlaylistModal ;
402-
403402 function initializePlayer ( token ) {
404403 document . getElementById ( 'setup' ) . classList . add ( 'hidden' ) ;
405404 document . getElementById ( 'player' ) . classList . remove ( 'hidden' ) ;
406405 localStorage . setItem ( 'spotify_access_token' , token ) ;
406+
407407 playerInstance = new Spotify . Player ( {
408408 name : 'Development Player' ,
409- getOAuthToken : cb => {
410- cb ( token ) ;
411- }
409+ getOAuthToken : cb => { cb ( token ) ; }
412410 } ) ;
413411
414412 playerInstance . addListener ( 'ready' , async ( { device_id } ) => {
@@ -453,7 +451,6 @@ <h2 class="text-xl font-bold mb-4">Create QR Codes from Playlist</h2>
453451 } ) ;
454452
455453 document . getElementById ( 'pauseResumeButton' ) . onclick = togglePauseResume ;
456- document . getElementById ( 'createQRButton' ) . onclick = createQRCodesFromPlaylist ;
457454 playerInstance . connect ( ) ;
458455 }
459456
0 commit comments