Liveblog basic functionality

This commit is contained in:
NH Gooi
2026-02-11 19:36:53 +01:00
parent b78379f268
commit 6786ac7ce1
3 changed files with 35 additions and 2 deletions

View File

@@ -31,6 +31,12 @@
@section('content')
<div id="updates-box" class="box full-width" style="display: none;">
<b>Er zijn updates van dit liveblog.</b>
<a href="{{Request::getPathInfo()}}" class="btn" onclick="$(this).attr('disabled', 'disabled');"><span class="fa fa-undo"
class="btn"></span><span>Laad de nieuwste berichten.</span></a>
</div>
<h3 class="excerpt">
@if($blog->is_actief)
<span style="font-family: sans-serif; padding: 3px; color: white; background-color: #BD0013; border-radius: 5px;"
@@ -55,4 +61,20 @@
{{-- @yield('controls')
<p class="center">(Pagina {{$pagina}})</p> --}}
<script>
var laatste_update = Date.parse("{{ $blog->bijgewerkt }}");
// alert(laatste_update);
var auto_update = setInterval(function() {
$.ajax({
url: '{{ Request::getPathInfo() }}',
success: function (data) {
var nieuwe_update = Date.parse(data.bijgewerkt);
if( nieuwe_update <= laatste_update) return;
$('#updates-box').slideDown();
laatste_update = nieuwe_update;
}
});
}, 1000);
</script>
@endsection

View File

@@ -15,6 +15,11 @@ Home
<span class="bi bi-blog"></span>
<b>Liveblog: {{$liveblog->titel}}</b>
</a>
@foreach($liveblog->artikelen as $artikel)
&bull; {{ $artikel->titel }}
@if($loop->index == 2) @break @endif
@endforeach
@break
@endforeach
</div>
@endif