ui: fix cond

This commit is contained in:
undefined committed 2021-05-07 22:25:18 +08:00
1 parent 80ac44d98e
commit 0af07a5d16
3 files changed
+3 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.8.1",
"version": "4.8.2",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
@@ -98,7 +98,7 @@ const page = new NamedPage('home_preference', async () => {
$('[name="codeLang"]').val(this.value);
const options = {};
for (const key in window.LANGS) {
if (`${key.startsWith(this.value)}.` && key !== this.value) options[key] = window.LANGS[key].display;
if (key.startsWith(`${this.value}.`) && key !== this.value) options[key] = window.LANGS[key].display;
}
if (Object.keys(options).length > 1) {
setOptions($('#codelang-sub-select'), options);
@@ -16,7 +16,7 @@ const page = new NamedPage('problem_submit', async () => {
$('[name="lang"]').val(this.value);
const options = {};
for (const key in window.LANGS) {
if (`${key.startsWith(this.value)}.` && key !== this.value) options[key] = window.LANGS[key].display;
if (key.startsWith(`${this.value}.`) && key !== this.value) options[key] = window.LANGS[key].display;
}
if (Object.keys(options).length > 1) {
setOptions($('#codelang-sub-select'), options);
@@ -32,7 +32,6 @@ const page = new NamedPage('problem_submit', async () => {
}
setOptions($('#codelang-main-select'), main);
const current = $('[name="lang"]').val();
console.log(current);
if (current.includes('.')) {
const [m, s] = current.split('.');
$('#codelang-main-select').val(m);