updated header, footer and feed js
All checks were successful
publish / publish (push) Successful in 23s
All checks were successful
publish / publish (push) Successful in 23s
This commit is contained in:
parent
e76e021d97
commit
9b3a38fa16
4 changed files with 82 additions and 49 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue