Merge branch 'master' of gitlab2.rz.ifi.lmu.de:uni2work/uni2work

This commit is contained in:
Gregor Kleen 2019-11-15 14:07:45 +01:00
commit ab3e2baef7
3 changed files with 20 additions and 7 deletions

View File

@ -180,14 +180,27 @@ export class Datepicker {
// change the selected date in the tail.datetime instance if the value of the input element is changed
this._element.addEventListener('change', setDatepickerDate, { once: true });
// close the instance if something other than the instance was clicked (i.e. if the target is not within the datepicker instance and if any previously clicked calendar view was replaced (is not in the window anymore) because it was clicked). YES, I KNOW
window.addEventListener('click', event => {
if (!this.datepickerInstance.dt.contains(event.target) && window.document.contains(event.target)) {
// close the instance on focusout of any element if another input is focussed that is neither the timepicker nor _element
window.addEventListener('focusout', event => {
const hasFocus = event.relatedTarget !== null;
const focussedIsNotTimepicker = !this.datepickerInstance.dt.contains(event.relatedTarget);
const focussedIsNotElement = event.relatedTarget !== this._element;
const focussedIsInDocument = window.document.contains(event.relatedTarget);
if (hasFocus && focussedIsNotTimepicker && focussedIsNotElement && focussedIsInDocument)
this.datepickerInstance.close();
});
// close the instance on click on any element outside of the datepicker (except the input element itself)
window.addEventListener('click', event => {
const targetIsOutside = !this.datepickerInstance.dt.contains(event.target)
&& event.target !== this.datepickerInstance.dt;
const targetIsInDocument = window.document.contains(event.target);
const targetIsNotElement = event.target !== this._element;
if (targetIsOutside && targetIsInDocument && targetIsNotElement)
this.datepickerInstance.close();
}
});
// close the datepicker on escape keydown events
// close the instance on escape keydown events
this._element.addEventListener('keydown', event => {
if (event.keyCode === KEYCODE_ESCAPE) {
this.datepickerInstance.close();

View File

@ -33,7 +33,7 @@ $newline text
The course description can be composed in Html and
<em>should contain the module description!
<dt .deflist__dt> Unterstützung für verschiedene Institute
<dt .deflist__dt> Support for Multiple Departments
<dd .deflist__dd>
<p>
^{newU2WFeat} Uni2work supports managing multiple departments; prefixing course titles with e.g. "[MATH]" are not necessary anymore.

View File

@ -33,7 +33,7 @@ $newline text
The course description can be composed in Html and
<em>should contain the module description!
<dt .deflist__dt> Unterstützung für verschiedene Institute
<dt .deflist__dt> Support for Multiple Departments
<dd .deflist__dd>
<p>
^{newU2WFeat} Uni2work supports managing multiple departments; prefixing course titles with e.g. "[MATH]" are not necessary anymore.