website/layouts/partials/photos.html

31 lines
1.1 KiB
HTML
Raw Normal View History

2024-05-28 07:51:48 +02:00
<div id="photoslist{{ if .limit }}-{{ .limit }}{{ end }}" class="transition-parent photos-list">
<span id="number" name="{{if .limit }}{{ .limit }}{{ end }}"></span>
2024-05-18 19:43:49 +02:00
<div
class="transition-child section-error-container"
style="height: 100%;">
<div class="section-error-content">
<i class="fa fas fa-times-circle"></i>
{{ .Site.Params.photos.empty }}
</div>
</div>
</div>
<script defer>
2024-05-28 07:51:48 +02:00
function loadimages(limit=-1){
2024-05-18 19:43:49 +02:00
var http = new XMLHttpRequest();
2024-05-28 07:51:48 +02:00
let issetlimit = (limit!=-1);
var url = '/getallphotos'+(issetlimit?('?limit='+limit):'');
2024-05-18 19:43:49 +02:00
http.open('GET', url, false);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
let responsehtml = http.responseText;
2024-05-28 07:51:48 +02:00
document.querySelectorAll("#photoslist"+(issetlimit?`-${limit}`:'')).forEach(
e=>{e.innerHTML = responsehtml});
2024-05-18 19:43:49 +02:00
}
}
http.send();
}
2024-05-28 07:51:48 +02:00
loadimages({{ if .limit }}{{ .limit }}{{ end }});
2024-05-18 19:43:49 +02:00
</script>