diff --git a/shared/static/vendor/datetimepicker/picker.js b/shared/static/vendor/datetimepicker/picker.js index 34f96b5..be17471 100644 --- a/shared/static/vendor/datetimepicker/picker.js +++ b/shared/static/vendor/datetimepicker/picker.js @@ -43,10 +43,11 @@ class DateTimePicker { throw TypeError('Selector required to construct a DateTimePicker'); } - this.target = document.querySelector(selector); + this.target = _$(selector, document, false); if (!this.target) { throw Error(`The selector '{selector}' doesn't give any results`); } + this.target.addEventListener('click', () => { document.documentElement.classList.add('is-clipped'); this.modal.classList.add('is-active'); @@ -67,9 +68,10 @@ class DateTimePicker { // Création du modal this.modal = document.createElement('div'); + this.modal.id = `modal-${this.target.id}`; this.modal.classList.add('modal'); - this.modal.innerHTML = ``; - let _controls = this.modal.querySelectorAll('header a.button'); + this.modal.innerHTML = ``; + let _controls = _$('header a.button', this.modal); this._leftArrow = _controls[0]; this._menu = _controls[1]; this._rightArrow = _controls[2]; @@ -113,7 +115,7 @@ class DateTimePicker { } }); - let _selects = this.modal.querySelectorAll('footer select'); + let _selects = _$('footer select', this.modal); this._hour = _selects[0]; this._minutes = _selects[1]; @@ -154,7 +156,7 @@ class DateTimePicker { this._menu.innerHTML = `${months[_beginning.getMonth()]} ${_beginning.getFullYear()}`; - const _body = this.modal.querySelector('.modal-card section .column'); + const _body = _$('.modal-card section .column', this.modal, false); _body.innerHTML = `
${days[0]}${days[1]}${days[2]}${days[3]}${days[4]}${days[5]}${days[6]}
`; // Création du tableau