-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
124 lines (102 loc) · 3.72 KB
/
main.js
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
let nsfwVerified = false;
let activeTab = 'anime';
let activeSection = 'streaming';
// Combine all data
const data = {
anime: animeData,
listing: listingData,
manga: mangaData,
novels: novelsData,
visualNovels: visualNovelsData,
forum: forumData,
news: newsData,
music: musicData,
development: developmentData,
nsfw: nsfwData,
misc: miscData,
};
function updateSectionDescription() {
const sectionDesc = document.getElementById('sectionDesc');
const currentSection = descriptions[activeTab][activeSection];
sectionDesc.innerHTML = `
<h2>${currentSection.title}</h2>
<p>${currentSection.desc}</p>
`;
}
function updateSidebar() {
const sidebar = document.getElementById('sidebar');
sidebar.innerHTML = sections[activeTab]
.map(section => `
<button class="nav-button ${section === activeSection ? 'active' : ''}"
data-section="${section}">
${icons[section] || ''} ${section.charAt(0).toUpperCase() + section.slice(1)}
</button>
`).join('');
sidebar.querySelectorAll('.nav-button').forEach(button => {
button.addEventListener('click', (e) => {
activeSection = e.target.closest('.nav-button').dataset.section;
updateUI();
});
});
}
function updateContent() {
const grid = document.getElementById('contentGrid');
const items = data[activeTab][activeSection] || [];
grid.innerHTML = items.map((item, index) => `
<a href="${item.url}"
class="card"
style="animation-delay: ${index * 0.1}s"
target="_blank"
rel="noopener noreferrer">
<div class="card-header">
<span class="card-title">
<div class="card-image">
<img src="${item.image}" alt="${item.name} logo" onerror="this.src='https://via.placeholder.com/24'" />
</div>
${item.name}
</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
<path d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<p class="card-description">${item.desc}</p>
<div class="card-tags">
${item.tags.map(tag => `<span class="tag">${tag}</span>`).join('')}
</div>
${item.note ? `<p class="card-note">${item.note}</p>` : ''}
</a>
`).join('');
}
function updateUI() {
if (activeTab === 'nsfw' && !nsfwVerified) {
activeTab = 'anime';
activeSection = sections[activeTab][0];
}
updateSectionDescription();
updateSidebar();
updateContent();
document.querySelectorAll('.tab').forEach(tab => {
tab.classList.toggle('active', tab.dataset.tab === activeTab);
});
}
document.addEventListener('DOMContentLoaded', () => {
activeTab = 'anime';
activeSection = 'streaming';
updateUI();
});
document.querySelectorAll('.tab').forEach(tab => {
tab.addEventListener('click', async (e) => {
const newTab = e.target.closest('.tab').dataset.tab;
if (newTab === 'nsfw' && !nsfwVerified) {
const verified = await showAgeVerificationModal();
if (!verified) {
updateUI();
return;
}
}
activeTab = newTab;
activeSection = sections[activeTab][0];
updateUI();
});
});