Extract some dom-manipulations
This commit is contained in:
9
src/Page/BuildingPage.ts
Normal file
9
src/Page/BuildingPage.ts
Normal 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');
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user