webupdate

This commit is contained in:
Local Server
2026-01-19 01:17:43 -06:00
parent 5b86f796d6
commit f8068ba54c
65 changed files with 2165 additions and 520 deletions

View File

@@ -1130,3 +1130,47 @@ window.AutoRefresh = AutoRefresh;
);
});
})();
// Load and display social media links in footer
(function loadFooterSocialLinks() {
document.addEventListener("DOMContentLoaded", async () => {
try {
const response = await fetch("/api/settings");
if (!response.ok) return;
const settings = await response.json();
// Map of social platform to element ID and URL format
const socialMap = {
socialFacebook: { id: "footerFacebook", url: (v) => v },
socialInstagram: { id: "footerInstagram", url: (v) => v },
socialTwitter: { id: "footerTwitter", url: (v) => v },
socialYoutube: { id: "footerYoutube", url: (v) => v },
socialPinterest: { id: "footerPinterest", url: (v) => v },
socialTiktok: { id: "footerTiktok", url: (v) => v },
socialWhatsapp: {
id: "footerWhatsapp",
url: (v) =>
v.startsWith("http")
? v
: `https://wa.me/${v.replace(/[^0-9]/g, "")}`,
},
socialLinkedin: { id: "footerLinkedin", url: (v) => v },
};
for (const [key, config] of Object.entries(socialMap)) {
const value = settings[key];
const el = document.getElementById(config.id);
if (el && value && value.trim()) {
el.href = config.url(value.trim());
el.target = "_blank";
el.rel = "noopener noreferrer";
el.style.display = "";
}
}
} catch (error) {
console.log("Could not load social links:", error);
}
});
})();