-
Notifications
You must be signed in to change notification settings - Fork 0
/
firebase.html
125 lines (115 loc) · 3.86 KB
/
firebase.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<meta charset="utf-8">
<title></title>
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100..800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
:root {
--background-color: #fff;
--text-color: #000;
--header-background: #666;
--header-color: #fff;
box-sizing: border-box;
font-family: "Lexend", "Helvetica Neue", "Helvetica", sans-serif;
font-size: 18px;
}
body {
background-color: var(--background-color);
color: var(--text-color);
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
header, footer {
background-color: var(--header-background);
color: var(--header-color);
}
header {
height: 0vh;
}
main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1 10 80vh;
}
footer {
height: 0vh;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js" integrity="sha512-fD9DI5bZwQxOi7MhYWnnNPlvXdp/2Pj3XSTRrFs5FQa4mizyGLnJcN6tuvUS6LbmgN1ut+XGSABKvjN0H6Aoow==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<main>
</main>
<script>
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyBD46eiABWftJ6WdJpFsQxF5iUknUoTFIo",
authDomain: "the-givehub.firebaseapp.com",
projectId: "the-givehub",
storageBucket: "the-givehub.firebasestorage.app",
messagingSenderId: "503214679990",
appId: "1:503214679990:web:88bb2bc6116709931ec317",
measurementId: "G-8SWNP3PJ94"
};
</script>
<script src="https://www.gstatic.com/firebasejs/ui/6.1.0/firebase-ui-auth__es.js"></script>
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/6.1.0/firebase-ui-auth.css" />
<script>
(function() {
const $ = str => document.querySelector(str);
const $$ = str => document.querySelectorAll(str);
const app = {
data: {},
state: {
loaded: false
},
init() {
app.state.loaded = true;
},
fetch(url, callback) {
fetch(url).then(response=>response.json()).then(data=>{
app.data = data;
app.state.loaded = true;
if (callback && typeof(callback) === "function") {
callback(data);
}
}).catch(error => console.error('Fetch error:', error));;
},
display(data, tgt) {
let out = "<table><thead><tr>";
const keys = Object.keys(data[0]);
if (keys) {
keys.forEach(key => {
out += `<th>${key}</th>`;
});
}
out += "</tr></thead><tbody>";
data.forEach(item=>{
out += `<tr>`;
keys.forEach(key => {
out += `<td>${item[key]}</td>`;
});
out += `</tr>`;
});
out += "</tbody></table>";
if (tgt) {
tgt.innerHTML = out;
}
return out;
}
}
window.app = app;
app.init();
})();
</script>
</body>
</html>