1696f47fe9
- Global headings: drop ALL CAPS, use sentence case + weight 700 - Post cards: refined date (small/uppercase/muted), cleaner title hierarchy - Single post: date metadata style, subtitle no-italic, body line-height 1.75 - Logo frame (#header .logo): border-radius 12px - All images: border-radius 8px (posts), 6px (gallery) - Smooth lazy-load: CSS fadeIn animation + JS fallback (image-fade.js) - Cache-busting: typography CSS with Hugo timestamp query string - Trip card: replace broken gallery link with direct Elbrus S3 image URL Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
// Плавное появление lazy-loaded изображений
|
||
// Работает с img[loading="lazy"] — добавляет класс .loaded после загрузки
|
||
(function () {
|
||
function onImageLoad(img) {
|
||
img.classList.add('loaded');
|
||
}
|
||
|
||
// Обработать все lazy-loaded изображения
|
||
document.querySelectorAll('img[loading="lazy"]').forEach(function (img) {
|
||
if (img.complete && img.naturalHeight > 0) {
|
||
// Уже загружено (из кэша)
|
||
onImageLoad(img);
|
||
} else {
|
||
img.addEventListener('load', function () {
|
||
onImageLoad(img);
|
||
});
|
||
// На случай ошибки — всё равно показать (без анимации)
|
||
img.addEventListener('error', function () {
|
||
onImageLoad(img);
|
||
});
|
||
}
|
||
});
|
||
|
||
// Для динамически добавляемых изображений (MutationObserver)
|
||
if ('MutationObserver' in window) {
|
||
new MutationObserver(function (mutations) {
|
||
mutations.forEach(function (mutation) {
|
||
mutation.addedNodes.forEach(function (node) {
|
||
if (node.nodeName === 'IMG' && node.getAttribute('loading') === 'lazy') {
|
||
if (node.complete && node.naturalHeight > 0) {
|
||
onImageLoad(node);
|
||
} else {
|
||
node.addEventListener('load', function () { onImageLoad(node); });
|
||
node.addEventListener('error', function () { onImageLoad(node); });
|
||
}
|
||
}
|
||
});
|
||
});
|
||
}).observe(document.body, { childList: true, subtree: true });
|
||
}
|
||
})();
|