From eeb63912f6c44ce4c41517f9d4f7d3a94b062210 Mon Sep 17 00:00:00 2001 From: Christian Bastian <80225746+cdb-boop@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:03:33 -0400 Subject: [PATCH] Fix model type select sorting. - Remove duplicate logic in url search. --- web/model-manager.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/web/model-manager.js b/web/model-manager.js index a9246a3..a6cedd1 100644 --- a/web/model-manager.js +++ b/web/model-manager.js @@ -2036,10 +2036,11 @@ class ModelGrid { } let modelTypeOptions = []; - for (const [key, value] of Object.entries(models)) { + for (const key of Object.keys(models)) { const el = $el("option", [key]); modelTypeOptions.push(el); } + modelTypeOptions.sort((a, b) => a.innerText.localeCompare(b.innerText, undefined, {sensitivity: 'base'})); modelSelect.innerHTML = ""; modelTypeOptions.forEach(option => modelSelect.add(option)); modelSelect.value = modelType; @@ -3280,9 +3281,6 @@ class DownloadView { /** @type {HTMLButtonElement} */ clearSearchButton: null, }; - /** @type {DOMParser} */ - #domParser = null; - /** @type {Object.} */ #settings = null; @@ -3295,7 +3293,6 @@ class DownloadView { * @param {() => Promise} updateModels */ constructor(modelData, settings, updateModels) { - this.#domParser = new DOMParser(); this.#updateModels = updateModels; const update = async() => { await this.#update(modelData, settings); }; const reset = () => { @@ -3360,12 +3357,7 @@ class DownloadView { onkeydown: async (e) => { if (e.key === "Enter") { e.stopPropagation(); - if (this.elements.url.value === "") { - reset(); - } - else { - await update(); - } + searchButton.click(); e.target.blur(); } },