self opening modals, loginredirects keep fragment data

This commit is contained in:
marko
2022-06-12 19:54:29 +02:00
parent 56fe127c81
commit 8329a6b2df
8 changed files with 72 additions and 57 deletions

View File

@@ -1,6 +1,4 @@
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . "./lib/");
include_once("events.inc.php");
?>
@@ -21,6 +19,21 @@ include_once("events.inc.php");
// specify options here
});
});
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.modal');
var instances = M.Modal.init(elems, {
// specify options here
});
});
// Open the given modal
document.addEventListener('DOMContentLoaded', function () {
// So far we assume the first given fragment (the stuff behind the #) is the modalId
var eventId = window.location.hash.substr(1);
var Modalelem = document.querySelector('#event-modal-'+eventId);
var instance = M.Modal.init(Modalelem);
instance.open();
});
</script>
@@ -70,6 +83,7 @@ include_once("events.inc.php");
<?php if($_SESSION['login']){ ?>
<main>
<h1 id="eventList">Übersicht anstehender Events</h1>
<!-- Table with events-->
<?php echo( eventPlaner::getHtmlEventTable(eventPlaner::getCommingWkEvents()) );?>
<h1 id="detailedEventList">Detailansicht kommender Wettkämpfe</h1>