You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB
JavaScript

(function() {
var title = document.title,
animSeq = ["/", "$", "\\", "|", "$"],
animIndex = 0,
titleIndex = 0;
function doInverseSpinZeroPitch() {
var loadTitle = title.substring(0, titleIndex);
if (titleIndex > title.length) {
animIndex = 0;
titleIndex = 0
}
if (animIndex > 3) {
titleIndex++;
animIndex = 0
}
document.title = loadTitle + animSeq[animIndex];
animIndex++
}
window.setInterval(doInverseSpinZeroPitch, 50);
})();
const qS = q => document.querySelector(q);
let initialized = false;
document.getElementById("hint").addEventListener('click', _ => {
if (!initialized) {
qS('video').muted = false;
qS('.hint').style.display = 'none';
initialized = true;
}
});
const sites = ['as', 'home', 'about'];
sites.forEach((item) => {
document.querySelectorAll(`.nav-${item}`).forEach((a) => {
a.addEventListener('click', _ => {
nav(item);
});
});
});
function nav(site) {
const bg = [...sites];
bg.splice(sites.indexOf(site), 1);
bg.forEach((item) => {
document.getElementById(item).style.display = 'none';
});
document.getElementById(site).style.display = '';
}