Skip to content

Commit e39df36

Browse files
fuck
1 parent 32b9d17 commit e39df36

File tree

2 files changed

+56
-56
lines changed

2 files changed

+56
-56
lines changed

assets/js/firebase_init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function loadScript(url, callback) {
2727
loadScript('https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js', function () {
2828
window.onload = function () {
2929
console.log("%cYOU SHOULDN'T MESS AROUND HERE.", 'color:red; font-size: 28px;')
30-
console.log("If you know what you are doing, come volunteer with us!\nhttps://constellation.iamjerryhu.info/volunteer_positions.html")
30+
console.log("If you know what you are doing, come volunteer with us!\nhttps://constellationhub.org/volunteer_positions.html")
3131
}
3232

3333
window.resetApp = function resetApp() {

assets/js/index.js

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
document.addEventListener('DOMContentLoaded', function () {
2-
try {
3-
let db = firebase.firestore();
4-
let auth = firebase.auth();
5-
} catch {
6-
console.error('[ERROR] Unable to load firebase db & auth.')
7-
}
8-
9-
function switchBg(bg) {
10-
var images = {
11-
'bg1.jpg': 'Joshua Earle',
12-
'bg2.jpg': 'Martin Jernberg',
13-
'bg3.jpg': 'Juskteez Vu',
14-
't1.png': 'Jason Leung',
15-
't2.png': 'Pawel Czerwinski'
16-
};
1+
try {
2+
let db = firebase.firestore();
3+
let auth = firebase.auth();
4+
} catch {
5+
console.error('[ERROR] Unable to load firebase db & auth.')
6+
}
177

18-
if (bg) {
19-
var randomImage = bg;
20-
var photographer = images[bg];
21-
} else {
22-
var keys = Object.keys(images);
23-
var randomImage = keys[Math.floor(Math.random() * keys.length)];
24-
var photographer = images[randomImage];
8+
function switchBg(bg) {
9+
var images = {
10+
'bg1.jpg': 'Joshua Earle',
11+
'bg2.jpg': 'Martin Jernberg',
12+
'bg3.jpg': 'Juskteez Vu',
13+
't1.png': 'Jason Leung',
14+
't2.png': 'Pawel Czerwinski'
15+
};
2516

26-
auth.onAuthStateChanged(function (user) {
27-
if (user) {
28-
const userRef = db.collection('Users').doc(user.uid)
29-
userRef.update({
30-
bg: randomImage
31-
}).then(() => {
32-
console.log('Updated bg image.');
33-
}).catch((error) => {
34-
console.error(error);
35-
})
36-
}
37-
})
38-
}
17+
if (bg) {
18+
var randomImage = bg;
19+
var photographer = images[bg];
20+
} else {
21+
var keys = Object.keys(images);
22+
var randomImage = keys[Math.floor(Math.random() * keys.length)];
23+
var photographer = images[randomImage];
3924

40-
var body = document.getElementById('body');
41-
body.style.backgroundImage = 'url(/assets/img/index/' + randomImage + ')';
25+
auth.onAuthStateChanged(function (user) {
26+
if (user) {
27+
const userRef = db.collection('Users').doc(user.uid)
28+
userRef.update({
29+
bg: randomImage
30+
}).then(() => {
31+
console.log('Updated bg image.');
32+
}).catch((error) => {
33+
console.error(error);
34+
})
35+
}
36+
})
37+
}
38+
39+
var body = document.getElementById('body');
40+
body.style.backgroundImage = 'url(/assets/img/index/' + randomImage + ')';
4241

43-
var citation = document.getElementById('photo-citation')
44-
citation.innerHTML = 'Photo by ' + photographer + ' on <a href="https://unsplash.com" style="text-decoration: underline;">Unsplash</a>';
45-
citation.style.cursor = 'pointer';
42+
var citation = document.getElementById('photo-citation')
43+
citation.innerHTML = 'Photo by ' + photographer + ' on <a href="https://unsplash.com" style="text-decoration: underline;">Unsplash</a>';
44+
citation.style.cursor = 'pointer';
4645

47-
var aTag = citation.querySelector('a');
46+
var aTag = citation.querySelector('a');
47+
aTag.style.color = 'gray';
48+
aTag.style.transition = 'color 0.3s';
49+
aTag.addEventListener('mouseover', function () {
50+
aTag.style.color = 'white';
51+
});
52+
aTag.addEventListener('mouseout', function () {
4853
aTag.style.color = 'gray';
49-
aTag.style.transition = 'color 0.3s';
50-
aTag.addEventListener('mouseover', function () {
51-
aTag.style.color = 'white';
52-
});
53-
aTag.addEventListener('mouseout', function () {
54-
aTag.style.color = 'gray';
55-
});
56-
}
54+
});
55+
}
5756

57+
document.addEventListener('DOMContentLoaded', function () {
5858
try {
5959
firebase.auth().onAuthStateChanged(function (user) {
6060
const accountManagementLink = document.getElementById('accountMgnLink');
6161
const accountManagementText = document.getElementById('accountMgnText');
6262
const join_link = document.getElementById('join-link');
63-
63+
6464
if (user) {
6565
const userRef = db.collection('Users').doc(user.uid);
6666
const lastActive = firebase.firestore.FieldValue.serverTimestamp()
6767
userRef.set({
6868
lastActive: lastActive
6969
}, { merge: true });
70-
70+
7171
userRef.get().then((doc) => {
7272
if (doc.exists) {
7373
const data = doc.data();
@@ -78,17 +78,17 @@ document.addEventListener('DOMContentLoaded', function () {
7878
}).catch((error) => {
7979
console.log("Error getting document:", error);
8080
});
81-
81+
8282
accountManagementLink.onclick = function () { firebase.auth().signOut() }
8383
accountManagementText.innerText = 'Log Out';
84-
84+
8585
join_link.innerHTML = 'Chat Now';
8686
join_link.onclick = function () { window.location = '/chat.html' };
8787
} else {
8888
switchBg('bg3.jpg')
8989
accountManagementLink.onclick = function () { window.location = '/signin.html?redirect=/index.html' }
9090
accountManagementText.innerText = 'Log in';
91-
91+
9292
join_link.innerHTML = 'View our missions';
9393
join_link.onclick = function () { window.location = '/about.html' };
9494
}

0 commit comments

Comments
 (0)