-
Notifications
You must be signed in to change notification settings - Fork 0
/
reviews.html
367 lines (326 loc) · 17.1 KB
/
reviews.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!DOCTYPE html>
<html lang="en">
<head>
<title>Reviews | Amith Polineni</title>
<meta property="og:title" content="Reviews - AmithP.com" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<meta property="twitter:card" content="summary_large_image" />
<style data-tag="reset-style-sheet">
html {
line-height: 1.15;
}
body {
margin: 0;
}
* {
box-sizing: border-box;
border-width: 0;
border-style: solid;
}
p,
li,
ul,
pre,
div,
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
padding: 0;
}
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
font-size: 100%;
line-height: 1.15;
margin: 0;
}
button,
select {
text-transform: none;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
button:-moz-focus,
[type="button"]:-moz-focus,
[type="reset"]:-moz-focus,
[type="submit"]:-moz-focus {
outline: 1px dotted ButtonText;
}
a {
color: inherit;
text-decoration: inherit;
}
input {
padding: 2px 4px;
}
img {
display: block;
}
html {
scroll-behavior: smooth
}
</style>
<style data-tag="default-style-sheet">
html {
font-family: Roboto;
font-size: 16px;
}
body {
font-weight: 400;
font-style: normal;
text-decoration: none;
text-transform: none;
letter-spacing: normal;
line-height: 1.15;
color: var(--black);
background-color: var(--teal);
}
</style>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
data-tag="font" />
<link rel="stylesheet" href="./style.css" />
<link rel="icon" href="images/robot_favicon.png">
</head>
<body>
<div>
<link href="./reviews.css" rel="stylesheet" />
<div class="reviews-container">
<nav class="nav">
<div class="logo">
<img alt="image" src="images/amith_square.png" class="face reviews-face" />
<h1 class="reviews-amithpolineni amithpolineni">Amith Polineni</h1>
</div>
<div class="links">
<a href="/" class="nav-link">
<span>HOME</span>
</a>
<a href="reviews" class="nav-link nav-link-underline">REVIEWS</a>
</div>
</nav>
<div class="reviews-special-reviews">
<h1 class="page-tittle">Randomly Chosen</h1>
<div id="randComments" class="comments">
<div></div>
<div class="loader-box">
<div class="loader"></div>
</div>
</div>
</div>
<div class="reviews-review-maker">
<div class="reviews-review-prompt">
<h1 class="reviews-review-prompt-name">Leave a Review!</h1>
<span class="reviewInstructions">Name & Color</span>
<div class="reviews-name-and-color">
<input type="text" id="name" placeholder="Name" class="reviews-name input" />
<input type="color" id="color" value="#FF0000" class="reviews-color input" />
</div>
<span class="reviewInstructions">Comment:</span>
<textarea id="comment" placeholder="Write your comment here!" class="reviews-comment1 textarea"></textarea>
<button id="post" name="post" type="submit" class="reviews-post button">
Post
</button>
</div>
<div class="reviews-live-review">
<div class="comment">
<div id="liveName" class="comment-name">
Your Name Here
</div>
<div id="liveComment" class="commentDesc">
Your comment here!
</div>
</div>
</div>
</div>
<div class="reviews-all-reviews">
<h1 class="page-tittle">All Reviews</h1>
<div id="allComments" class="comments">
<div></div>
<div class="loader-box">
<div class="loader"></div>
</div>
</div>
<div id="load-more-button">
<button id="load-more" name="load-more" type="submit" class="reviews-loadMore button">
Load More
</button>
</div>
</div>
<footer class="footer">
<img alt="image" src="images/amith_square.png" class="footerImg" />
<span class="footerCredit">© Amith Polineni | 2024</span>
<div class="footerContact">
<div class="footerSocials">
<a href="https://www.linkedin.com/in/amithpolineni/" target="_blank" rel="noreferrer noopener">
<svg viewBox="0 0 877.7142857142857 1024" class="social-icon">
<path
d="M135.429 808h132v-396.571h-132v396.571zM276 289.143c-0.571-38.857-28.571-68.571-73.714-68.571s-74.857 29.714-74.857 68.571c0 37.714 28.571 68.571 73.143 68.571h0.571c46.286 0 74.857-30.857 74.857-68.571zM610.286 808h132v-227.429c0-121.714-65.143-178.286-152-178.286-70.857 0-102.286 39.429-119.429 66.857h1.143v-57.714h-132s1.714 37.143 0 396.571v0h132v-221.714c0-11.429 0.571-23.429 4-32 9.714-23.429 31.429-48 68-48 47.429 0 66.286 36 66.286 89.714v212zM877.714 237.714v548.571c0 90.857-73.714 164.571-164.571 164.571h-548.571c-90.857 0-164.571-73.714-164.571-164.571v-548.571c0-90.857 73.714-164.571 164.571-164.571h548.571c90.857 0 164.571 73.714 164.571 164.571z">
</path>
</svg>
</a>
<a href="https://twitter.com/AmithPolineni" target="_blank" rel="noreferrer noopener">
<svg viewBox="0 0 877.7142857142857 1024" class="social-icon">
<path
d="M731.429 348.571c-21.714 9.714-44.571 16-69.143 19.429 25.143-14.857 44-38.857 53.143-66.857-23.429 13.714-49.143 24-76.571 29.143-21.714-23.429-53.143-37.714-87.429-37.714-66.286 0-120 53.714-120 120 0 9.143 0.571 18.857 2.857 27.429-100-5.143-188.571-52.571-248-125.714-10.286 17.714-16.571 38.857-16.571 60.571 0 41.714 19.429 78.286 52 100-20-0.571-38.857-6.286-57.143-14.857v1.143c0 58.286 44 106.857 98.857 117.714-10.286 2.857-18.286 4.571-29.143 4.571-7.429 0-14.857-1.143-22.286-2.286 15.429 47.429 59.429 82.286 112 83.429-41.143 32-92.571 51.429-149.143 51.429-9.714 0-19.429-0.571-28.571-1.714 53.143 33.714 116 53.714 184 53.714 220.571 0 341.714-182.857 341.714-341.714 0-5.143 0-10.286-0.571-15.429 23.429-16.571 44-37.714 60-62.286zM877.714 237.714v548.571c0 90.857-73.714 164.571-164.571 164.571h-548.571c-90.857 0-164.571-73.714-164.571-164.571v-548.571c0-90.857 73.714-164.571 164.571-164.571h548.571c90.857 0 164.571 73.714 164.571 164.571z">
</path>
</svg>
</a>
<a href="https://www.facebook.com/Amith.Polineni25/" target="_blank" rel="noreferrer noopener">
<svg viewBox="0 0 877.7142857142857 1024" class="social-icon">
<path
d="M713.143 73.143c90.857 0 164.571 73.714 164.571 164.571v548.571c0 90.857-73.714 164.571-164.571 164.571h-107.429v-340h113.714l17.143-132.571h-130.857v-84.571c0-38.286 10.286-64 65.714-64l69.714-0.571v-118.286c-12-1.714-53.714-5.143-101.714-5.143-101.143 0-170.857 61.714-170.857 174.857v97.714h-114.286v132.571h114.286v340h-304c-90.857 0-164.571-73.714-164.571-164.571v-548.571c0-90.857 73.714-164.571 164.571-164.571h548.571z">
</path>
</svg>
</a>
<a href="https://github.com/FrenchFry-King25" target="_blank" rel="noreferrer noopener">
<svg viewBox="0 0 877.7142857142857 1024" class="social-icon">
<path
d="M296.571 685.714v0c1.143-1.714 0.571-5.143-1.714-7.429-2.857-2.286-6.286-2.857-8-1.143-1.143 1.714-0.571 5.143 1.714 7.429 2.857 2.286 6.286 2.857 8 1.143zM280.571 662.286c-1.714-2.286-4.571-3.429-6.857-2.286-1.714 1.143-1.714 4.571 0 6.857 2.286 2.857 5.143 4 6.857 2.857v0c1.714-1.143 1.714-4.571 0-7.429zM257.143 639.429v0c0.571-1.143-0.571-3.429-2.857-4.571-1.714-0.571-4-0.571-4.571 1.143-1.143 1.714 0 3.429 2.286 4.571 2.286 0.571 4.571 0.571 5.143-1.143zM269.143 652.571v0c1.143-1.143 1.143-4-1.143-5.714-1.714-2.286-4.571-2.857-5.714-1.714-1.714 1.714-1.143 4 0.571 6.286 1.714 1.714 4.571 2.857 6.286 1.143zM318.286 695.429v0c0.571-2.286-1.714-5.143-5.143-6.286s-6.286 0-7.429 2.286c-0.571 2.286 1.714 5.143 5.143 6.286s6.286 0 7.429-2.286zM342.286 697.143v0c0-2.286-2.857-4.571-6.857-4.571-3.429 0-5.714 2.286-5.714 4.571s2.857 4.571 6.286 4.571 6.286-2.286 6.286-4.571zM364.571 693.143v0c-0.571-2.286-4-3.429-7.429-2.857s-5.714 2.857-5.143 5.143 3.429 4 6.857 3.429 5.714-3.429 5.714-5.714zM731.429 512c0-161.714-130.857-292.571-292.571-292.571s-292.571 130.857-292.571 292.571c0 129.143 84 238.857 200 277.714 14.857 2.857 20-6.286 20-14.286 0-6.857 0-29.714-0.571-54.286 0 0-81.143 17.714-98.286-34.857 0 0-13.143-33.714-32.571-42.286 0 0-26.286-18.286 2.286-18.286 0 0 28.571 2.286 44.571 30.286 25.714 45.143 68.571 32 85.143 24.571 2.857-18.857 10.286-32 18.857-39.429-65.143-7.429-133.714-32.571-133.714-144.571 0-32 11.429-57.714 30.286-78.286-2.857-7.429-13.143-37.143 2.857-77.714 24.571-7.429 80.571 30.286 80.571 30.286 23.429-6.857 48-9.714 73.143-9.714s49.714 2.857 73.143 9.714c0 0 56-37.714 80.571-30.286 16 40.571 5.714 70.286 2.857 77.714 18.857 20.571 30.286 46.286 30.286 78.286 0 112.571-68.571 137.143-133.714 144.571 10.286 9.143 20 26.857 20 54.286 0 38.857-0.571 70.286-0.571 80 0 8 5.143 17.143 20 14.286 116-38.857 200-148.571 200-277.714zM877.714 237.714v548.571c0 90.857-73.714 164.571-164.571 164.571h-548.571c-90.857 0-164.571-73.714-164.571-164.571v-548.571c0-90.857 73.714-164.571 164.571-164.571h548.571c90.857 0 164.571 73.714 164.571 164.571z">
</path>
</svg>
</a>
<a href="https://www.instagram.com/amith_polineni/" target="_blank" rel="noreferrer noopener">
<svg viewBox="0 0 877.7142857142857 1024" class="reviews-footer-social4 social-icon">
<path
d="M585.143 512c0-80.571-65.714-146.286-146.286-146.286s-146.286 65.714-146.286 146.286 65.714 146.286 146.286 146.286 146.286-65.714 146.286-146.286zM664 512c0 124.571-100.571 225.143-225.143 225.143s-225.143-100.571-225.143-225.143 100.571-225.143 225.143-225.143 225.143 100.571 225.143 225.143zM725.714 277.714c0 29.143-23.429 52.571-52.571 52.571s-52.571-23.429-52.571-52.571 23.429-52.571 52.571-52.571 52.571 23.429 52.571 52.571zM438.857 152c-64 0-201.143-5.143-258.857 17.714-20 8-34.857 17.714-50.286 33.143s-25.143 30.286-33.143 50.286c-22.857 57.714-17.714 194.857-17.714 258.857s-5.143 201.143 17.714 258.857c8 20 17.714 34.857 33.143 50.286s30.286 25.143 50.286 33.143c57.714 22.857 194.857 17.714 258.857 17.714s201.143 5.143 258.857-17.714c20-8 34.857-17.714 50.286-33.143s25.143-30.286 33.143-50.286c22.857-57.714 17.714-194.857 17.714-258.857s5.143-201.143-17.714-258.857c-8-20-17.714-34.857-33.143-50.286s-30.286-25.143-50.286-33.143c-57.714-22.857-194.857-17.714-258.857-17.714zM877.714 512c0 60.571 0.571 120.571-2.857 181.143-3.429 70.286-19.429 132.571-70.857 184s-113.714 67.429-184 70.857c-60.571 3.429-120.571 2.857-181.143 2.857s-120.571 0.571-181.143-2.857c-70.286-3.429-132.571-19.429-184-70.857s-67.429-113.714-70.857-184c-3.429-60.571-2.857-120.571-2.857-181.143s-0.571-120.571 2.857-181.143c3.429-70.286 19.429-132.571 70.857-184s113.714-67.429 184-70.857c60.571-3.429 120.571-2.857 181.143-2.857s120.571-0.571 181.143 2.857c70.286 3.429 132.571 19.429 184 70.857s67.429 113.714 70.857 184c3.429 60.571 2.857 120.571 2.857 181.143z">
</path>
</svg>
</a>
</div>
<a href="mailto:[email protected]?subject=" class="footerEmail">
Email: [email protected]
</a>
</div>
</footer>
</div>
</div>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.1.3/firebase-app.js";
import { getDatabase, ref, set, onValue } from "https://www.gstatic.com/firebasejs/9.1.3/firebase-database.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyDEaObgoUZAEDzjWPc0xfROaOcXw0Abswc",
authDomain: "amith-s-reviews.firebaseapp.com",
databaseURL: "https://amith-s-reviews-default-rtdb.firebaseio.com",
projectId: "amith-s-reviews",
storageBucket: "amith-s-reviews.appspot.com",
messagingSenderId: "796801060722",
appId: "1:796801060722:web:85077c088729a3eba017eb"
};
const app = initializeApp(firebaseConfig);
const database = getDatabase(app);
var loadnum = 12;
var values = [];
const starCountRef = ref(database, "friend/");
var index = 0;
onValue(starCountRef, (snapshot) => {
var data = snapshot.val();
//console.log(data);
values = Object.values(data);
index = values.length + 1
// console.log(values)
document.getElementById("randComments").innerHTML = "";
document.getElementById("allComments").innerHTML = "";
loadRandos();
loadPosts(0);
});
const starCountRef2 = ref(database, "waitlist/");
var waitList_index = 0;
onValue(starCountRef2, (snapshot) => {
var data = snapshot.val();
//console.log(data);
WaitlistValues = Object.values(data);
waitList_index += WaitlistValues.length
});
document.getElementById("load-more").addEventListener('click', () => {
let tempLoadnum = loadnum;
loadnum += 6;
loadPosts(tempLoadnum);
});
function loadRandos() {
var taken = [-1, -1, 0, 2];
for (var i = 0; i < 3; i++) {
var newIndex = Math.floor(Math.random() * values.length);
if (taken.includes(newIndex))
i--;
else {
taken[i] = newIndex;
var comment = document.createElement('div');
comment.setAttribute('class', 'comment');
var commentName = document.createElement('div');
commentName.setAttribute('class', 'comment-name');
commentName.appendChild(document.createTextNode(values[newIndex].name));
commentName.style.color = values[newIndex].color;
var commentDesc = document.createElement('div');
commentDesc.setAttribute('class', 'comment-desc-comment');
commentDesc.appendChild(document.createTextNode(values[newIndex].comment));
comment.appendChild(commentName);
comment.appendChild(commentDesc);
console.log("random " + i + " " + values[newIndex].name);
document.getElementById("randComments").appendChild(comment);
}
}
}
function loadPosts(start) {
//console.log("loadNum" + loadnum)
//console.log("start" + start)
// we want to load the posts from the end of the array so newest appear on the top
for (let i = (values.length - start - 1); i >= (values.length - loadnum); i--) {
//console.log("values index" + i)
//console.log(index)
if (i < 0) {
console.log("done");
document.getElementById("load-more-button").innerHTML = "";
break;
}
var comment = document.createElement('div');
comment.setAttribute('class', 'comment');
var commentName = document.createElement('div');
commentName.setAttribute('class', 'comment-name');
commentName.appendChild(document.createTextNode(values[i].name));
commentName.style.color = values[i].color;
var commentDesc = document.createElement('div');
commentDesc.setAttribute('class', 'comment-desc-comment');
commentDesc.appendChild(document.createTextNode(values[i].comment));
comment.appendChild(commentName);
comment.appendChild(commentDesc);
//console.log("js generated commment" + comment);
document.getElementById("allComments").appendChild(comment);
}
}
//start of my code
post.addEventListener('click', (e) => {
var name = document.getElementById('name').value;
var color = document.getElementById('color').value;
var comment = document.getElementById('comment').value;
if (name.length > 0) {
set(ref(database, "waitlist/" + name), {
name: name,
color: color,
comment: comment
});
}
alert('Your Review has been added to the waitlist! I\'ll add you to the database once I confirm you\'re someone I know. Contact me if there are any issues.');
});
document.getElementById("name").oninput = function () { document.getElementById("liveName").innerHTML = document.getElementById('name').value };
document.getElementById("color").oninput = function () { document.getElementById("liveName").style.color = document.getElementById('color').value; };
document.getElementById("comment").oninput = function () { document.getElementById("liveComment").innerHTML = document.getElementById('comment').value };
</script>
</body>
</html>