let structure; let components; let collections; changeVersion('1.14'); function changeVersion(version) { $.getJSON('schemas/' + version + '.json', json => { structure = json.root; components = json.components; collections = json.collections; }).fail((jqXHR, textStatus, errorThrown) => { let message = 'Failed loading ' + version + ' schema'; structure = { fields: [ { id: 'pools', type: 'error', message: message } ] }; console.error(message + '\n' + errorThrown); }).always(() => { $('#versionLabel').text(version); updateView(); }); } function updateView() { if (structure) { let {out: tableOut, component: $table} = generateTable(table, structure); $('#structure').append($table); if (i18next.isInitialized) { $('html').localize(); } $('#source').val(JSON.stringify(tableOut, null, indentation)); } } function generateTable(data, struct) { let out = {}; let $el = $('
'); $('#structure').removeClass('d-none').html(''); let type = struct.fields.find(e => e.id === 'type'); if (type) { $('.table-type').removeClass('d-none'); $('#tableType').html(''); for (let option of type.values) { $('#tableType').append(setValueAndName($('