Files
bitburner-src/src/Exploits/unclickable.ts
T
2021-09-08 23:47:34 -04:00

23 lines
809 B
TypeScript

import { Player } from "../Player";
import { Exploit } from "./Exploit";
(function () {
function clickTheUnclickable(event: MouseEvent): void {
if (!event.target || !(event.target instanceof Element)) return;
const display = window.getComputedStyle(event.target as Element).display;
if (display === "none" && event.isTrusted) Player.giveExploit(Exploit.Unclickable);
}
function targetElement(): void {
const elem = document.getElementById("unclickable");
if (elem == null) {
console.error("Could not find the unclickable elem for the related exploit.");
return;
}
elem.addEventListener("click", clickTheUnclickable);
document.removeEventListener("DOMContentLoaded", targetElement);
}
document.addEventListener("DOMContentLoaded", targetElement);
})();