PageSourceSearch

https://yuhsihu.github.io/C3-GS/static/js/index.js

js yuhsihu.github.io collected 2026-10-03 10:13:44 UTC 4,427 bytes, 142 lines download raw bytes

1window.HELP_IMPROVE_VIDEOJS = false;
2
3// More Works Dropdown Functionality
4function toggleMoreWorks() {
5    const dropdown = document.getElementById('moreWorksDropdown');
6    const button = document.querySelector('.more-works-btn');
7    
8    if (dropdown.classList.contains('show')) {
9        dropdown.classList.remove('show');
10        button.classList.remove('active');
11    } else {
12        dropdown.classList.add('show');
13        button.classList.add('active');
14    }
15}
16
17// Close dropdown when clicking outside
18document.addEventListener('click', function(event) {
19    const container = document.querySelector('.more-works-container');
20    const dropdown = document.getElementById('moreWorksDropdown');
21    const button = document.querySelector('.more-works-btn');
22    
23    if (container && !container.contains(event.target)) {
24        dropdown.classList.remove('show');
25        button.classList.remove('active');
26    }
27});
28
29// Close dropdown on escape key
30document.addEventListener('keydown', function(event) {
31    if (event.key === 'Escape') {
32        const dropdown = document.getElementById('moreWorksDropdown');
33        const button = document.querySelector('.more-works-btn');
34        dropdown.classList.remove('show');
35        button.classList.remove('active');
36    }
37});
38
39// Copy BibTeX to clipboard
40function copyBibTeX() {
41    const bibtexElement = document.getElementById('bibtex-code');
42    const button = document.querySelector('.copy-bibtex-btn');
43    const copyText = button.querySelector('.copy-text');
44    
45    if (bibtexElement) {
46        navigator.clipboard.writeText(bibtexElement.textContent).then(function() {
47            // Success feedback
48            button.classList.add('copied');
49            copyText.textContent = 'Cop';
50            
51            setTimeout(function() {
52                button.classList.remove('copied');
53                copyText.textContent = 'Copy';
54            }, 2000);
55        }).catch(function(err) {
56            console.error('Failed to copy: ', err);
57            // Fallback for older browsers
58            const textArea = document.createElement('textarea');
59            textArea.value = bibtexElement.textContent;
60            document.body.appendChild(textArea);
61            textArea.select();
62            document.execCommand('copy');
63            document.body.removeChild(textArea);
64            
65            button.classList.add('copied');
66            copyText.textContent = 'Cop';
67            setTimeout(function() {
68                button.classList.remove('copied');
69                copyText.textContent = 'Copy';
70            }, 2000);
71        });
72    }
73}
74
75// Scroll to top functionality
76function scrollToTop() {
77    window.scrollTo({
78        top: 0,
79        behavior: 'smooth'
80    });
81}
82
83// Show/hide scroll to top button
84window.addEventListener('scroll', function() {
85    const scrollButton = document.querySelector('.scroll-to-top');
86    if (window.pageYOffset > 300) {
87        scrollButton.classList.add('visible');
88    } else {
89        scrollButton.classList.remove('visible');
90    }
91});
92
93// Video carousel autoplay when in view
94function setupVideoCarouselAutoplay() {
95    const carouselVideos = document.querySelectorAll('.results-carousel video');
96    
97    if (carouselVideos.length === 0) return;
98    
99    const observer = new IntersectionObserver((entries) => {
100        entries.forEach(entry => {
101            const video = entry.target;
102            if (entry.isIntersecting) {
103                // Video is in view, play it
104                video.play().catch(e => {
105                    // Autoplay failed, probably due to browser policy
106                    console.log('Autoplay prevented:', e);
107                });
108            } else {
109                // Video is out of view, pause it
110                video.pause();
111            }
112        });
113    }, {
114        threshold: 0.5 // Trigger when 50% of the video is visible
115    });
116    
117    carouselVideos.forEach(video => {
118        observer.observe(video);
119    });
120}
121
122$(document).ready(function() {
123    // Check for click events on the navbar burger icon
124
125    var options = {
126		slidesToScroll: 1,
127		slidesToShow: 1,
128		loop: true,
129		infinite: true,
130		autoplay: true,
131		autoplaySpeed: 5000,
132    }
133
134	// Initialize all div with carousel class
135    var carousels = bulmaCarousel.attach('.carousel', options);
136	
137    bulmaSlider.attach();
138    
139    // Setup video autoplay for carousel
140    setupVideoCarouselAutoplay();
141
142})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.