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>. <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>. 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> </section>
</footer> </footer>
</main> </main>
@ -508,12 +508,14 @@
onToggle(isOpened) { onToggle(isOpened) {
super.onToggle(isOpened); super.onToggle(isOpened);
if (isOpened) centuryInput.selectInput(); if (isOpened) centuryInput.selectInput();
centuryInput.updateTitle();
} }
}("century", $("#century-details")); }("century", $("#century-details"));
const yearDetails = new class extends ToggleableSection { const yearDetails = new class extends ToggleableSection {
onToggle(isOpened) { onToggle(isOpened) {
super.onToggle(isOpened); super.onToggle(isOpened);
if (isOpened) yearInput.selectInput(); if (isOpened) yearInput.selectInput();
yearInput.updateTitle();
} }
}("year", $("#year-details")); }("year", $("#year-details"));
@ -539,7 +541,10 @@
} }
updateTitle() { updateTitle() {
if (centuryDetails.isOpened())
this.titleLabel.innerText = `Anchor day of century starting in ${quizDate.getCentury() * 100}?`; this.titleLabel.innerText = `Anchor day of century starting in ${quizDate.getCentury() * 100}?`;
else
this.titleLabel.innerText = `Century`;
} }
}($("#century-input"), $("#century-title-label"), $("#century-submit")); }($("#century-input"), $("#century-title-label"), $("#century-submit"));
const yearInput = new class extends ValidatableInput { const yearInput = new class extends ValidatableInput {
@ -561,7 +566,10 @@
} }
updateTitle() { updateTitle() {
if (yearDetails.isOpened())
this.titleLabel.innerText = `Doomsday of year ${quizDate.date.getFullYear()}?`; this.titleLabel.innerText = `Doomsday of year ${quizDate.date.getFullYear()}?`;
else
this.titleLabel.innerText = `Year`;
} }
}($("#year-input"), $("#year-title-label"), $("#year-submit")); }($("#year-input"), $("#year-title-label"), $("#year-submit"));
const dayInput = new class extends ValidatableInput { const dayInput = new class extends ValidatableInput {