PageSourceSearch

https://joes.homes/wp-content/plugins/IDXPlugin/public/js/firebase-init.js?ver=1790278310

js joes.homes collected 2026-10-04 01:32:49 UTC 3,651 bytes, 88 lines download raw bytes

1 
2import { initializeApp } from 'https://www.gstatic.com/firebasejs/10.14.0/firebase-app.js';
3import { getAuth, signInWithEmailAndPassword, createUserWithEmailAndPassword, GoogleAuthProvider, signInWithPopup, sendSignInLinkToEmail, isSignInWithEmailLink, signInWithEmailLink, onAuthStateChanged, signOut } from 'https://www.gstatic.com/firebasejs/10.14.0/firebase-auth.js';
4import { getFirestore, doc, setDoc, getDoc } from 'https://www.gstatic.com/firebasejs/10.14.0/firebase-firestore.js';
5
6
7if (typeof firebaseConfig === 'undefined') {
8    console.error('Firebase configuration is not defined. Please check your plugin settings.'); 
9} else {
10    const app = initializeApp(firebaseConfig);
11    const db = getFirestore(app);
12    const auth = getAuth(app);
13
14    window.firebaseAuth = auth;
15    window.db = db;
16    window.signInWithEmailAndPassword = signInWithEmailAndPassword;
17    window.createUserWithEmailAndPassword = createUserWithEmailAndPassword;
18    window.setDoc = setDoc;
19    window.doc = doc;
20    window.getDoc = getDoc;
21    window.sendSignInLinkToEmail = sendSignInLinkToEmail;
22    window.isSignInWithEmailLink = isSignInWithEmailLink;
23    window.signInWithEmailLink = signInWithEmailLink;
24    window.onAuthStateChanged = onAuthStateChanged;
25    window.firebaseSignOut = signOut;
26
27} 
28
29 
30const provider = new GoogleAuthProvider();
31window.signInWithGoogle = function () {
32    if (typeof firebaseConfig === 'undefined') {
33        console.error('Firebase configuration is not defined. Cannot perform Google Sign-In.');
34        return Promise.reject('Firebase configuration missing');
35    }
36    return signInWithPopup(window.firebaseAuth, provider);
37};
38
39
40document.addEventListener('DOMContentLoaded', () => {
41    if (typeof firebaseConfig !== 'undefined') {
42        console.log('Firebase configuration loaded successfully.');
43    }
44});
45
46// Signal to other scripts that Firebase auth is ready.
47// Module scripts run after DOMContentLoaded, so other scripts can't rely on
48// DOMContentLoaded to know when window.firebaseAuth is set.
49window.firebaseAuthReady = true;
50window.dispatchEvent(new CustomEvent('firebaseReady'));
51
52
53document.getElementById('auth-login-btn')?.addEventListener('click', function () {
54    const email = document.getElementById('auth-email').value;
55    const password = document.getElementById('auth-password').value;
56
57    if (email && password) {
58        window.signInWithEmailAndPassword(window.firebaseAuth, email, password)
59            .then((userCredential) => {
60                const user = userCredential.user;
61                document.getElementById('auth-message').textContent = 'Logged in as ' + user.email;
62            })
63            .catch((error) => {
64                document.getElementById('auth-message').textContent = 'Error: ' + error.message;
65            });
66    } else {
67        alert('Please enter both email and password.');
68    }
69});
70
71
72document.getElementById('auth-signup-btn')?.addEventListener('click', function () {
73    const email = document.getElementById('auth-email').value;
74    const password = document.getElementById('auth-password').value;
75
76    if (email && password) {
77        window.createUserWithEmailAndPassword(window.firebaseAuth, email, password)
78            .then((userCredential) => {
79                const user = userCredential.user;
80                document.getElementById('auth-message').textContent = 'Account created for ' + user.email;
81            })
82            .catch((error) => {
83                document.getElementById('auth-message').textContent = 'Error: ' + error.message;
84            });
85    } else {
86        alert('Please enter both email and password.');
87    }
88});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.