mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-22 14:33:51 +00:00
changed file selector to <optgroup>
This commit is contained in:
parent
a252ea65bd
commit
12957d7740
@ -1220,13 +1220,13 @@ async function _downloadAllFilesZipFile(e) {
|
||||
}
|
||||
|
||||
function populateExamples(sel) {
|
||||
var files = {};
|
||||
sel.append($("<option />").text("--------- Examples ---------").attr('disabled','true'));
|
||||
let files = {};
|
||||
let optgroup = $("<optgroup />").attr('label','Examples').appendTo(sel);
|
||||
for (var i=0; i<PRESETS.length; i++) {
|
||||
var preset = PRESETS[i];
|
||||
var name = preset.chapter ? (preset.chapter + ". " + preset.name) : preset.name;
|
||||
var isCurrentPreset = preset.id==current_project.mainPath;
|
||||
sel.append($("<option />").val(preset.id).text(name).attr('selected',isCurrentPreset?'selected':null));
|
||||
optgroup.append($("<option />").val(preset.id).text(name).attr('selected',isCurrentPreset?'selected':null));
|
||||
if (isCurrentPreset) current_preset = preset;
|
||||
files[preset.id] = name;
|
||||
}
|
||||
@ -1238,12 +1238,11 @@ function populateRepos(sel) {
|
||||
var n = 0;
|
||||
var repos = getRepos();
|
||||
if (repos) {
|
||||
let optgroup = $("<optgroup />").attr('label','Repositories').appendTo(sel);
|
||||
for (let repopath in repos) {
|
||||
var repo = repos[repopath];
|
||||
if (repo.platform_id && getBasePlatform(repo.platform_id) == getBasePlatform(platform_id)) {
|
||||
if (n++ == 0)
|
||||
sel.append($("<option />").text("------ Repositories ------").attr('disabled','true'));
|
||||
sel.append($("<option />").val(repo.url).text(repo.url.substring(repo.url.indexOf('/'))));
|
||||
optgroup.append($("<option />").val(repo.url).text(repo.url.substring(repo.url.indexOf('/'))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1251,16 +1250,15 @@ function populateRepos(sel) {
|
||||
}
|
||||
|
||||
async function populateFiles(sel:JQuery, category:string, prefix:string, foundFiles:{}) {
|
||||
var keys = await store.keys();
|
||||
var numFound = 0;
|
||||
let keys = await store.keys();
|
||||
if (!keys) keys = [];
|
||||
let optgroup;
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
let key = keys[i];
|
||||
if (key.startsWith(prefix) && !foundFiles[key]) {
|
||||
if (numFound++ == 0)
|
||||
sel.append($("<option />").text("------- " + category + " -------").attr('disabled','true'));
|
||||
var name = key.substring(prefix.length);
|
||||
sel.append($("<option />").val(key).text(name).attr('selected',(key==current_project.mainPath)?'selected':null));
|
||||
if (!optgroup) optgroup = $("<optgroup />").attr('label',category).appendTo(sel);
|
||||
let name = key.substring(prefix.length);
|
||||
optgroup.append($("<option />").val(key).text(name).attr('selected',(key==current_project.mainPath)?'selected':null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user