forked from laysense/laysense.cn
21 lines
883 B
JavaScript
21 lines
883 B
JavaScript
'use strict';
|
|
|
|
const homeHero = document.querySelector('#main-content > .hero-home');
|
|
const homeTitle = homeHero?.querySelector('.hero-copy h1');
|
|
if (homeTitle) {
|
|
const lastLine = homeTitle.querySelector('.hero-accent') || homeTitle.querySelector('.hero-heading-primary') || homeTitle;
|
|
const cursor = document.createElement('span');
|
|
cursor.className = 'home-cursor';
|
|
cursor.setAttribute('aria-hidden', 'true');
|
|
cursor.textContent = '_';
|
|
// A word joiner prevents a narrow line from wrapping just the cursor.
|
|
lastLine.append('\u2060', cursor);
|
|
}
|
|
|
|
const homeImage = homeHero?.querySelector('.hero-visual > img');
|
|
if (homeImage && new URL(homeImage.src).pathname === HOME_IMAGE_PATH) {
|
|
homeImage.insertAdjacentHTML('afterend', HOME_MOTION_SVG);
|
|
}
|
|
|
|
document.querySelector('#main-content > .hero-home ~ #about')?.setAttribute('data-moment', 'iris-opens');
|