mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: use langConfig.hidden for remote problems
This commit is contained in:
1 parent
73b1a04bd0
commit
d60f31c427
10 files changed
+28
-27
No files matched your search
@@ -9,13 +9,12 @@ function setOptions($el, options) {
|
||||
|
||||
const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', 'homework_detail_problem_submit'], async () => {
|
||||
const { config } = UiContext.pdoc;
|
||||
const domainId = UiContext.pdoc.reference?.domainId || UiContext.pdoc.domainId;
|
||||
|
||||
function onChangeMain(update = true) {
|
||||
const options = {};
|
||||
for (const key in window.LANGS) {
|
||||
if (config.langs && !config.langs.includes(key)) continue;
|
||||
if (window.LANGS[key].domain && !window.LANGS[key].domain.includes(domainId)) continue;
|
||||
if (window.LANGS[key].hidden && !config.langs?.includes(key)) continue;
|
||||
if (key.startsWith(`${this.value}.`) && key !== this.value) options[key] = window.LANGS[key].display;
|
||||
}
|
||||
setOptions($('#codelang-sub-select'), options);
|
||||
@@ -31,7 +30,7 @@ const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', '
|
||||
const main = {};
|
||||
for (const key in window.LANGS) {
|
||||
if (config.langs && !config.langs.filter((i) => i === key || i.startsWith(`${key}.`)).length) continue;
|
||||
if (window.LANGS[key].domain && !window.LANGS[key].domain.includes(domainId)) continue;
|
||||
if (window.LANGS[key].hidden && !config.langs?.includes(key)) continue;
|
||||
if (!key.includes('.')) main[key] = window.LANGS[key].display;
|
||||
else {
|
||||
const a = key.split('.')[0];
|
||||
@@ -39,6 +38,7 @@ const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', '
|
||||
}
|
||||
}
|
||||
setOptions($('#codelang-main-select'), main);
|
||||
if (Object.keys(main).length === 1) $('#codelang-main-container').hide();
|
||||
|
||||
const current = $('[name="lang"]').val();
|
||||
if (current.includes('.')) {
|
||||
|
||||
Reference in new issue
Block a user