2020-06-09 04:02:03 +02:00
|
|
|
class CenteredBox {
|
2020-06-09 12:13:12 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
constructor() {
|
|
|
|
this._centeredBox = document.querySelector('#centeredBox');
|
2020-06-04 07:43:09 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
this._centeredBoxVisibility = true;
|
2020-06-04 08:13:46 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
this.showCenteredBox = this.showCenteredBox.bind(this);
|
|
|
|
this.hideCenteredBox = this.hideCenteredBox.bind(this);
|
|
|
|
this.toggleCenteredBox = this.toggleCenteredBox.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
showCenteredBox = () => {
|
|
|
|
this._centeredBox.classList.remove('hiddenBox');
|
|
|
|
this._centeredBoxVisibility = !this._centeredBoxVisibility;
|
|
|
|
}
|
2020-06-04 08:13:46 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
hideCenteredBox = () => {
|
|
|
|
this._centeredBox.classList.add('hiddenBox');
|
|
|
|
this._centeredBoxVisibility = !this._centeredBoxVisibility;
|
|
|
|
}
|
2020-06-04 08:13:46 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
toggleCenteredBox = () => {
|
2020-06-04 08:13:46 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
if (this._centeredBoxVisibility) {
|
|
|
|
// hide centered box
|
|
|
|
this.hideCenteredBox();
|
2020-06-04 08:13:46 +02:00
|
|
|
|
2020-06-09 04:02:03 +02:00
|
|
|
} else {
|
|
|
|
// Show centered box
|
|
|
|
this.showCenteredBox();
|
|
|
|
}
|
2020-06-04 08:13:46 +02:00
|
|
|
}
|
|
|
|
}
|