From ce903bbd8ea3051d354021ef065a99585533f05a Mon Sep 17 00:00:00 2001 From: Firisy Feng Date: Wed, 3 Jul 2024 15:06:40 +0800 Subject: [PATCH] javascript rectify --- docs/javascripts/typewriter.js | 37 ------------------------------ material/overrides/home.html | 41 +++++++++++++++++++++++++++++++++- site/index.html | 41 +++++++++++++++++++++++++++++++++- site/javascripts/typewriter.js | 37 ------------------------------ 4 files changed, 80 insertions(+), 76 deletions(-) delete mode 100644 docs/javascripts/typewriter.js delete mode 100644 site/javascripts/typewriter.js diff --git a/docs/javascripts/typewriter.js b/docs/javascripts/typewriter.js deleted file mode 100644 index 44054354..00000000 --- a/docs/javascripts/typewriter.js +++ /dev/null @@ -1,37 +0,0 @@ -document.addEventListener("DOMContentLoaded", function() { - function typeWriter(element, text, speed, callback) { - let i = 0; - function type() { - if (i < text.length) { - element.innerHTML += text.charAt(i).replace('\n', '
'); // Replace newline with
for line breaks - i++; - setTimeout(type, speed); - } else { - console.log('Typing complete, pausing cursor animation for', element); // Debug output - if (callback) callback(); - } - } - type(); - } - - const headerElement = document.querySelector('.hero_header'); - const taglineElement = document.querySelector('.tagline'); - - const headerText = 'JY-HF Learning Site___'; - const headerHTML = 'JY-HF Learning Site___'; - const taglineText = 'Share the knowledge to you and Us'; - const taglineHTML = 'Share the knowledge to you and Us'; - - headerElement.textContent = ''; - taglineElement.textContent = ''; - - typeWriter(headerElement, headerText, 300, () => { - headerElement.innerHTML = headerHTML; - headerElement.style.animationPlayState = 'paused'; // Pause the cursor animation - headerElement.style.borderRightColor = 'transparent'; // Make the cursor transparent - typeWriter(taglineElement, taglineText, 300, () => { - taglineElement.innerHTML = taglineHTML; - - }); - }); -}); diff --git a/material/overrides/home.html b/material/overrides/home.html index 505d0aaf..726e714a 100644 --- a/material/overrides/home.html +++ b/material/overrides/home.html @@ -44,7 +44,46 @@

JY-HF Share the knowledge to you and Us

- +

Welcome to the coding space of JY-HF!

diff --git a/site/index.html b/site/index.html index 06011c16..7b145a00 100644 --- a/site/index.html +++ b/site/index.html @@ -348,7 +348,46 @@

JY-HF Share the knowledge to you and Us

- +

Welcome to the coding space of JY-HF!

diff --git a/site/javascripts/typewriter.js b/site/javascripts/typewriter.js deleted file mode 100644 index 44054354..00000000 --- a/site/javascripts/typewriter.js +++ /dev/null @@ -1,37 +0,0 @@ -document.addEventListener("DOMContentLoaded", function() { - function typeWriter(element, text, speed, callback) { - let i = 0; - function type() { - if (i < text.length) { - element.innerHTML += text.charAt(i).replace('\n', '
'); // Replace newline with
for line breaks - i++; - setTimeout(type, speed); - } else { - console.log('Typing complete, pausing cursor animation for', element); // Debug output - if (callback) callback(); - } - } - type(); - } - - const headerElement = document.querySelector('.hero_header'); - const taglineElement = document.querySelector('.tagline'); - - const headerText = 'JY-HF Learning Site___'; - const headerHTML = 'JY-HF Learning Site___'; - const taglineText = 'Share the knowledge to you and Us'; - const taglineHTML = 'Share the knowledge to you and Us'; - - headerElement.textContent = ''; - taglineElement.textContent = ''; - - typeWriter(headerElement, headerText, 300, () => { - headerElement.innerHTML = headerHTML; - headerElement.style.animationPlayState = 'paused'; // Pause the cursor animation - headerElement.style.borderRightColor = 'transparent'; // Make the cursor transparent - typeWriter(taglineElement, taglineText, 300, () => { - taglineElement.innerHTML = taglineHTML; - - }); - }); -});