mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
22 lines
805 B
TypeScript
22 lines
805 B
TypeScript
import React from "react";
|
|
import { use } from "../ui/Context";
|
|
import { Exploit } from "./Exploit";
|
|
|
|
const getComputedStyle = window.getComputedStyle;
|
|
export function Unclickable(): React.ReactElement {
|
|
const player = use.Player();
|
|
|
|
function unclickable(event: React.MouseEvent<HTMLDivElement>): void {
|
|
if (!event.target || !(event.target instanceof Element)) return;
|
|
const display = getComputedStyle(event.target ).display;
|
|
const visibility = getComputedStyle(event.target ).visibility;
|
|
if (display === "none" && visibility === "hidden" && event.isTrusted) player.giveExploit(Exploit.Unclickable);
|
|
}
|
|
|
|
return (
|
|
<div id="unclickable" onClick={unclickable} style={{ display: "none", visibility: "hidden" }}>
|
|
Click on this to upgrade your Source-File -1!
|
|
</div>
|
|
);
|
|
}
|