-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
86 lines (79 loc) · 2.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>sq's emojis</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');
body {
font-family: Nunito, Arial, sans-serif;
color: #495057;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
margin: 0;
background-color: #f8f9fa;
}
h1 {
margin-bottom: 20px;
}
.emoji-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
max-width: 1200px;
}
.emoji-item {
margin: 10px;
text-align: center;
flex: 1 1 50px;
min-width: 100px;
}
img {
width: 100%;
height: auto;
image-rendering: pixelated;
max-width: 60px;
}
.filename {
margin-top: 5px;
font-size: 12px;
color: #495057;
}
</style>
</head>
<body>
<h1>sq's emojis</h1>
<h2>food</h2>
<div class="emoji-container" id="emojiContainer"></div>
<script>
const baseUrl = 'https://raw.githubusercontent.com/SquareScreamYT/emojis/main/png/food/';
const apiUrl = 'https://api.github.com/repos/SquareScreamYT/emojis/contents/png/food';
fetch(apiUrl)
.then(response => response.json())
.then(data => {
const container = document.getElementById('emojiContainer');
data.forEach(file => {
if (file.name.endsWith('.png')) {
const item = document.createElement('div');
item.className = 'emoji-item';
const img = document.createElement('img');
img.src = baseUrl + file.name;
img.alt = file.name;
const filename = document.createElement('div');
filename.className = 'filename';
filename.textContent = file.name;
item.appendChild(img);
item.appendChild(filename);
container.appendChild(item);
}
});
})
.catch(error => {
console.error('Error fetching the image names:', error);
});
</script>
</body>
</html>