From b121ec076b0cb1b69296b909078d208492b4f3c9 Mon Sep 17 00:00:00 2001 From: Yeghro <130201060+Yeghro@users.noreply.github.com> Date: Sat, 25 Jan 2025 00:33:53 -0800 Subject: [PATCH] added icons --- script.js | 48 +++++++++++------------------------------------- styles.css | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/script.js b/script.js index 1381ce0..a85f3b6 100644 --- a/script.js +++ b/script.js @@ -309,6 +309,16 @@ function createResourceCard(resource) { card.setAttribute('itemscope', ''); card.setAttribute('itemtype', 'https://schema.org/SoftwareApplication'); + // Extract domain for favicon + let faviconUrl = ''; + try { + const url = new URL(resource.link); + // Using Google's favicon service as a fallback if the direct favicon isn't available + faviconUrl = `https://www.google.com/s2/favicons?domain=${url.hostname}&sz=32`; + } catch (e) { + console.warn('Invalid URL:', resource.link); + } + card.innerHTML = `