mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-03 22:30:51 +08:00
chore: 🤖 improve calendar option page
This commit is contained in:
parent
9c5a016a93
commit
e701adac9f
@ -55,7 +55,7 @@ const TPL = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option-row">
|
<div class="option-row min-days-row" style="display: none;">
|
||||||
<label for="min-days-in-first-week">${t("i18n.min-days-in-first-week")}</label>
|
<label for="min-days-in-first-week">${t("i18n.min-days-in-first-week")}</label>
|
||||||
<select id="min-days-in-first-week" class="form-select">
|
<select id="min-days-in-first-week" class="form-select">
|
||||||
${Array.from({length: 7}, (_, i) => i + 1)
|
${Array.from({length: 7}, (_, i) => i + 1)
|
||||||
@ -132,11 +132,23 @@ export default class LocalizationOptions extends OptionsWidget {
|
|||||||
this.updateOption("firstDayOfWeek", firstDayOfWeek);
|
this.updateOption("firstDayOfWeek", firstDayOfWeek);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$widget.find(`input[name="first-week-of-year"]`).on("change", () => {
|
this.$widget.find('input[name="first-week-of-year"]').on('change', (e) => {
|
||||||
const firstWeekOfYear = String(this.$widget.find(`input[name="first-week-of-year"]:checked`).val());
|
const target = e.target as HTMLInputElement;
|
||||||
this.updateOption("firstWeekOfYear", firstWeekOfYear);
|
const value = parseInt(target.value);
|
||||||
|
const $minDaysRow = this.$widget.find('.min-days-row');
|
||||||
|
|
||||||
|
if (value === 2) {
|
||||||
|
$minDaysRow.show();
|
||||||
|
} else {
|
||||||
|
$minDaysRow.hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const currentValue = this.$widget.find('input[name="first-week-of-year"]:checked').val();
|
||||||
|
if (currentValue === "2") {
|
||||||
|
this.$widget.find('.min-days-row').show();
|
||||||
|
}
|
||||||
|
|
||||||
this.$widget.find("#min-days-in-first-week").on("change", () => {
|
this.$widget.find("#min-days-in-first-week").on("change", () => {
|
||||||
const minDays = String(this.$widget.find("#min-days-in-first-week").val());
|
const minDays = String(this.$widget.find("#min-days-in-first-week").val());
|
||||||
this.updateOption("minDaysInFirstWeek", minDays);
|
this.updateOption("minDaysInFirstWeek", minDays);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user