diff --git a/src/css/home.css b/src/css/home.css index 04cb0a3..b884ec1 100644 --- a/src/css/home.css +++ b/src/css/home.css @@ -20,7 +20,7 @@ input, select, textarea, button { - font-family: InterVariable,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"; + font-family: InterVariable,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji",sans-serif; } h1, diff --git a/src/js/home.js b/src/js/home.js index 81636ca..bdfb2f7 100644 --- a/src/js/home.js +++ b/src/js/home.js @@ -15,12 +15,15 @@ function cleanUpExpiredCache() { } function decodeHtmlEntities(str) { - return str - .replaceAll('<', '<') - .replaceAll('>', '>') - .replaceAll('&', '&') - .replaceAll('"', '"') - .replaceAll(''', "'"); + const entities = { + '<': '<', + '>': '>', + '&': '&', + '"': '"', + ''': "'" + }; + + return str.replace(/&(lt|gt|amp|quot|#39);/g, (match, p1) => entities[match] || match); } function areDatesOnTheSameDay(date1, date2) { @@ -84,7 +87,7 @@ function fetchFeed(url) { let potentialImage; if (content.innerHTML) { placeholder.innerHTML = decodeHtmlEntities(content.innerHTML); - potentialImage = (item.getElementsByTagName("media:thumbnail").src) || (placeholder.querySelector("img") ? placeholder.querySelector("img").src : `https://logo.clearbit.com/${url.split("/")[2]}`); + potentialImage = (item.getElementsByTagName("media:thumbnail").src || item.getElementsByTagName("media:content")[0]?.getAttribute("url")) || (placeholder.querySelector("img") ? placeholder.querySelector("img").src : `https://logo.clearbit.com/${url.split("/")[2]}`); } else { placeholder.innerHTML = description ? description : new Date(item.querySelector("pubDate, published") ? item.querySelector("pubDate, published").textContent : "").toDateString(); potentialImage = item.getElementsByTagName("media:thumbnail")?.url || `https://logo.clearbit.com/${url.split("/")[2]}`;