-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup-script.js
62 lines (56 loc) · 2.13 KB
/
popup-script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const firebaseConfig = {
apiKey: "AIzaSyD6yakn5Ie4bkQcLX19IJ5psE0MZf6nR9Y",
authDomain: "bubble-pop-d8817.firebaseapp.com",
projectId: "bubble-pop-d8817",
storageBucket: "bubble-pop-d8817.appspot.com",
messagingSenderId: "388115621219",
appId: "1:388115621219:web:19f48d23c17a2046af9f56",
measurementId: "G-QDS5ZKHPV8"
};
firebase.initializeApp(firebaseConfig);
const ui = new firebaseui.auth.AuthUI(firebase.auth());
// Initialize the FirebaseUI Widget using Firebase.
const uiConfig = {
callbacks: {
signInSuccessWithAuthResult: function (authResult, redirectUrl) {
chrome.runtime.sendMessage({ message: 'sign_in' }, function (response) {
if (response.message === 'success') {
window.location.replace('./welcome.html');
}
});
return false;
},
uiShown: function () {
document.getElementById('my_sign_in').style.display = 'none';
document.getElementById('wrapper').style.pointerEvents = 'none';
}
},
signInFlow: 'popup',
// signInSuccessUrl: '<url-to-redirect-to-on-success>',
signInOptions: [
// Leave the lines as is for the providers you want to offer your users.
{
provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
customParameters: {
prompt: 'select_account'
}
}
],
// Terms of service url.
// tosUrl: '<your-tos-url>',
// Privacy policy url.
// privacyPolicyUrl: '<your-privacy-policy-url>'
};
document.querySelector('#wrapper').addEventListener('click', () => {
ui.start('#sign_in_options', uiConfig);
});
document.querySelector('#wrapper').addEventListener('mouseover', () => {
let sign_in = document.querySelector('#my_sign_in');
sign_in.classList.remove('sign_in_no_hover');
sign_in.classList.add('sign_in_hover');
});
document.querySelector('#wrapper').addEventListener('mouseleave', () => {
let sign_in = document.querySelector('#my_sign_in');
sign_in.classList.remove('sign_in_hover');
sign_in.classList.add('sign_in_no_hover');
});