-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
163 lines (144 loc) · 5.65 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI News Globes</title>
<!-- Include Google Open Sans font -->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Open Sans', sans-serif;
color: #fff; /* White text */
background-color: #000; /* Black background */
margin: 0;
padding: 0;
line-height: 1.6; /* Improved readability with a bit of line height */
}
h1 {
color: #fff; /* White text for the heading */
text-align: center;
margin-top: 20px;
font-size: 3em; /* Increased font size for the heading */
}
#content {
margin-top: 20px;
display: flex;
justify-content: center;
flex-wrap: wrap;
}
.date-container {
position: relative; /* Needed for positioning the image and glow */
margin: 10px;
padding: 20px;
border: 1px solid #fff; /* White border */
text-align: center;
background-color: #333; /* Darker shade for better contrast */
cursor: pointer;
flex-basis: 30%; /* Adjust as needed */
}
a {
color: #fff; /* Changed link color to white */
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.image-container {
position: relative; /* Needed for positioning the glow over the image */
display: inline-block; /* Ensures it takes up space properly */
width: 150px; /* Set width to match the image size */
height: 150px; /* Set height to match the image size */
}
img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%; /* Make the image circular */
object-fit: cover; /* Ensure the image covers the circle */
}
.glow {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%; /* Make sure it's circular */
background-color: rgba(255, 255, 255, 0.3);
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: scale(1);
opacity: 0.5;
}
50% {
transform: scale(1.1);
opacity: 0.8;
}
100% {
transform: scale(1);
opacity: 0.5;
}
}
</style>
</head>
<body>
<h1>AI News Globes</h1>
<div id="content"></div>
<script>
// Function to generate the divs for each date
function generateDateDivs() {
console.log('generateDateDivs function called');
const startDate = new Date();
const endDate = new Date('2024-11-19');
const contentDiv = document.getElementById('content');
if (!contentDiv) {
console.error('Content div not found!');
return;
}
// Ensure the start date is before or on the end date
if (startDate > endDate) {
console.log('Start date is after end date, setting start date to today.');
}
console.log(`Start date: ${startDate.toISOString()}, End date: ${endDate.toISOString()}`);
while (startDate >= endDate) {
const year = startDate.getFullYear();
const month = String(startDate.getMonth() + 1); //.padStart(2, '0'); // Months are 0-indexed
const day = String(startDate.getDate()); //.padStart(2, '0');
const dateString = `${year}-${month}-${day}`;
const link = `${dateString}-news.html`;
const imgSrc = `images/${dateString}-news.png`;
console.log(`Generating div for date: ${dateString}`);
const dateDiv = document.createElement('div');
const anchorText = document.createElement('a');
const imageContainer = document.createElement('div'); // Container for the image and glow
const imageWrapper = document.createElement('a');
const image = document.createElement('img');
const glowEffect = document.createElement('span'); // Added for the glow effect
dateDiv.classList.add('date-container'); // Apply the new class
anchorText.href = link;
anchorText.textContent = `${dateString} news`;
imageWrapper.href = link;
image.src = imgSrc;
image.alt = `${dateString} news`;
imageWrapper.appendChild(image);
glowEffect.classList.add('glow'); // Add the 'glow' class for CSS animation
imageContainer.classList.add('image-container'); // Apply the new class
imageContainer.appendChild(glowEffect); // Append the glow effect to the image container
imageContainer.appendChild(imageWrapper); // Append the image wrapper to the image container
dateDiv.appendChild(anchorText);
dateDiv.appendChild(imageContainer); // Append the image container with glow
contentDiv.appendChild(dateDiv);
// Move to the next day
startDate.setDate(startDate.getDate() - 1);
}
console.log('All divs generated');
}
// Call the function to generate the divs when the window loads
window.onload = generateDateDivs;
</script>
</body>
</html>