mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: fix highlighter
This commit is contained in:
1 parent
a5f8f02d8e
commit
015c55f144
4 files changed
+12
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.8.12",
|
||||
"version": "4.8.13",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -95,7 +95,6 @@ const page = new NamedPage('home_preference', async () => {
|
||||
.after($el);
|
||||
|
||||
$('#codelang-main-select').on('change', function () {
|
||||
$('[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;
|
||||
@@ -103,7 +102,11 @@ const page = new NamedPage('home_preference', async () => {
|
||||
if (Object.keys(options).length > 1) {
|
||||
setOptions($('#codelang-sub-select'), options);
|
||||
$('#codelang-sub-container').show();
|
||||
} else $('#codelang-sub-container').hide();
|
||||
$('[name="codeLang"]').val($('#codelang-sub-container').val());
|
||||
} else {
|
||||
$('#codelang-sub-container').hide();
|
||||
$('[name="codeLang"]').val(this.value);
|
||||
}
|
||||
});
|
||||
$('#codelang-sub-select').on('change', function () {
|
||||
$('[name="codeLang"]').val(this.value);
|
||||
|
||||
@@ -13,7 +13,6 @@ const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit'],
|
||||
$('[name="problem-sidebar__categories"]').show();
|
||||
});
|
||||
$('#codelang-main-select').on('change', function () {
|
||||
$('[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;
|
||||
@@ -21,7 +20,11 @@ const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit'],
|
||||
if (Object.keys(options).length > 1) {
|
||||
setOptions($('#codelang-sub-select'), options);
|
||||
$('#codelang-sub-container').show();
|
||||
} else $('#codelang-sub-container').hide();
|
||||
$('[name="codeLang"]').val($('#codelang-sub-container').val());
|
||||
} else {
|
||||
$('#codelang-sub-container').hide();
|
||||
$('[name="codeLang"]').val(this.value);
|
||||
}
|
||||
});
|
||||
$('#codelang-sub-select').on('change', function () {
|
||||
$('[name="lang"]').val(this.value);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<h1 class="section__title">{{ _('Code') }}</h1>
|
||||
</div>
|
||||
<div class="section__body">
|
||||
<pre><code class="line-numbers language-{{ model.system.langs[rdoc.lang].highlight }}">{{ rdoc['code'] }}</code></pre>
|
||||
<pre><code class="line-numbers language-{{ model.setting.langs[rdoc.lang].highlight }}">{{ rdoc['code'] }}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in new issue
Block a user