From cd43fccc0d975fd6f54d759299ac7c0f420947f4 Mon Sep 17 00:00:00 2001 From: Haku Date: Mon, 20 Jun 2022 17:55:44 -0400 Subject: [PATCH] replaced reports page functionality with a new action button which does both moving and refreshing --- src/main.ts | 14 ++++++++++---- src/region.ts | 13 +++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 8a0625d..485decc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,10 +19,16 @@ const keybinds: Keybind[] = [ functionName: 'move', displayName: null, callback: () => { - const moveButton: HTMLButtonElement = - document.querySelector('button[name=move_region]') as HTMLButtonElement; - if (moveButton) - moveButton.click(); + if (urlParams['page'] === 'reports') { + const actionButton: HTMLInputElement = document.querySelector('#action'); + if (actionButton) + actionButton.click(); + } else { + const moveButton: HTMLButtonElement = + document.querySelector('button[name=move_region]') as HTMLButtonElement; + if (moveButton) + moveButton.click(); + } }, modifiedCallback: null }, diff --git a/src/region.ts b/src/region.ts index e69de29..f15a59c 100644 --- a/src/region.ts +++ b/src/region.ts @@ -0,0 +1,13 @@ +(() => +{ + const moveButton: HTMLButtonElement = document.querySelector('button[name=move_region]'); + if (moveButton) { + const localid = (document.querySelector('input[name=localid]') as HTMLInputElement).value; + moveButton.addEventListener('click', (e) => + { + moveButton.disabled = true; + e.preventDefault(); + window.location.href = `/template-overall=none/page=change_region?localid=${localid}®ion_name=${urlParams['region']}&move_region=1`; + }); + } +})(); \ No newline at end of file