diff --git a/assets/js/main.js b/assets/js/main.js index b4ad436..183cd01 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,5 +1,3 @@ -// noinspection JSUnresolvedReference - /* ======================== Darkmode ======================== */ @@ -62,6 +60,8 @@ window.toggleDetails = function (element) { /* ======================== News Feed ======================== */ +let lastColumnCount = null; + function renderFeedEntries(data) { const container = document.getElementById('feed'); if (!container) return; @@ -71,6 +71,7 @@ function renderFeedEntries(data) { if (isInFeedSection) { const computedStyle = window.getComputedStyle(container); const columnCount = computedStyle.getPropertyValue('grid-template-columns').split(' ').length; + lastColumnCount = columnCount; maxItems = columnCount === 3 ? 3 : 4; } else { maxItems = data.items.length; @@ -119,6 +120,14 @@ fetch('https://api.rss2json.com/v1/api.json?rss_url=https://toot.kif.rocks/@ifsr .then(data => { renderFeedEntries(data); window.addEventListener('resize', () => { - renderFeedEntries(data); + const container = document.getElementById('feed'); + if (!container) return; + + const computedStyle = window.getComputedStyle(container); + const columnCount = computedStyle.getPropertyValue('grid-template-columns').split(' ').length; + + if (columnCount !== lastColumnCount) { + renderFeedEntries(data); + } }); }); \ No newline at end of file diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html index c8934a8..eeab750 100644 --- a/layouts/_partials/footer.html +++ b/layouts/_partials/footer.html @@ -1,36 +1,55 @@ \ No newline at end of file diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html index 55eb157..d1dda05 100644 --- a/layouts/_partials/head.html +++ b/layouts/_partials/head.html @@ -3,10 +3,12 @@ + + + +