Initial commit

This commit is contained in:
2026-05-12 23:33:46 +02:00
commit ccf32dcece
104 changed files with 17439 additions and 0 deletions

43
js/fitPostCardTitle.js Normal file
View File

@@ -0,0 +1,43 @@
document.addEventListener('DOMContentLoaded', function () {
function fitTitles() {
var cards = document.querySelectorAll('.post-card');
cards.forEach(function (card) {
var h2 = card.querySelector('.gradient-container h2');
if (!h2) return;
var container = h2.closest('.gradient-container');
var maxHeight = container.clientHeight;
var fontSize = parseFloat(window.getComputedStyle(h2).fontSize);
var minSize = 12;
h2.style.fontSize = '';
fontSize = parseFloat(window.getComputedStyle(h2).fontSize);
while (h2.scrollHeight > maxHeight && fontSize > minSize) {
fontSize -= 1;
h2.style.fontSize = fontSize + 'px';
}
});
}
window.fitPostCardTitles = fitTitles;
fitTitles();
var resizeTimer;
window.addEventListener('resize', function () {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(fitTitles, 200);
});
// Re-fit after infinite scroll loads new cards
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (m) {
if (m.addedNodes.length) fitTitles();
});
});
var grid = document.getElementById('post-grid');
if (grid) {
observer.observe(grid, { childList: true });
}
});