From 5b9af499c358728d1489126a55b419af70a8b7ea Mon Sep 17 00:00:00 2001 From: Gin Date: Thu, 11 May 2023 12:11:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=9F=E5=94=B1=E6=A8=A1=E6=9D=BF=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- javascript/ext_chants.js | 5 ++++- javascript/tagAutocomplete.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/javascript/ext_chants.js b/javascript/ext_chants.js index 0955327..583d997 100644 --- a/javascript/ext_chants.js +++ b/javascript/ext_chants.js @@ -17,7 +17,10 @@ class ChantParser extends BaseTagParser { let finalResults = []; tempResults.forEach(t => { let result = new AutocompleteResult(t.content.trim(), ResultType.chant) - result.meta = t.name + " Chant"; + result.meta = " Chant"; + result.type = ResultType.chant; + result.aliases = t.name; + result.category = t.color; finalResults.push(result); }); diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index fef2d64..84f04e4 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -403,8 +403,11 @@ function addResultsToList(textArea, results, tagword, resetList) { itemText.classList.add("acListItem"); let displayText = ""; + if(result.type === ResultType.chant) { + displayText = escapeHTML(result.aliases); + } // If the tag matches the tagword, we don't need to display the alias - if (result.aliases && !result.text.includes(tagword)) { // Alias + else if (result.aliases && !result.text.includes(tagword)) { // Alias let splitAliases = result.aliases.split(","); let bestAlias = splitAliases.find(a => a.toLowerCase().includes(tagword));