diff options
| -rw-r--r-- | public/client.html | 5 | ||||
| -rw-r--r-- | webAO/client/fetchLists.ts | 8 | ||||
| -rw-r--r-- | webAO/dom/iniEdit.ts | 2 | ||||
| -rw-r--r-- | webAO/dom/updateIniswap.ts | 18 | ||||
| -rw-r--r-- | webAO/dom/window.ts | 1 |
5 files changed, 29 insertions, 5 deletions
diff --git a/public/client.html b/public/client.html index 81400fb..9f9510a 100644 --- a/public/client.html +++ b/public/client.html @@ -521,8 +521,9 @@ <br> <br> <p>Ini editing (experimental)</p> - <label for="client_ininame">Iniedit Character:</label> - <select id="client_ininame" name="client_ininame"></select> + <label for="client_iniselect">Iniedit Character:</label> + <select id="client_iniselect" name="client_iniselect" onchange="updateIniswap()"></select> + <input id="client_ininame" name="client_ininame"></input> <button id="client_inichange" onclick="iniedit()">Change</button> <br> <br> diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index e9772cb..bf4fd1b 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -26,10 +26,12 @@ export const fetchCharacterList = async () => { // the try catch will fail before here when there is no file const char_select = <HTMLSelectElement>( - document.getElementById("client_ininame") + document.getElementById("client_iniselect") ); char_select.innerHTML = ""; + char_select.add(new Option("Custom", "0")); + char_array.forEach((character: string) => { char_select.add(new Option(character)); }); @@ -50,10 +52,12 @@ export const fetchEvidenceList = async () => { ); evi_select.innerHTML = ""; + evi_select.add(new Option("Custom", "0")); + evi_array.forEach((evi: string) => { evi_select.add(new Option(evi)); }); - evi_select.add(new Option("Custom", "0")); + } catch (err) { console.warn("there was no evidence.json file"); } diff --git a/webAO/dom/iniEdit.ts b/webAO/dom/iniEdit.ts index 0710de9..fb05ae2 100644 --- a/webAO/dom/iniEdit.ts +++ b/webAO/dom/iniEdit.ts @@ -6,7 +6,7 @@ import { packetHandler } from "../packets/packetHandler"; * Triggered by the ini button. */ export async function iniedit() { - const ininame = (<HTMLInputElement>document.getElementById("client_ininame")) + const ininame = (<HTMLInputElement>document.getElementById("client_iniselect")) .value; const inicharID = client.charID; await handleCharacterInfo(ininame.split("&"), inicharID); diff --git a/webAO/dom/updateIniswap.ts b/webAO/dom/updateIniswap.ts new file mode 100644 index 0000000..e040e64 --- /dev/null +++ b/webAO/dom/updateIniswap.ts @@ -0,0 +1,18 @@ +/** + * Update iniswap drowdown + */ +export function updateIniswap() { + const ini_select = <HTMLSelectElement>( + document.getElementById("evi_select") + ); + const ini_name = <HTMLInputElement>( + document.getElementById("evi_filename") + ); + + if (ini_select.selectedIndex === 0) { + ini_filename.style.display = "initial"; + } else { + ini_filename.style.display = "none"; + } +} +window.updateIniswap = updateIniswap; diff --git a/webAO/dom/window.ts b/webAO/dom/window.ts index 956526c..0b3bd34 100644 --- a/webAO/dom/window.ts +++ b/webAO/dom/window.ts @@ -17,6 +17,7 @@ declare global { changeBackgroundOOC: () => void; updateActionCommands: (side: string) => void; updateEvidenceIcon: () => void; + updateIniswap: () => void; resizeChatbox: () => void; setChatbox: (style: string) => void; getIndexFromSelect: (select_box: string, value: string) => Number; |
