Skip to content
Snippets Groups Projects
Commit badc8896 authored by OndraRehounek's avatar OndraRehounek
Browse files

main: codestyle fixes

parent e449ac6f
No related branches found
No related tags found
3 merge requests!607Pirati.cz,!594Feature/pirati cz quidecek,!575Feature/pirati cz
Pipeline #9541 passed
......@@ -28,7 +28,8 @@
href="#"
data-url="{{ page_url }}?months="
data-months="2"
class="btn btn__slide__wrap">
class="btn btn__slide__wrap"
>
<span class="btn text-sm bg-black text-white w-32 lg:text-base">
Zobrazit další
</span>
......@@ -42,26 +43,24 @@
{% endif %}
</div>
</main>
<script type="text/javascript">
function showMoreArticles(event, article) {
async function showMoreArticles(event, btn) {
event.preventDefault()
let btn = article;
let searchResultWrapper = document.getElementById('searchResultWrapper');
let url = article.getAttribute('data-url') + article.getAttribute('data-months')
fetch(url, {
const searchResultWrapper = document.getElementById('searchResultWrapper')
const url = btn.getAttribute('data-url') + btn.getAttribute('data-months')
const response = await fetch(url, {
method: "GET",
headers: {
"X-Requested-With": "XMLHttpRequest",
},
}).then((response) => response.json())
.then((data) => {
if (data.last_article)
btn.hide();
searchResultWrapper.innerHTML = data.html;
let dataMonths = parseInt(article.getAttribute('data-months')) + 1
article.setAttribute('data-months', dataMonths)
});
headers: {"X-Requested-With": "XMLHttpRequest"},
})
const data = await response.json()
if (data.last_article) { btn.hide() }
searchResultWrapper.innerHTML = data.html
btn.setAttribute('data-months', parseInt(btn.getAttribute('data-months')) + 1)
}
</script>
{% endblock content %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment