mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: try to fix preference
This commit is contained in:
1 parent
adba3e2d24
commit
b4d38089c3
2 files changed
+9
-10
No files matched your search
@@ -94,8 +94,7 @@ const page = new NamedPage('home_preference', async () => {
|
|||||||
.hide()
|
.hide()
|
||||||
.after($el);
|
.after($el);
|
||||||
|
|
||||||
function onChangeMain() {
|
function onChangeMain(update = true) {
|
||||||
console.log(this.value, window.LANGS);
|
|
||||||
const options = {};
|
const options = {};
|
||||||
for (const key in window.LANGS) {
|
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;
|
||||||
@@ -103,16 +102,12 @@ const page = new NamedPage('home_preference', async () => {
|
|||||||
if (Object.keys(options).length > 1) {
|
if (Object.keys(options).length > 1) {
|
||||||
setOptions($('#codelang-sub-select'), options);
|
setOptions($('#codelang-sub-select'), options);
|
||||||
$('#codelang-sub-container').show();
|
$('#codelang-sub-container').show();
|
||||||
$('[name="codeLang"]').val($('#codelang-sub-container').val());
|
if (update) $('[name="codeLang"]').val($('#codelang-sub-select').val());
|
||||||
} else {
|
} else {
|
||||||
$('#codelang-sub-container').hide();
|
$('#codelang-sub-container').hide();
|
||||||
$('[name="codeLang"]').val(this.value);
|
if (update) $('[name="codeLang"]').val(this.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$('#codelang-main-select').on('change', onChangeMain);
|
|
||||||
$('#codelang-sub-select').on('change', function () {
|
|
||||||
$('[name="codeLang"]').val(this.value);
|
|
||||||
});
|
|
||||||
const main = {};
|
const main = {};
|
||||||
for (const key in window.LANGS) {
|
for (const key in window.LANGS) {
|
||||||
if (!key.includes('.')) main[key] = window.LANGS[key].display;
|
if (!key.includes('.')) main[key] = window.LANGS[key].display;
|
||||||
@@ -122,10 +117,13 @@ const page = new NamedPage('home_preference', async () => {
|
|||||||
if (current.includes('.')) {
|
if (current.includes('.')) {
|
||||||
const [m] = current.split('.');
|
const [m] = current.split('.');
|
||||||
$('#codelang-main-select').val(m);
|
$('#codelang-main-select').val(m);
|
||||||
onChangeMain.call({ value: $('#codelang-main-select').val() });
|
onChangeMain.call({ value: m }, false);
|
||||||
$('#codelang-sub-select').val(current);
|
$('#codelang-sub-select').val(current);
|
||||||
$('[name="codeLang"]').val(current);
|
|
||||||
} else $('#codelang-main-select').val(current);
|
} else $('#codelang-main-select').val(current);
|
||||||
|
$('#codelang-main-select').on('change', onChangeMain);
|
||||||
|
$('#codelang-sub-select').on('change', function () {
|
||||||
|
$('[name="codeLang"]').val(this.value);
|
||||||
|
});
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
render(
|
render(
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ const page = new NamedPage('user_detail', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
initChart();
|
initChart();
|
||||||
|
window.onresize = initChart;
|
||||||
});
|
});
|
||||||
|
|
||||||
export default page;
|
export default page;
|
||||||
Reference in new issue
Block a user