Skip to content

Commit 099901e

Browse files
Yuxuan HouYuxuan Hou
authored andcommitted
update cktgen
1 parent 62d168e commit 099901e

10 files changed

Lines changed: 1115 additions & 715 deletions

File tree

CktGen/index.html

Lines changed: 286 additions & 88 deletions
Large diffs are not rendered by default.

CktGen/static/css/index.css

Lines changed: 515 additions & 510 deletions
Large diffs are not rendered by default.
705 KB
Loading
786 KB
Loading

CktGen/static/images/03-tsne.png

629 KB
Loading
255 KB
Loading

CktGen/static/images/101.png

177 KB
Loading

CktGen/static/images/301.png

176 KB
Loading

CktGen/static/js/index.js

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ window.HELP_IMPROVE_VIDEOJS = false;
44
function toggleMoreWorks() {
55
const dropdown = document.getElementById('moreWorksDropdown');
66
const button = document.querySelector('.more-works-btn');
7+
if (!dropdown || !button) return;
78

89
if (dropdown.classList.contains('show')) {
910
dropdown.classList.remove('show');
@@ -19,7 +20,8 @@ document.addEventListener('click', function(event) {
1920
const container = document.querySelector('.more-works-container');
2021
const dropdown = document.getElementById('moreWorksDropdown');
2122
const button = document.querySelector('.more-works-btn');
22-
23+
if (!container || !dropdown || !button) return;
24+
2325
if (container && !container.contains(event.target)) {
2426
dropdown.classList.remove('show');
2527
button.classList.remove('active');
@@ -31,6 +33,7 @@ document.addEventListener('keydown', function(event) {
3133
if (event.key === 'Escape') {
3234
const dropdown = document.getElementById('moreWorksDropdown');
3335
const button = document.querySelector('.more-works-btn');
36+
if (!dropdown || !button) return;
3437
dropdown.classList.remove('show');
3538
button.classList.remove('active');
3639
}
@@ -40,36 +43,31 @@ document.addEventListener('keydown', function(event) {
4043
function copyBibTeX() {
4144
const bibtexElement = document.getElementById('bibtex-code');
4245
const button = document.querySelector('.copy-bibtex-btn');
46+
if (!bibtexElement || !button) return;
4347
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-
});
48+
49+
function showCopiedState() {
50+
button.classList.add('copied');
51+
copyText.textContent = 'Copied';
52+
53+
setTimeout(function() {
54+
button.classList.remove('copied');
55+
copyText.textContent = 'Copy';
56+
}, 1800);
7257
}
58+
59+
navigator.clipboard.writeText(bibtexElement.textContent).then(function() {
60+
showCopiedState();
61+
}).catch(function(err) {
62+
console.error('Failed to copy: ', err);
63+
const textArea = document.createElement('textarea');
64+
textArea.value = bibtexElement.textContent;
65+
document.body.appendChild(textArea);
66+
textArea.select();
67+
document.execCommand('copy');
68+
document.body.removeChild(textArea);
69+
showCopiedState();
70+
});
7371
}
7472

7573
// Scroll to top functionality
@@ -83,6 +81,7 @@ function scrollToTop() {
8381
// Show/hide scroll to top button
8482
window.addEventListener('scroll', function() {
8583
const scrollButton = document.querySelector('.scroll-to-top');
84+
if (!scrollButton) return;
8685
if (window.pageYOffset > 300) {
8786
scrollButton.classList.add('visible');
8887
} else {

cktgen/index.html

Lines changed: 286 additions & 88 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)