File size: 4,427 Bytes
408d14b |
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 |
window.HELP_IMPROVE_VIDEOJS = false;
// More Works Dropdown Functionality
function toggleMoreWorks() {
const dropdown = document.getElementById('moreWorksDropdown');
const button = document.querySelector('.more-works-btn');
if (dropdown.classList.contains('show')) {
dropdown.classList.remove('show');
button.classList.remove('active');
} else {
dropdown.classList.add('show');
button.classList.add('active');
}
}
// Close dropdown when clicking outside
document.addEventListener('click', function(event) {
const container = document.querySelector('.more-works-container');
const dropdown = document.getElementById('moreWorksDropdown');
const button = document.querySelector('.more-works-btn');
if (container && !container.contains(event.target)) {
dropdown.classList.remove('show');
button.classList.remove('active');
}
});
// Close dropdown on escape key
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
const dropdown = document.getElementById('moreWorksDropdown');
const button = document.querySelector('.more-works-btn');
dropdown.classList.remove('show');
button.classList.remove('active');
}
});
// Copy BibTeX to clipboard
function copyBibTeX() {
const bibtexElement = document.getElementById('bibtex-code');
const button = document.querySelector('.copy-bibtex-btn');
const copyText = button.querySelector('.copy-text');
if (bibtexElement) {
navigator.clipboard.writeText(bibtexElement.textContent).then(function() {
// Success feedback
button.classList.add('copied');
copyText.textContent = 'Cop';
setTimeout(function() {
button.classList.remove('copied');
copyText.textContent = 'Copy';
}, 2000);
}).catch(function(err) {
console.error('Failed to copy: ', err);
// Fallback for older browsers
const textArea = document.createElement('textarea');
textArea.value = bibtexElement.textContent;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
button.classList.add('copied');
copyText.textContent = 'Cop';
setTimeout(function() {
button.classList.remove('copied');
copyText.textContent = 'Copy';
}, 2000);
});
}
}
// Scroll to top functionality
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
// Show/hide scroll to top button
window.addEventListener('scroll', function() {
const scrollButton = document.querySelector('.scroll-to-top');
if (window.pageYOffset > 300) {
scrollButton.classList.add('visible');
} else {
scrollButton.classList.remove('visible');
}
});
// Video carousel autoplay when in view
function setupVideoCarouselAutoplay() {
const carouselVideos = document.querySelectorAll('.results-carousel video');
if (carouselVideos.length === 0) return;
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const video = entry.target;
if (entry.isIntersecting) {
// Video is in view, play it
video.play().catch(e => {
// Autoplay failed, probably due to browser policy
console.log('Autoplay prevented:', e);
});
} else {
// Video is out of view, pause it
video.pause();
}
});
}, {
threshold: 0.5 // Trigger when 50% of the video is visible
});
carouselVideos.forEach(video => {
observer.observe(video);
});
}
$(document).ready(function() {
// Check for click events on the navbar burger icon
var options = {
slidesToScroll: 1,
slidesToShow: 1,
loop: true,
infinite: true,
autoplay: true,
autoplaySpeed: 5000,
}
// Initialize all div with carousel class
var carousels = bulmaCarousel.attach('.carousel', options);
bulmaSlider.attach();
// Setup video autoplay for carousel
setupVideoCarouselAutoplay();
})
|