forked from hellenicdev/hellenicdev.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
86 lines (70 loc) · 2.11 KB
/
script.js
File metadata and controls
86 lines (70 loc) · 2.11 KB
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
/* =========================
Google Analytics config
========================= */
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-9FWQFZME3Z');
/* =========================
Logo click thank-you
========================= */
function showThankYou() {
const thanks = document.getElementById('hidden-thanks');
if (!thanks) return;
thanks.style.display = 'block';
thanks.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
/* =========================
reCAPTCHA callback
========================= */
function showForm() {
const form = document.getElementById('form-container');
if (!form) return;
form.style.display = 'block';
form.scrollIntoView({ behavior: 'smooth' });
}
/* =========================
Last-updated checker
========================= */
document.addEventListener('DOMContentLoaded', () => {
const items = document.querySelectorAll('.last-updated[data-meta]');
items.forEach(async el => {
const url = el.getAttribute('data-meta');
if (!url) return;
try {
const res = await fetch(url, { cache: 'no-store' });
if (!res.ok) throw new Error('Fetch failed');
const data = await res.json();
if (data.lastUpdated) {
el.textContent = `Last updated: ${data.lastUpdated}`;
} else {
el.textContent = 'Update info unavailable';
}
} catch {
el.textContent = 'Could not load update info';
}
});
});
/* =========================
Popup ad (if exists)
========================= */
(function () {
const popup = document.getElementById('popup-ad');
if (!popup) return;
// show once per session
if (sessionStorage.getItem('popupShown')) return;
setTimeout(() => {
popup.style.display = 'block';
sessionStorage.setItem('popupShown', 'true');
}, 8000);
})();
/* HELLO42 */
/* =========================
Easter egg (console only)
========================= */
console.log(
'%cHellenicDev',
'color:#3fa9f5;font-size:20px;font-weight:bold;'
);
// console.log('Build. Break. Learn. Repeat.');
console.log("PYTHON1");