mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix codeLang-sub-select
This commit is contained in:
1 parent
41f6149359
commit
5fad63a3e1
4 files changed
+9
-7
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.8.7",
|
"version": "4.8.8",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -114,11 +114,10 @@ const page = new NamedPage('home_preference', async () => {
|
|||||||
}
|
}
|
||||||
setOptions($('#codelang-main-select'), main);
|
setOptions($('#codelang-main-select'), main);
|
||||||
const current = $('[name="codeLang"]').val();
|
const current = $('[name="codeLang"]').val();
|
||||||
console.log(current);
|
|
||||||
if (current.includes('.')) {
|
if (current.includes('.')) {
|
||||||
const [m, s] = current.split('.');
|
const [m, s] = current.split('.');
|
||||||
$('#codelang-main-select').val(m);
|
$('#codelang-main-select').val(m);
|
||||||
$('#codelang-sub-select').val(s);
|
$('#codelang-sub-select').val(s).show();
|
||||||
} else $('#codelang-main-select').val(current);
|
} else $('#codelang-main-select').val(current);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const page = new NamedPage('problem_submit', async () => {
|
|||||||
if (current.includes('.')) {
|
if (current.includes('.')) {
|
||||||
const [m, s] = current.split('.');
|
const [m, s] = current.split('.');
|
||||||
$('#codelang-main-select').val(m);
|
$('#codelang-main-select').val(m);
|
||||||
$('#codelang-sub-select').val(s);
|
$('#codelang-sub-select').val(s).show();
|
||||||
} else $('#codelang-main-select').val(current);
|
} else $('#codelang-main-select').val(current);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @param {string} str
|
||||||
|
* @param {any} obj
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
export default function substitute(str, obj) {
|
export default function substitute(str, obj) {
|
||||||
return str.replace(/\{([^{}]+)\}/g, (match, key) => {
|
return str.replace(/\{([^{}]+)\}/g, (match, key) => {
|
||||||
if (obj[key] !== undefined) {
|
if (obj[key] !== undefined) return obj[key].toString();
|
||||||
return String(obj[key]);
|
|
||||||
}
|
|
||||||
return `{${key}}`;
|
return `{${key}}`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user