mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-08 03:24:48 +01:00
fix few as any
This commit is contained in:
@ -1661,15 +1661,15 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
(_hostname: unknown = workerScript.hostname): IServerDef => {
|
||||
const hostname = ctx.helper.string("hostname", _hostname);
|
||||
const server = safeGetServer(hostname, ctx);
|
||||
const copy = Object.assign({}, server) as any;
|
||||
const copy = Object.assign({}, server) as Server;
|
||||
// These fields should be hidden.
|
||||
copy.contracts = undefined;
|
||||
copy.messages = undefined;
|
||||
copy.runningScripts = undefined;
|
||||
copy.scripts = undefined;
|
||||
copy.textFiles = undefined;
|
||||
copy.programs = undefined;
|
||||
copy.serversOnNetwork = undefined;
|
||||
copy.contracts = [];
|
||||
copy.messages = [];
|
||||
copy.runningScripts = [];
|
||||
copy.scripts = [];
|
||||
copy.textFiles = [];
|
||||
copy.programs = [];
|
||||
copy.serversOnNetwork = [];
|
||||
if (!copy.baseDifficulty) copy.baseDifficulty = 0;
|
||||
if (!copy.hackDifficulty) copy.hackDifficulty = 0;
|
||||
if (!copy.minDifficulty) copy.minDifficulty = 0;
|
||||
|
@ -402,7 +402,7 @@ function evaluateVersionCompatibility(ver: string | number): void {
|
||||
}
|
||||
}
|
||||
if (ver < 15) {
|
||||
(Settings as any).EditorTheme = { ...defaultMonacoTheme };
|
||||
Settings.EditorTheme = { ...defaultMonacoTheme };
|
||||
}
|
||||
//Fix contract names
|
||||
if (ver < 16) {
|
||||
@ -605,23 +605,17 @@ function createBetaUpdateText(): void {
|
||||
|
||||
function download(filename: string, content: string): void {
|
||||
const file = new Blob([content], { type: "text/plain" });
|
||||
const navigator = window.navigator as any;
|
||||
if (navigator.msSaveOrOpenBlob) {
|
||||
// IE10+
|
||||
navigator.msSaveOrOpenBlob(file, filename);
|
||||
} else {
|
||||
// Others
|
||||
const a = document.createElement("a"),
|
||||
url = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
const a = document.createElement("a"),
|
||||
url = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
Reviver.constructors.BitburnerSaveObject = BitburnerSaveObject;
|
||||
|
@ -67,23 +67,16 @@ export class Script {
|
||||
download(): void {
|
||||
const filename = this.filename;
|
||||
const file = new Blob([this.code], { type: "text/plain" });
|
||||
const navigator = window.navigator as any;
|
||||
if (navigator.msSaveOrOpenBlob) {
|
||||
// IE10+
|
||||
navigator.msSaveOrOpenBlob(file, filename);
|
||||
} else {
|
||||
// Others
|
||||
const a = document.createElement("a"),
|
||||
url = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
const a = document.createElement("a"),
|
||||
url = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,26 +47,17 @@ export class TextFile {
|
||||
* Serves the file to the user as a downloadable resource through the browser.
|
||||
*/
|
||||
download(): void {
|
||||
const filename: string = this.fn;
|
||||
const file: Blob = new Blob([this.text], { type: "text/plain" });
|
||||
/* tslint:disable-next-line:strict-boolean-expressions */
|
||||
const navigator = window.navigator as any;
|
||||
if (navigator.msSaveOrOpenBlob) {
|
||||
// IE10+
|
||||
navigator.msSaveOrOpenBlob(file, filename);
|
||||
} else {
|
||||
// Others
|
||||
const a: HTMLAnchorElement = document.createElement("a");
|
||||
const url: string = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = this.fn;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
const a: HTMLAnchorElement = document.createElement("a");
|
||||
const url: string = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = this.fn;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,13 +140,13 @@ export function StyleEditorModal(props: IProps): React.ReactElement {
|
||||
<FontFamilyField
|
||||
value={customStyle.fontFamily}
|
||||
refreshId={refreshId}
|
||||
onChange={(value, error) => update({ ...customStyle, fontFamily: value as any }, error)}
|
||||
onChange={(value, error) => update({ ...customStyle, fontFamily: value ?? "" }, error)}
|
||||
/>
|
||||
<br />
|
||||
<LineHeightField
|
||||
value={customStyle.lineHeight}
|
||||
refreshId={refreshId}
|
||||
onChange={(value, error) => update({ ...customStyle, lineHeight: value as any }, error)}
|
||||
onChange={(value, error) => update({ ...customStyle, lineHeight: Number(value) ?? 0 }, error)}
|
||||
/>
|
||||
<br />
|
||||
<ButtonGroup sx={{ my: 1 }}>
|
||||
|
Reference in New Issue
Block a user