random favicon selection changing
This commit is contained in:
parent
e5035d9a28
commit
f64b93b229
1 changed files with 15 additions and 0 deletions
|
|
@ -70,6 +70,7 @@ function createTab(entry) {
|
||||||
img.alt = "";
|
img.alt = "";
|
||||||
img.loading = "lazy";
|
img.loading = "lazy";
|
||||||
tab.appendChild(img);
|
tab.appendChild(img);
|
||||||
|
loadedIcons.push(entry.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = document.createElement("span");
|
const title = document.createElement("span");
|
||||||
|
|
@ -153,6 +154,20 @@ async function loadMore() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rotating site favicon — picks a random loaded icon every second
|
||||||
|
const faviconLink = document.createElement("link");
|
||||||
|
faviconLink.rel = "icon";
|
||||||
|
faviconLink.type = "image/png";
|
||||||
|
document.head.appendChild(faviconLink);
|
||||||
|
|
||||||
|
const loadedIcons = [];
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
if (loadedIcons.length === 0) return;
|
||||||
|
const icon = loadedIcons[Math.floor(Math.random() * loadedIcons.length)];
|
||||||
|
faviconLink.href = `data:image/png;base64,${icon}`;
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
// Infinite scroll
|
// Infinite scroll
|
||||||
let loading = false;
|
let loading = false;
|
||||||
window.addEventListener("scroll", async () => {
|
window.addEventListener("scroll", async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue