@@ -21,7 +21,6 @@ export function setupPageFunctionality () {
2121
2222 document . onmouseup = enableScrolling
2323
24-
2524 const music = document . getElementById ( "music" ) ;
2625 music . volume = 0.2 ;
2726 const playButtonContainer = document . getElementsByClassName ( "playbutton__container" ) [ 0 ] ;
@@ -32,7 +31,7 @@ export function setupPageFunctionality () {
3231 const playPause = ( ) => {
3332 if ( ! isPlaying ) {
3433 isPlaying = true ;
35-
34+ music . src = 'https://res.cloudinary.com/thepranaygupta/video/upload/v1643119296/moosync/bg-music_x3sspk.mp3'
3635 music . play ( ) ;
3736 playButton . title = "Pause" ;
3837 playButtonIcon . src = "./assets/img/pausebutton.svg" ;
@@ -68,39 +67,57 @@ export function setupPageFunctionality () {
6867let toggleStatus = true ;
6968
7069export function setupLoginModalFunctionality ( ) {
71- const loginModal = document . getElementById ( 'login-modal' )
72- const loginModalPreLogin = document . getElementById ( 'login-modal-prelogin' )
73- const loginModalPostLogin = document . getElementById ( 'login-modal-postlogin' )
74-
75- const loginModalCloseButton = document . getElementById ( 'login-modal-close' )
76- const loginModalPlatformTextPost = document . getElementById ( 'login-modal-platform-text-post' )
77- const loginModalPlatformTextPre = document . getElementById ( 'login-modal-platform-text-pre' )
78- const loginButton = document . getElementById ( 'login-button' )
79-
8070 const providerMatch = getProviderFromURL ( ) [ 0 ] ;
8171 if ( providerMatch ) {
8272 const color = getProviderColor ( providerMatch )
83- loginModalPlatformTextPost . innerHTML = providerMatch
84- loginModalPlatformTextPost . style . color = color
8573
86- loginModalPlatformTextPre . innerHTML = providerMatch
87- loginModalPlatformTextPre . style . color = color
74+ const loginModal = document . createElement ( 'div' )
75+ loginModal . classList . add ( 'modal' )
76+ loginModal . id = 'login-modal'
77+ loginModal . innerHTML = `
78+ <div class="modal-content">
79+ <span id="login-modal-close" class="close">×</span>
80+ <div id="login-modal-postlogin">
81+ <div class="modal-content-text" id="login-modal-content">
82+ Thank you for logging in to
83+ <span id="login-modal-platform-text-post" style="color:${ color } ;">${ providerMatch } </span>.<br />
84+ You may now close this window<br />
85+ and enjoy your experience.
86+ <br />
87+ <br />
88+ Alternatively, You may enter this code
89+ <div id="oauth-code" class="oauth-code">${ getQueryParams ( ) } </div>
90+ </div>
91+ </div>
92+ <div id="login-modal-prelogin">
93+ <p class="modal-content-text" id="login-modal-content">
94+ Do you want to login to
95+ <span id="login-modal-platform-text-pre" style="color:${ color } ;">${ providerMatch } </span>?
96+ <button title="Login" id="login-button" class="link__buttons login__button">
97+ Click to open Moosync
98+ </button>
99+ </p>
100+ </div>
101+ </div>`
102+
103+ const body = document . getElementById ( 'body' )
104+ body . append ( loginModal )
105+
106+ const loginButton = document . getElementById ( 'login-button' )
107+ const loginModalPostLogin = document . getElementById ( 'login-modal-postlogin' )
108+ const loginModalPreLogin = document . getElementById ( 'login-modal-prelogin' )
109+ const closeButton = document . getElementById ( 'login-modal-close' )
88110
89- const oauthCodeManual = document . getElementById ( 'oauth-code' )
90- if ( oauthCodeManual ) {
91- oauthCodeManual . innerText = getQueryParams ( )
92- }
93111
94112 // Try to open popup
95113 openPopupAndHandleModal ( loginModalPostLogin , loginModalPreLogin , providerMatch , false )
96114
97115 loginButton . style . backgroundColor = color
98116 loginButton . onclick = ( ) => openPopupAndHandleModal ( loginModalPostLogin , loginModalPreLogin , providerMatch , true )
117+ closeButton . onclick = ( ) => loginModal . style . display = 'none'
99118
100119 loginModal . style . display = "block"
101120 }
102-
103- loginModalCloseButton . onclick = ( ) => loginModal . style . display = "none"
104121}
105122
106123function openPopupAndHandleModal ( loginModalPostLogin , loginModalPreLogin , provider , showWarning ) {
@@ -114,9 +131,10 @@ function openPopupAndHandleModal (loginModalPostLogin, loginModalPreLogin, provi
114131}
115132
116133function openMoosync ( provider , showWarning ) {
117- const res = window . open ( "moosync://" + getProviderRedirectURL ( provider ) + getQueryParams ( ) )
134+ // const res = window.open("moosync://" + getProviderRedirectURL(provider) + getQueryParams())
135+ const res = true
118136 if ( res ) {
119- window . history . replaceState ( null , null , '/' )
137+ // window.history.replaceState(null, null, '/')
120138 } else {
121139 if ( showWarning ) {
122140 alert ( 'Failed to open Moosync. Check for blocked popup' )
0 commit comments