Fix model type select sorting.
- Remove duplicate logic in url search.
This commit is contained in:
@@ -2036,10 +2036,11 @@ class ModelGrid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let modelTypeOptions = [];
|
let modelTypeOptions = [];
|
||||||
for (const [key, value] of Object.entries(models)) {
|
for (const key of Object.keys(models)) {
|
||||||
const el = $el("option", [key]);
|
const el = $el("option", [key]);
|
||||||
modelTypeOptions.push(el);
|
modelTypeOptions.push(el);
|
||||||
}
|
}
|
||||||
|
modelTypeOptions.sort((a, b) => a.innerText.localeCompare(b.innerText, undefined, {sensitivity: 'base'}));
|
||||||
modelSelect.innerHTML = "";
|
modelSelect.innerHTML = "";
|
||||||
modelTypeOptions.forEach(option => modelSelect.add(option));
|
modelTypeOptions.forEach(option => modelSelect.add(option));
|
||||||
modelSelect.value = modelType;
|
modelSelect.value = modelType;
|
||||||
@@ -3280,9 +3281,6 @@ class DownloadView {
|
|||||||
/** @type {HTMLButtonElement} */ clearSearchButton: null,
|
/** @type {HTMLButtonElement} */ clearSearchButton: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @type {DOMParser} */
|
|
||||||
#domParser = null;
|
|
||||||
|
|
||||||
/** @type {Object.<string, HTMLElement>} */
|
/** @type {Object.<string, HTMLElement>} */
|
||||||
#settings = null;
|
#settings = null;
|
||||||
|
|
||||||
@@ -3295,7 +3293,6 @@ class DownloadView {
|
|||||||
* @param {() => Promise<void>} updateModels
|
* @param {() => Promise<void>} updateModels
|
||||||
*/
|
*/
|
||||||
constructor(modelData, settings, updateModels) {
|
constructor(modelData, settings, updateModels) {
|
||||||
this.#domParser = new DOMParser();
|
|
||||||
this.#updateModels = updateModels;
|
this.#updateModels = updateModels;
|
||||||
const update = async() => { await this.#update(modelData, settings); };
|
const update = async() => { await this.#update(modelData, settings); };
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
@@ -3360,12 +3357,7 @@ class DownloadView {
|
|||||||
onkeydown: async (e) => {
|
onkeydown: async (e) => {
|
||||||
if (e.key === "Enter") {
|
if (e.key === "Enter") {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (this.elements.url.value === "") {
|
searchButton.click();
|
||||||
reset();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await update();
|
|
||||||
}
|
|
||||||
e.target.blur();
|
e.target.blur();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user