feat: Add initial HTML, CSS, and JavaScript for ZDTT Terminal interface
This commit is contained in:
35
script.js
Normal file
35
script.js
Normal file
@@ -0,0 +1,35 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const navToggle = document.querySelector('.nav__toggle');
|
||||
const navLinks = document.querySelector('.nav__links');
|
||||
const yearEl = document.getElementById('year');
|
||||
|
||||
if (yearEl) {
|
||||
yearEl.textContent = new Date().getFullYear();
|
||||
}
|
||||
|
||||
if (navToggle && navLinks) {
|
||||
navToggle.addEventListener('click', () => {
|
||||
navLinks.classList.toggle('is-open');
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelectorAll('[data-copy]').forEach((button) => {
|
||||
button.addEventListener('click', () => {
|
||||
const target = document.querySelector(button.dataset.copy);
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
navigator.clipboard?.writeText(target.textContent.trim()).then(() => {
|
||||
button.textContent = 'Copied!';
|
||||
setTimeout(() => {
|
||||
button.textContent = 'Copy Install Command';
|
||||
}, 1800);
|
||||
}).catch(() => {
|
||||
button.textContent = 'Unable to copy';
|
||||
setTimeout(() => {
|
||||
button.textContent = 'Copy Install Command';
|
||||
}, 1800);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user