-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMAL2.html
259 lines (224 loc) · 7.29 KB
/
MAL2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/sakura-vader.css" type="text/css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<title>My Anime List</title>
<style>
body {
font-size: 1.8rem;
line-height: 1.618;
max-width: 100vw;
overflow-x: hidden;
margin: auto;
color: #d9d8dc;
background-color: #120c0e;
padding: 10px;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.anime-table {
width: 100%;
border-collapse: collapse;
}
.anime-table th, .anime-table td {
border: 1px solid #ccc;
padding: 8px;
text-align: left;
}
.anime-table th {
background-color: #120c0e;
}
.status-check {
text-align: center;
}
.status-check input {
pointer-events: none;
}
/* Table styling */
/* General Table Layout */
/* General Table Layout */
table {
width: 100%;
table-layout: fixed; /* Columns take up equal space */
border-collapse: collapse;
}
td, th {
padding: 10px;
border: 1px solid #ddd;
text-align: center;
vertical-align: middle; /* Vertically center content */
word-wrap: break-word; /* Prevent long text from overflowing */
overflow: hidden; /* Prevent overflow of content */
}
/* Ensure images fit properly in cells */
td img {
max-width: 80%; /* Make sure image fits within the cell */
height: auto; /* Maintain aspect ratio */
display: block;
margin: 0 auto; /* Center image in cell */
}
/* Fix body width issues */
body {
max-width: 100vw;
overflow-x: hidden; /* Prevent horizontal scrolling */
}
/* For smaller screens */
@media (max-width: 600px) {
td img {
max-width: 50px; /* Smaller image size on mobile */
}
td, th {
padding: 5px; /* Adjust padding for small screens */
}
}
.navbar {
overflow: hidden;
}
.navbar a {
font-size: 16px;
color: rgb(235,153,161);
padding: 3px 6px;
text-align: center;
text-decoration: none;
display: inline-block;
border-bottom: none;
}
.navbar a:hover {
color: #DA4453
}
.joe {
font-family: Helvetica Bold, sans-serif;
}
</style>
</head>
<body>
<header>
<a href="/"><h1>Bojab Website</h1></a>
<p>Simple as frick.</p>
<div class="navbar">
<a href="/"><h3><small>Home</small></h3></a>
<a href="/about.html"><h3><small>About</small></h3></a>
<a href="/social.html"><h3><small>Social</small></h3></a>
<a href="blog.html"><h3><small>Blog</small></h3></a>
<a href="mal.html"><h3><small>MAL</small></h3></a>
<a href="music.html"><h3><small>Loops</small></h3></a>
<a href="discord.html"><h3><small>Discord</small></h3></a>
<a href="https://soundcloud.com/vinyl_lover20" target="_blank"><h3><small>Soundcloud</small></h3></a>
<a href="https://paypal.me/LiamDaws0n?locale.x=en_US" target="_blank"><h3><small>Support</small></h3></a>
<hr>
</div>
</header>
<h1>Here is My Anime List :)</h1>
<p><small>It's kinda difficult to comprehend on mobile, but it's good <i>enough</i>, so whatever.</small></p>
<table class="anime-table">
<thead>
<tr>
<th>Cover Image</th> <!-- Change column header -->
<th>Status</th>
<th>Episodes</th>
<th>Watching</th>
<th>Completed</th>
<th>Paused</th>
<th>Dropped</th>
<th>Planning</th>
</tr>
</thead>
<tbody id="anime-list">
<!-- Anime rows will be dynamically inserted here -->
</tbody>
</table>
<script>
async function fetchAnimeList() {
const query = `
query ($userId: Int) {
MediaListCollection(userId: $userId, type: ANIME) {
lists {
name
entries {
media {
title {
romaji
}
episodes
coverImage {
large
}
siteUrl
}
status # Fetch the user's specific status for this anime
}
}
}
}
`;
const variables = {
userId: 154492 // Replace with your AniList user ID
};
try {
const response = await fetch('https://graphql.anilist.co', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: query,
variables: variables
})
});
const result = await response.json();
displayAnimeList(result.data.MediaListCollection.lists);
} catch (error) {
console.error('Error fetching the anime list:', error);
}
}
function displayAnimeList(lists) {
const animeListElement = document.getElementById('anime-list');
animeListElement.innerHTML = ''; // Clear previous list
// Define the desired order of statuses
const statusOrder = ['CURRENT', 'COMPLETED', 'PAUSED', 'DROPPED', 'PLANNING'];
// Flatten all entries from lists
const allEntries = lists.flatMap(list => list.entries);
// Sort the entries based on the status order
const sortedEntries = allEntries.sort((a, b) => {
return statusOrder.indexOf(a.status) - statusOrder.indexOf(b.status);
});
// Loop through the sorted entries and create table rows
sortedEntries.forEach(entry => {
const animeRow = document.createElement('tr');
// Anime cover image cell
const coverImageCell = `<td><a href="${entry.media.siteUrl}" target="_blank"><img src="${entry.media.coverImage.large}" alt="${entry.media.title.romaji} cover"></a></td>`;
// User-specific status text
const statusTextCell = `<td>${entry.status}</td>`;
// Number of episodes
const episodesCell = `<td>${entry.media.episodes || "N/A"}</td>`;
// Checkmark cells for statuses
const statusCheckCell = (status) => `
<td class="status-check">
<input type="checkbox" ${entry.status === status ? 'checked' : ''}>
</td>
`;
// Create row with all the data
animeRow.innerHTML = `
${coverImageCell}
${statusTextCell}
${episodesCell}
${statusCheckCell('CURRENT')}
${statusCheckCell('COMPLETED')}
${statusCheckCell('PAUSED')}
${statusCheckCell('DROPPED')}
${statusCheckCell('PLANNING')}
`;
animeListElement.appendChild(animeRow);
});
}
fetchAnimeList();
</script>
<p>Damn, it was about 6 years ago today I watched Assassination Classroom and never touched it again. I remember watching it and putting it at number 3 in my favourites list at the time knowing well that that opinion would change after forgetting about the show, which happened, but it's crazy how it's been 6 years already.</p>
</body>
</html>