Hide questions if collapsed

Fixes #5.
This commit is contained in:
Florine W. Dekker 2020-04-16 10:40:44 +02:00
parent a2c44e39ca
commit 89d383247c
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
1 changed files with 11 additions and 3 deletions

View File

@ -144,7 +144,7 @@
<a href="https://git.fwdekker.com/FWDekker/doomsday/src/branch/master/LICENSE">MIT License</a>.
Source code available on <a href="https://git.fwdekker.com/FWDekker/doomsday/">git</a>.
<div style="float: right;">v1.3.1</div>
<div style="float: right;">v1.3.2</div>
</section>
</footer>
</main>
@ -508,12 +508,14 @@
onToggle(isOpened) {
super.onToggle(isOpened);
if (isOpened) centuryInput.selectInput();
centuryInput.updateTitle();
}
}("century", $("#century-details"));
const yearDetails = new class extends ToggleableSection {
onToggle(isOpened) {
super.onToggle(isOpened);
if (isOpened) yearInput.selectInput();
yearInput.updateTitle();
}
}("year", $("#year-details"));
@ -539,7 +541,10 @@
}
updateTitle() {
this.titleLabel.innerText = `Anchor day of century starting in ${quizDate.getCentury() * 100}?`;
if (centuryDetails.isOpened())
this.titleLabel.innerText = `Anchor day of century starting in ${quizDate.getCentury() * 100}?`;
else
this.titleLabel.innerText = `Century`;
}
}($("#century-input"), $("#century-title-label"), $("#century-submit"));
const yearInput = new class extends ValidatableInput {
@ -561,7 +566,10 @@
}
updateTitle() {
this.titleLabel.innerText = `Doomsday of year ${quizDate.date.getFullYear()}?`;
if (yearDetails.isOpened())
this.titleLabel.innerText = `Doomsday of year ${quizDate.date.getFullYear()}?`;
else
this.titleLabel.innerText = `Year`;
}
}($("#year-input"), $("#year-title-label"), $("#year-submit"));
const dayInput = new class extends ValidatableInput {