feat: register assets via Asset Manager, remove Google Fonts, remove inline photo strip script
This commit is contained in:
@@ -4,11 +4,10 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% if page.title %}{{ page.title }} | {% endif %}{{ site.title }}</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url('theme://css/tokens.css') }}">
|
||||
<link rel="stylesheet" href="{{ url('theme://css/style.css') }}">
|
||||
{% do assets.addCss('theme://css/tokens.css') %}
|
||||
{% do assets.addCss('theme://css/style.css') %}
|
||||
{% do assets.addCss('theme://css-compiled/main.css') %}
|
||||
{% do assets.addJs('theme://js/main.js', {group: 'bottom'}) %}
|
||||
{{ assets.css()|raw }}
|
||||
{{ assets.js()|raw }}
|
||||
</head>
|
||||
@@ -26,50 +25,7 @@
|
||||
<main class="site-main" id="main-content">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
{% block map_assets %}{% endblock %}
|
||||
{{ assets.js('bottom')|raw }}
|
||||
<script>
|
||||
(function () {
|
||||
document.querySelectorAll('.journal-photo-strip').forEach(function (strip) {
|
||||
strip.setAttribute('role', 'region');
|
||||
strip.setAttribute('aria-label', 'Photo strip');
|
||||
strip.setAttribute('tabindex', '0');
|
||||
|
||||
var slideCount = parseInt(strip.dataset.slides, 10) || 1;
|
||||
var dots = strip.nextElementSibling;
|
||||
if (!dots || !dots.classList.contains('journal-photo-dots')) return;
|
||||
var dotEls = Array.from(dots.querySelectorAll('.journal-photo-dot'));
|
||||
|
||||
strip.addEventListener('scroll', function () {
|
||||
var idx = Math.round(strip.scrollLeft / strip.offsetWidth);
|
||||
dotEls.forEach(function (d, i) { d.classList.toggle('is-active', i === idx); });
|
||||
}, { passive: true });
|
||||
|
||||
if (slideCount < 2) return;
|
||||
|
||||
var prev = document.createElement('button');
|
||||
prev.className = 'strip-prev';
|
||||
prev.setAttribute('aria-label', 'Previous photo');
|
||||
prev.textContent = '‹';
|
||||
prev.addEventListener('click', function () {
|
||||
strip.scrollBy({ left: -strip.offsetWidth, behavior: 'smooth' });
|
||||
});
|
||||
|
||||
var next = document.createElement('button');
|
||||
next.className = 'strip-next';
|
||||
next.setAttribute('aria-label', 'Next photo');
|
||||
next.textContent = '›';
|
||||
next.addEventListener('click', function () {
|
||||
strip.scrollBy({ left: strip.offsetWidth, behavior: 'smooth' });
|
||||
});
|
||||
|
||||
var controls = document.createElement('div');
|
||||
controls.className = 'strip-controls';
|
||||
controls.appendChild(prev);
|
||||
controls.appendChild(next);
|
||||
var wrap = strip.closest('.journal-photo-wrap');
|
||||
(wrap || dots).insertAdjacentElement('afterend', controls);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user