ui: allow font customization

This commit is contained in:
undefined committed 2022-02-22 00:24:50 +08:00
1 parent cf1195a6ee
commit 9b2c36efbf
13 files changed
+93 -31

No files matched your search

@@ -2,7 +2,7 @@ import { NamedPage } from 'vj/misc/Page';
import i18n from 'vj/utils/i18n';
import tpl from 'vj/utils/tpl';
const page = new NamedPage('home_preference', () => {
function initCodeLangHelper() {
function setOptions($el, options) {
$el.empty();
$.each(options, (key, value) => {
@@ -66,6 +66,14 @@ const page = new NamedPage('home_preference', () => {
$('#codelang-sub-select').on('change', function () {
$('[name="codeLang"]').val(this.value);
});
}
const page = new NamedPage('home_preference', () => {
initCodeLangHelper();
$('[name="fontFamily"] option, [name="codeFontFamily"] option').each(function () {
this.style.fontFamily = this.getAttribute('value');
this.textContent = i18n(this.textContent.trim());
});
});
export default page;
@@ -231,8 +231,6 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
{ value: UiContext.pdoc.stats.WA, name: 'WA' },
{ value: UiContext.pdoc.stats.RE, name: 'RE' },
{ value: UiContext.pdoc.stats.CE, name: 'CE' },
{ value: UiContext.pdoc.stats.SE, name: 'SE' },
{ value: UiContext.pdoc.stats.IGN, name: 'IGN' },
],
},
],
@@ -205,7 +205,7 @@ async function handleOperation(operation) {
await request.post('', { operation, pids, ...payload });
Notification.success(i18n(`Selected problems have been ${operation === 'copy' ? 'copie' : operation}d.`));
await delay(2000);
window.location.reload();
updateSelection(true);
} catch (error) {
Notification.error(error.message);
}