-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
217 lines (178 loc) · 7.69 KB
/
app.js
File metadata and controls
217 lines (178 loc) · 7.69 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
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
// Professional Academic Website JavaScript for ICDAR 2026 Competition
// Smooth scrolling for navigation links
document.addEventListener('DOMContentLoaded', function() {
// Handle navigation link clicks
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href').substring(1);
const targetSection = document.getElementById(targetId);
if (targetSection) {
const headerHeight = document.querySelector('.header').offsetHeight;
const targetPosition = targetSection.offsetTop - headerHeight - 20;
window.scrollTo({
top: targetPosition,
behavior: 'smooth'
});
}
});
});
// Highlight active navigation item on scroll
function updateActiveNavigation() {
const sections = document.querySelectorAll('section[id]');
const navLinks = document.querySelectorAll('.nav-link');
const headerHeight = document.querySelector('.header').offsetHeight;
const scrollPosition = window.scrollY + headerHeight + 100;
let currentSection = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.offsetHeight;
if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) {
currentSection = section.getAttribute('id');
}
});
navLinks.forEach(link => {
link.style.borderBottomColor = 'transparent';
if (link.getAttribute('href') === '#' + currentSection) {
link.style.borderBottomColor = '#fff5eb';
}
});
}
// Listen for scroll events
window.addEventListener('scroll', updateActiveNavigation);
// Initial call to set active navigation
updateActiveNavigation();
// Download button interactions
const downloadButtons = document.querySelectorAll('.btn-download');
downloadButtons.forEach(button => {
button.addEventListener('click', function() {
if (!this.disabled) {
// In a real implementation, this would trigger actual downloads
alert('Download should start now. Some files can be big, you can also download it via WGET command on your data server.');
} else {
alert('This dataset component is not yet available. Please check the schedule for release dates.');
}
});
});
// Email links interaction
const emailLinks = document.querySelectorAll('a[href^="mailto:"]');
emailLinks.forEach(link => {
link.addEventListener('click', function(e) {
// Allow default email client to open
console.log('Opening email client for:', this.getAttribute('href'));
});
});
// External links - ensure they open in new tabs
const externalLinks = document.querySelectorAll('a[target="_blank"]');
externalLinks.forEach(link => {
link.addEventListener('click', function() {
console.log('Opening external link:', this.href);
});
});
// Add loading state for future dynamic content
function showLoading(element) {
element.innerHTML = '<span style="color: #666;">Loading...</span>';
}
function hideLoading(element, originalContent) {
element.innerHTML = originalContent;
}
// Intersection Observer for animation on scroll (optional enhancement)
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// Observe elements for scroll animations
const animatedElements = document.querySelectorAll('.track, .metric, .team-member, .timeline-item');
animatedElements.forEach(el => {
el.style.opacity = '0';
el.style.transform = 'translateY(20px)';
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
observer.observe(el);
});
// Table responsiveness helper
function makeTablesResponsive() {
const tables = document.querySelectorAll('table');
tables.forEach(table => {
if (window.innerWidth < 768) {
table.style.fontSize = '0.9rem';
} else {
table.style.fontSize = '1rem';
}
});
}
window.addEventListener('resize', makeTablesResponsive);
makeTablesResponsive();
// Copy functionality for CSV examples
const csvExamples = document.querySelectorAll('.csv-example code, .example code');
csvExamples.forEach(code => {
code.style.cursor = 'pointer';
code.title = 'Click to copy';
code.addEventListener('click', function() {
const text = this.textContent;
if (navigator.clipboard) {
navigator.clipboard.writeText(text).then(() => {
showTooltip(this, 'Copied!');
});
} else {
// Fallback for older browsers
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
showTooltip(this, 'Copied!');
}
});
});
// Simple tooltip function
function showTooltip(element, message) {
const tooltip = document.createElement('div');
tooltip.textContent = message;
tooltip.style.position = 'absolute';
tooltip.style.background = '#ff2a19';
tooltip.style.color = 'white';
tooltip.style.padding = '0.5rem';
tooltip.style.borderRadius = '4px';
tooltip.style.fontSize = '0.8rem';
tooltip.style.zIndex = '1000';
tooltip.style.pointerEvents = 'none';
const rect = element.getBoundingClientRect();
tooltip.style.top = (rect.top - 40 + window.scrollY) + 'px';
tooltip.style.left = (rect.left + rect.width / 2 - 25) + 'px';
document.body.appendChild(tooltip);
setTimeout(() => {
if (tooltip.parentNode) {
tooltip.parentNode.removeChild(tooltip);
}
}, 2000);
}
// Print page functionality
function addPrintStyles() {
const printStyles = `
@media print {
.header { display: none; }
.footer { display: none; }
main { margin-top: 0; }
.hero { background: white !important; color: black !important; }
* { box-shadow: none !important; }
}
`;
const styleSheet = document.createElement('style');
styleSheet.textContent = printStyles;
document.head.appendChild(styleSheet);
}
addPrintStyles();
// Console welcome message
console.log('%cICDAR 2026 AnyScript Competition', 'color: #ff2a19; font-size: 20px; font-weight: bold;');
console.log('%cWebsite loaded successfully. Good luck with your submissions!', 'color: #ff2a19; font-size: 14px;');
});