-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
73 lines (64 loc) · 2.45 KB
/
Copy pathscript.js
File metadata and controls
73 lines (64 loc) · 2.45 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
document.addEventListener('DOMContentLoaded', () => {
const navItems = document.querySelectorAll('.nav-links li');
const sections = document.querySelectorAll('.view-section');
// Navigation Logic
navItems.forEach(item => {
item.addEventListener('click', () => {
// Remove active classes
navItems.forEach(nav => nav.classList.remove('active'));
sections.forEach(sec => sec.classList.remove('active', 'hidden'));
// Hide all sections
sections.forEach(sec => {
sec.style.display = 'none';
});
// Add active class to clicked nav
item.classList.add('active');
// Show corresponding section
const tabId = item.getAttribute('data-tab');
const targetSection = document.getElementById(tabId);
if (targetSection) {
targetSection.style.display = 'block';
targetSection.classList.add('active');
}
});
});
// Load python code for the Code Explorer view
fetch('eda.py')
.then(response => {
if (!response.ok) {
throw new Error('Could not load eda.py');
}
return response.text();
})
.then(code => {
const codeBlock = document.getElementById('code-block');
codeBlock.textContent = code;
// Tell Prism to re-highlight the new code
if (window.Prism) {
Prism.highlightElement(codeBlock);
}
})
.catch(err => {
document.getElementById('code-block').textContent = 'Error loading source code: ' + err.message;
});
// Modal (Lightbox) Logic
const modal = document.getElementById("imageModal");
const modalImg = document.getElementById("expandedImg");
const captionText = document.getElementById("caption");
const closeBtn = document.getElementsByClassName("close")[0];
document.querySelectorAll('.img-container img').forEach(img => {
img.addEventListener('click', function(){
modal.style.display = "block";
modalImg.src = this.src;
captionText.innerHTML = this.alt;
});
});
closeBtn.onclick = function() {
modal.style.display = "none";
}
modal.onclick = function(e) {
if(e.target !== modalImg) {
modal.style.display = "none";
}
}
});