Extract some dom-manipulations

This commit is contained in:
2020-04-12 10:01:56 +03:00
parent a23872972e
commit 4dd11a60f7
4 changed files with 22 additions and 14 deletions

9
src/Page/BuildingPage.ts Normal file
View File

@ -0,0 +1,9 @@
import { GrabError } from '../Errors';
export function clickUpgradeButton() {
const btn = jQuery('.upgradeButtonsContainer .section1 button.green.build');
if (btn.length !== 1) {
throw new GrabError('No upgrade button, try later');
}
btn.trigger('click');
}

View File

@ -9,10 +9,7 @@ function slotElements(prefix: string): Array<Slot> {
const result: Array<Slot> = [];
jQuery('.level.colorLayer').each((idx, el) => {
const buildId = getNumber(elClassId(jQuery(el).attr('class') || '', prefix));
result.push({
el,
buildId,
});
result.push({ el, buildId });
});
return result;
}
@ -35,7 +32,7 @@ function showSlotIds(prefix: string, buildingIds: number[]): void {
});
}
export function showFieldsSlotIds(buildingIds: number[]): void {
export function showResourceSlotIds(buildingIds: number[]): void {
showSlotIds('buildingSlot', buildingIds);
}