-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
50 lines (44 loc) · 1.62 KB
/
Copy pathrenderer.js
File metadata and controls
50 lines (44 loc) · 1.62 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
// Handle category filtering
const categoryButtons = document.querySelectorAll('.category-btn');
const resourceCards = document.querySelectorAll('.resource-card');
categoryButtons.forEach(button => {
button.addEventListener('click', () => {
// Update active button
categoryButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
// Filter resources
const selectedCategory = button.dataset.category;
resourceCards.forEach(card => {
if (selectedCategory === 'all') {
card.classList.remove('hidden');
} else {
const cardCategories = card.dataset.category.split(' ');
if (cardCategories.includes(selectedCategory)) {
card.classList.remove('hidden');
} else {
card.classList.add('hidden');
}
}
});
});
});
// Handle external links
document.addEventListener('click', (event) => {
if (event.target.classList.contains('resource-link')) {
event.preventDefault();
const url = event.target.href;
// Use Electron API to open in default browser
if (window.electronAPI && window.electronAPI.openExternal) {
window.electronAPI.openExternal(url);
} else {
// Fallback for development
window.open(url, '_blank');
}
}
});
// Add smooth animations on load
window.addEventListener('load', () => {
resourceCards.forEach((card, index) => {
card.style.animationDelay = `${index * 0.05}s`;
});
});