-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
431 lines (390 loc) · 14.9 KB
/
index.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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:image" content="https://news.codeinblogs.co/logo.png">
<meta property="og:type" content="website">
<meta property="og:url" content="https://news.codeinblogs.co/">
<link rel="shortcut icon" href="./icon.png" type="image/x-icon">
<title>CodeINBlogs News</title>
<!---css style-->
<link rel="stylesheet" href="./style.css" />
<!-- other -->
<!--font awesome-->
<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" />
<!--Google font-->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600&display=swap"
rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.css">
</head>
<body>
<div id="authenticate-form" class="authenticate-form hide">
<div class="forms-out">
<div class="forms-in">
<div id="registration-page" class="hide">
<button id="show-login">Sign In</button>
<h3>Sign Up</h3>
Email <br />
<input type="email" id="registration-email" /><br />
Confirm Email <br />
<input type="email" id="registration-reemail" autocomplete="disable" /><br />
Password <br />
<input type="password" id="registration-password" /><br />
<center><button id="register">Sign Up</button></center>
</div>
<div id="login-page">
<button id="show-register">Sign Up</button>
<h3>Sign In</h3>
Email <br />
<input type="email" id="login-email" /><br />
Password <br />
<input type="password" id="login-password" /><br />
<p id="forgot-password">Forgot Password</p>
<center><button id="login">Sign In</button></center>
</div>
<div id="homepage" class="hide">
<button id="signout">Sign Out</button>
<h3>Logged In</h3>
</div>
</div>
</div>
</div>
<header>
<img src="./logo.png" width="120px" style="border-radius: 10px;" />
<div class="inputSearch desktop">
<form id="searchForm">
<input type="text" placeholder="Type to search..." id="searchInput" />
<span> <i class="fa-solid fa-search"></i></span>
</form>
</div>
<nav class="desktop">
<ul>
<li onclick="Search('tech')">Tech</li>
<li onclick="Search('AI & ML')">AI ML</li>
<li onclick="Search('business')">Business</li>
</ul>
</nav>
<div class="custom-select">
<select id="countrySelect">
<option value="in" selected>India (Default)</option>
<option value="au">Australia</option>
<option value="br">Brazil</option>
<option value="ca">Canada</option>
<option value="cn">China</option>
<option value="eg">Egypt</option>
<option value="fr">France</option>
<option value="de">Germany</option>
<option value="gr">Greece</option>
<option value="hk">Hong Kong</option>
<option value="ie">Ireland</option>
<option value="il">Israel</option>
<option value="it">Italy</option>
<option value="jp">Japan</option>
<option value="nl">Netherlands</option>
<option value="no">Norway</option>
<option value="pk">Pakistan</option>
<option value="pe">Peru</option>
<option value="ph">Philippines</option>
<option value="pt">Portugal</option>
<option value="ro">Romania</option>
<option value="ru">Russian Federation</option>
<option value="sg">Singapore</option>
<option value="es">Spain</option>
<option value="se">Sweden</option>
<option value="ch">Switzerland</option>
<option value="tw">Taiwan</option>
<option value="ua">Ukraine</option>
<option value="gb">United Kingdom</option>
<option value="us">United States</option>
</select>
</div>
<button class="authenticate-btn" id="auth-btn">Log In</button>
<div id="user-greeting" class="user-greeting hide" style="color: whitesmoke;">
Hi <span id="user-username"></span>!
</div>
<div class="menuBtn">
<i class="fa-solid fa-bars"></i>
</div>
<!------>
<div class="mobile hidden">
<nav>
<ul>
<li onclick="Search('tech')">Tech</li>
<li onclick="Search('AI & ML')">AI ML</li>
<li onclick="Search('business')">Business</li>
</ul>
</nav>
<div class="inputSearch">
<form id="searchFormMobile" id="searchInputMobile">
<input type="text" placeholder="Type to search..." />
<span> <i class="fa-solid fa-search"></i></span>
</form>
</div>
<div class="custom-select-mobile" style="display: block; ">
<select id="countrySelectMobile">
<option value="in" selected>India (Default)</option>
<option value="au">Australia</option>
<option value="br">Brazil</option>
<option value="ca">Canada</option>
<option value="cn">China</option>
<option value="eg">Egypt</option>
<option value="fr">France</option>
<option value="de">Germany</option>
<option value="gr">Greece</option>
<option value="hk">Hong Kong</option>
<option value="ie">Ireland</option>
<option value="il">Israel</option>
<option value="it">Italy</option>
<option value="jp">Japan</option>
<option value="nl">Netherlands</option>
<option value="no">Norway</option>
<option value="pk">Pakistan</option>
<option value="pe">Peru</option>
<option value="ph">Philippines</option>
<option value="pt">Portugal</option>
<option value="ro">Romania</option>
<option value="ru">Russian Federation</option>
<option value="sg">Singapore</option>
<option value="es">Spain</option>
<option value="se">Sweden</option>
<option value="ch">Switzerland</option>
<option value="tw">Taiwan</option>
<option value="ua">Ukraine</option>
<option value="gb">United Kingdom</option>
<option value="us">United States</option>
</select>
</div>
</div>
<button class="authenticate-btn authenticate-btn-mobile" id="auth-btn">Log In</button>
</header>
<div id="user-greeting" class="user-greeting user-greeting-mobile hide" style="color: whitesmoke;">
Hi <span id="user-username"></span>!
</div>
<!-- main -->
<center>
<span class="loader" id="loader">Getting Latest News</span>
</center>
</div>
<main>
</main>
<footer>
<div class="wrapper">
<span>©2024<strong> CodeINBlogs</strong>, All Rights Reserved</span>
</div>
</footer>
<!-- main javacsript file -->
<script src="script.js"></script>
<!-- cookieconsent -->
<script type="module" src="cookieconsent-config.js"></script>
<!-- authentication -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.14.1/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use-->
<script src="https://www.gstatic.com/firebasejs/7.14.1/firebase-auth.js"></script>
<script>
document.querySelector(".authenticate-btn").addEventListener("click", () => {
toggleAuthenticationForm();
});
function toggleAuthenticationForm() {
const authenticateForm = document.getElementById("authenticate-form");
authenticateForm.classList.toggle("hide");
}
</script>
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyBOVRzf_NsNMBLknBDL2vYCimT1dOgvn3c",
authDomain: "news-codeinblogs.firebaseapp.com",
projectId: "news-codeinblogs",
storageBucket: "news-codeinblogs.appspot.com",
messagingSenderId: "901930281805",
appId: "1:901930281805:web:b3cef12805320be8206504",
measurementId: "G-E7DGTK1QD7"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
</script>
<script>
//invokes firebase authentication.
const auth = firebase.auth();
document.querySelector("#show-register").addEventListener("click", () => {
showRegistration();
});
const showRegistration = () => {
document.querySelector("#registration-page").classList.remove("hide");
document.querySelector("#login-page").classList.add("hide");
document.querySelector("#homepage").classList.add("hide");
};
document.querySelector("#show-login").addEventListener("click", () => {
showLogin();
});
const showLogin = () => {
document.querySelector("#registration-page").classList.add("hide");
document.querySelector("#login-page").classList.remove("hide");
document.querySelector("#homepage").classList.add("hide");
};
document.querySelector("#signout").addEventListener("click", () => {
signOut();
});
const register = () => {
const email = document.querySelector("#registration-email").value;
const reemail = document.querySelector("#registration-reemail").value;
const password = document.querySelector("#registration-password").value;
if (email.trim() == "") {
alert("Enter Email");
} else if (password.trim().length < 7) {
alert("Password must be at least 7 characters");
} else if (email != reemail) {
alert("emails do not match");
} else {
auth
.createUserWithEmailAndPassword(email, password)
.catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
alert(errorMessage);
// ...
});
}
};
document.querySelector("#register").addEventListener("click", () => {
register();
});
//register when you hit the enter key
document
.querySelector("#registration-password")
.addEventListener("keyup", (e) => {
if (event.keyCode === 13) {
e.preventDefault();
register();
}
});
const login = () => {
const email = document.querySelector("#login-email").value;
const password = document.querySelector("#login-password").value;
if (email.trim() == "") {
alert("Enter Email");
} else if (password.trim() == "") {
alert("Enter Password");
} else {
authenticate(email, password);
}
};
document.querySelector("#login").addEventListener("click", () => {
login();
});
//sign in when you hit enter
document
.querySelector("#login-password")
.addEventListener("keyup", (e) => {
if (event.keyCode === 13) {
e.preventDefault();
login();
}
});
const authenticate = (email, password) => {
const auth = firebase.auth();
auth.signInWithEmailAndPassword(email, password);
firebase
.auth()
.signInWithEmailAndPassword(email, password)
.catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
alert(errorMessage);
});
};
const showHomepage = () => {
const authenticateForm = document.getElementById("authenticate-form");
const loginButton = document.getElementById("auth-btn");
authenticateForm.classList.add("hide");
loginButton.classList.add("hide"); // Hide the login button
document.querySelector("#registration-page").classList.add("hide");
document.querySelector("#login-page").classList.add("hide");
document.querySelector("#homepage").classList.remove("hide");
};
const signOut = () => {
firebase
.auth()
.signOut()
.then(function () {
location.reload();
})
.catch(function (error) {
alert("error signing out, check network connection");
});
};
auth.onAuthStateChanged((firebaseUser) => {
if (firebaseUser) {
showHomepage();
}
});
document
.querySelector("#forgot-password")
.addEventListener("click", () => {
const email = document.querySelector("#login-email").value;
if (email.trim() == "") {
alert("Enter Email");
} else {
forgotPassword(email);
}
});
const forgotPassword = (email) => {
auth
.sendPasswordResetEmail(email)
.then(function () {
alert("email sent");
})
.catch(function (error) {
alert("invalid email or bad network connection");
});
};
auth.onAuthStateChanged((firebaseUser) => {
if (firebaseUser) {
// User is logged in
showHomepage();
const userGreeting = document.getElementById("user-greeting");
const userUsername = document.getElementById("user-username");
userUsername.innerText = firebaseUser.email; // You might want to display the actual username
userGreeting.classList.remove("hide");
} else {
// User is not logged in
const userGreeting = document.getElementById("user-greeting");
userGreeting.classList.add("hide");
}
});
</script>
<!-- main code ends -->
<!-- other code -->
<!-- advertisement code -->
<!-- banner 320 X 50 -->
<center>
<script type="text/javascript">
atOptions = {
'key': 'dd21beec102bcd28a391716abc1e9d2d',
'format': 'iframe',
'height': 50,
'width': 320,
'params': {}
};
document.write('<scr' + 'ipt type="text/javascript" src="//difficultywithhold.com/dd21beec102bcd28a391716abc1e9d2d/invoke.js"></scr' + 'ipt>');
</script>
</center>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-BK1VWZ53K8"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-BK1VWZ53K8');
</script>
</body>
</html>