added about.html
This commit is contained in:
parent
1d5b7bd374
commit
3534f84b27
3 changed files with 77 additions and 4 deletions
|
|
@ -63,7 +63,14 @@ function createTab(entry) {
|
|||
tab.classList.add("tab-external");
|
||||
}
|
||||
|
||||
if (entry.icon) {
|
||||
if (entry._isAbout) {
|
||||
// About tab gets a rotating icon like the site favicon
|
||||
const img = document.createElement("img");
|
||||
img.className = "tab-icon";
|
||||
img.alt = "";
|
||||
aboutIcons.push(img);
|
||||
tab.appendChild(img);
|
||||
} else if (entry.icon) {
|
||||
const img = document.createElement("img");
|
||||
img.className = "tab-icon";
|
||||
img.src = `data:image/png;base64,${entry.icon}`;
|
||||
|
|
@ -82,6 +89,10 @@ function createTab(entry) {
|
|||
|
||||
// Click handler
|
||||
tab.addEventListener("click", () => {
|
||||
if (entry._isAbout) {
|
||||
openInlineViewer(tab, entry, "/about.html");
|
||||
return;
|
||||
}
|
||||
const url = `${entry.protocol || "https"}://${entry.host}`;
|
||||
if (entry.iframe_ok) {
|
||||
openInlineViewer(tab, entry, url);
|
||||
|
|
@ -149,6 +160,18 @@ async function loadMore() {
|
|||
}
|
||||
|
||||
if (entries.length > 0) {
|
||||
// Inject the "About Every Tab" tab at a random position in the first load
|
||||
if (container.children.length === 0) {
|
||||
const aboutEntry = {
|
||||
host: "everytab.site/about.html",
|
||||
title: "About Every Tab",
|
||||
icon: "",
|
||||
iframe_ok: true,
|
||||
_isAbout: true,
|
||||
};
|
||||
const pos = Math.floor(rng() * Math.min(entries.length, tabsPerRow() * 3));
|
||||
entries.splice(pos, 0, aboutEntry);
|
||||
}
|
||||
renderEntries(entries);
|
||||
loadingEl.style.display = "none";
|
||||
}
|
||||
|
|
@ -161,11 +184,16 @@ faviconLink.type = "image/png";
|
|||
document.head.appendChild(faviconLink);
|
||||
|
||||
const loadedIcons = [];
|
||||
const aboutIcons = []; // img elements for "About" tabs — rotate their icons too
|
||||
|
||||
setInterval(() => {
|
||||
if (loadedIcons.length === 0) return;
|
||||
const icon = loadedIcons[Math.floor(Math.random() * loadedIcons.length)];
|
||||
faviconLink.href = `data:image/png;base64,${icon}`;
|
||||
const dataUri = `data:image/png;base64,${icon}`;
|
||||
faviconLink.href = dataUri;
|
||||
for (const img of aboutIcons) {
|
||||
img.src = dataUri;
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
// Infinite scroll
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue