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 charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{% if page.title %}{{ page.title }} | {% endif %}{{ site.title }}</title>
|
<title>{% if page.title %}{{ page.title }} | {% endif %}{{ site.title }}</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
{% do assets.addCss('theme://css/tokens.css') %}
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
{% do assets.addCss('theme://css/style.css') %}
|
||||||
<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">
|
{% do assets.addCss('theme://css-compiled/main.css') %}
|
||||||
<link rel="stylesheet" href="{{ url('theme://css/tokens.css') }}">
|
{% do assets.addJs('theme://js/main.js', {group: 'bottom'}) %}
|
||||||
<link rel="stylesheet" href="{{ url('theme://css/style.css') }}">
|
|
||||||
{{ assets.css()|raw }}
|
{{ assets.css()|raw }}
|
||||||
{{ assets.js()|raw }}
|
{{ assets.js()|raw }}
|
||||||
</head>
|
</head>
|
||||||
@@ -26,50 +25,7 @@
|
|||||||
<main class="site-main" id="main-content">
|
<main class="site-main" id="main-content">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
|
{% block map_assets %}{% endblock %}
|
||||||
{{ assets.js('bottom')|raw }}
|
{{ 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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user