31 lines
905 B
JavaScript
31 lines
905 B
JavaScript
// What to do when the document is loaded.
|
|
// @there is code duplication between the different participo/*.json! The participoLib needs a js section!
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
// init materialize elements
|
|
initSelects();
|
|
initSidenav();
|
|
initDatepicker();
|
|
});
|
|
|
|
function initSelects() {
|
|
var elems = document.querySelectorAll("select");
|
|
var instances = M.FormSelect.init(elems);
|
|
}
|
|
|
|
function initSidenav() {
|
|
options = {};
|
|
var sideNavElems = document.querySelectorAll(".sidenav");
|
|
var sideNavInstances = M.Sidenav.init(sideNavElems, options);
|
|
}
|
|
|
|
function initDatepicker() {
|
|
options = {
|
|
format: "yyyy-mm-dd",
|
|
// workaround for v2.2.2: datepicker-container not opening on click
|
|
// @todo remove with version
|
|
openByDefault: true,
|
|
};
|
|
var elems = document.querySelectorAll(".datepicker");
|
|
var instances = M.Datepicker.init(elems, options);
|
|
}
|