mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-01 01:59:33 +00:00
Add home menu
This commit is contained in:
@@ -23,6 +23,10 @@ function initLng() {
|
||||
|
||||
function changeLng(code) {
|
||||
i18next.changeLanguage(code).then(() => {
|
||||
updateView()
|
||||
if ('listeners' in window) {
|
||||
listeners.forEach(l => l());
|
||||
} else {
|
||||
$('html').localize();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ function addListener(listener) {
|
||||
|
||||
loadGenerator($('[data-generator]').attr('data-generator'));
|
||||
function loadGenerator(generator) {
|
||||
if (!generator) return;
|
||||
const versions = generators[generator] || [];
|
||||
versions.forEach(v => {
|
||||
$('#versionList').append(`<a class="dropdown-item" onclick="changeVersion('${v}')">${v}</a>`)
|
||||
@@ -37,6 +38,7 @@ function loadGenerator(generator) {
|
||||
function loadVersion(generator, version) {
|
||||
return $.getJSON('../schemas/' + version + '.json', json => {
|
||||
structure = json.roots.find(e => e.id === generator);
|
||||
table = structure.default;
|
||||
components = json.components;
|
||||
collections = json.collections;
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
|
||||
@@ -7,6 +7,7 @@ addListener(updateView);
|
||||
|
||||
changeTheme(localStorage.getItem('theme'))
|
||||
function changeTheme(theme) {
|
||||
console.log(theme);
|
||||
if (theme === null) {
|
||||
theme = 'light';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user