diff --git a/src/Page/BuildingPage.ts b/src/Page/BuildingPage.ts index f130574..e2a1c5e 100644 --- a/src/Page/BuildingPage.ts +++ b/src/Page/BuildingPage.ts @@ -46,10 +46,13 @@ export function clickUpgradeButton() { } export function createUpgradeButton(onClickHandler: (resources: Resources) => void) { + const upgradeContainer = jQuery('.upgradeButtonsContainer .section1'); + if (upgradeContainer.length !== 1) { + return; + } const id = uniqId(); - jQuery('.upgradeButtonsContainer .section1').append( - `
` - ); + const btn = ``; + upgradeContainer.append(btn); const resources = grabContractResources(); jQuery(`#${id}`).on('click', evt => { evt.preventDefault(); diff --git a/src/Page/BuildingPageController.ts b/src/Page/BuildingPageController.ts index 178dd4b..28f2de6 100644 --- a/src/Page/BuildingPageController.ts +++ b/src/Page/BuildingPageController.ts @@ -31,7 +31,7 @@ export class BuildingPageController { } run() { - const buildTypeId = this.attributes.buildTypeId; + const { buildTypeId } = this.attributes; this.logger.log('BUILD PAGE DETECTED', 'ID', this.attributes.buildId, 'TYPE', buildTypeId); if (buildTypeId) {