Added .fconf setting for enabline line wrap in terminal input. Began implementing wget

This commit is contained in:
danielyxie 2018-08-28 22:24:38 -05:00
parent da0f0b4551
commit 58d48f19ef
10 changed files with 63 additions and 45 deletions

@ -50,6 +50,12 @@
display: flex; display: flex;
} }
#terminal-input-td textarea {
overflow: hidden;
resize:none;
height:auto;
}
#terminal-input-header { #terminal-input-header {
white-space: pre; white-space: pre;
} }

@ -101,7 +101,7 @@ let NetscriptFunctions =
"getActionMaxLevel|getActionCurrentLevel|getActionAutolevel|" + "getActionMaxLevel|getActionCurrentLevel|getActionAutolevel|" +
"setActionAutolevel|setActionLevel|" + "setActionAutolevel|setActionLevel|" +
"getRank|getSkillPoints|getSkillLevel|getSkillUpgradeCost|" + "getRank|getSkillPoints|getSkillLevel|getSkillUpgradeCost|" +
"upgradeSkill|getTeamSize|" + "upgradeSkill|getTeamSize|getCity|" +
"setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" + "setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" +
"getCityChaos|switchCity|getStamina|joinBladeburnerFaction|getBonusTime"; "getCityChaos|switchCity|getStamina|joinBladeburnerFaction|getBonusTime";

5
package-lock.json generated

@ -608,6 +608,11 @@
"postcss-value-parser": "3.3.0" "postcss-value-parser": "3.3.0"
} }
}, },
"autosize": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/autosize/-/autosize-4.0.2.tgz",
"integrity": "sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA=="
},
"aws-sign2": { "aws-sign2": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",

@ -11,6 +11,7 @@
"ajv": "^5.1.5", "ajv": "^5.1.5",
"ajv-keywords": "^2.0.0", "ajv-keywords": "^2.0.0",
"async": "^2.6.1", "async": "^2.6.1",
"autosize": "^4.0.2",
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"brace": "^0.11.1", "brace": "^0.11.1",
"decimal.js": "7.2.3", "decimal.js": "7.2.3",

@ -493,32 +493,8 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access<br>", "World Stock Exchange account and TIX API Access<br>",
LatestUpdate: LatestUpdate:
"v0.40.2<br>" + "v0.40.3<br>" +
"------------------------------<br>" + ""
"* Bladeburner Changes:<br>" +
"*** Added getBonusTime(), getSkillUpgradeCost(), and getCity() Netscript functions to the API<br>" +
"*** Buffed the effects of many Bladeburner Augmentations<br>" +
"*** The Blade's Simulacrum Augmentation requires significantly less reputation but slightly more money<br>" +
"*** Slightly increased the amount of successes needed for a Contract/Operation in order to increase its max level<br>" +
"*** Increased the amount of money gained from Contracts by ~25%<br>" +
"*** Increased the base amount of rank gained from Operations by 10%<br>" +
"*** Significantly increased the 'randomness' in determining a Contract/Operation's initial count and rate of count increase<br>" +
"*** The number (count) of Operations should now increase significantly faster<br>" +
"*** There are now, on average, more Synthoid communities in a city<br>" +
"*** If automation is enabled (the feature in Bladeburner console), then switching to another action such as working for a company will now disable the automation<br>" +
"------------------------------<br>" +
"* Stock Market Changes:<br>" +
"***Added a watchlist filter feature to the UI that allows you to specify which stocks to show<br>" +
"***Added the Four Sigma (4S) Market Data feed, which provides volatility and price forecast information about stocks<br>" +
"***Added the 4S Market Data TIX API, which lets you access the aforementioned data through Netscript<br>" +
"------------------------------<br>" +
"* There is now a setting for enabling/disabling the popup that appears when you are hospitalized<br>" +
"* Bug Fix: Stock market should now be correctly initialized in BitNode-8 (by Kline-)<br>" +
"* Bug Fix: bladeburner.getCurrentAction() should now properly an 'Idle' object rather than null (by Kline-)<br>" +
"* Bug Fix: Bladeburner skill cost multiplier should now properly increase in BitNode-12 (by hydroflame)<br>" +
"* Bug Fix: 'document', 'hacknet', and 'window' keywords should no longer be counted multiple times in RAM calculations<br>" +
"* Bug Fix: Joining factions through Singularity functions should now prevent you from joining opposing factions<br>" +
"* Bug Fix: Four Sigma should no longer have two 'Speech Enhancement' Augmentations (by Kline-)<br>"
} }

@ -3,6 +3,7 @@ import {parse, Node} from "../utils/acorn";
var FconfSettings = { var FconfSettings = {
ENABLE_BASH_HOTKEYS: false, ENABLE_BASH_HOTKEYS: false,
ENABLE_TIMESTAMPS: false, ENABLE_TIMESTAMPS: false,
WRAP_INPUT: false,
} }
var FconfComments = { var FconfComments = {
@ -15,6 +16,11 @@ var FconfComments = {
"http://bitburner.readthedocs.io/en/latest/shortcuts.html", "http://bitburner.readthedocs.io/en/latest/shortcuts.html",
ENABLE_TIMESTAMPS: "Terminal commands and log entries will be timestamped. The timestamp\n" + ENABLE_TIMESTAMPS: "Terminal commands and log entries will be timestamped. The timestamp\n" +
"will have the format: M/D h:m", "will have the format: M/D h:m",
WRAP_INPUT: "Wrap Terminal Input. If this is enabled, then when a Terminal command is\n" +
"too long and overflows, then it will wrap to the next line instead of\n" +
"side-scrolling\n\n" +
"Note that after you enable/disable this, you'll have to run a command\n" +
"before its effect takes place.",
} }
//Parse Fconf settings from the config text //Parse Fconf settings from the config text
@ -74,6 +80,7 @@ function parseFconfSetting(setting, value) {
switch(setting) { switch(setting) {
case "ENABLE_BASH_HOTKEYS": case "ENABLE_BASH_HOTKEYS":
case "ENABLE_TIMESTAMPS": case "ENABLE_TIMESTAMPS":
case "WRAP_INPUT":
var value = value.toLowerCase(); var value = value.toLowerCase();
if (value === "1" || value === "true" || value === "y") { if (value === "1" || value === "true" || value === "y") {
value = true; value = true;

@ -48,6 +48,7 @@ import {yesNoBoxCreate,
import {post, hackProgressBarPost, import {post, hackProgressBarPost,
hackProgressPost} from "./ui/postToTerminal"; hackProgressPost} from "./ui/postToTerminal";
import autosize from 'autosize';
import * as JSZip from 'jszip'; import * as JSZip from 'jszip';
import * as FileSaver from 'file-saver'; import * as FileSaver from 'file-saver';
@ -64,7 +65,7 @@ $(document).keydown(function(event) {
if (event.keyCode === KEY.ENTER) { if (event.keyCode === KEY.ENTER) {
event.preventDefault(); //Prevent newline from being entered in Script Editor event.preventDefault(); //Prevent newline from being entered in Script Editor
var command = $('input[class=terminal-input]').val(); var command = terminalInput.value;
post( post(
"[" + "[" +
(FconfSettings.ENABLE_TIMESTAMPS ? getTimestamp() + " " : "") + (FconfSettings.ENABLE_TIMESTAMPS ? getTimestamp() + " " : "") +
@ -520,9 +521,18 @@ let Terminal = {
commandHistoryIndex: 0, commandHistoryIndex: 0,
resetTerminalInput: function() { resetTerminalInput: function() {
if (FconfSettings.WRAP_INPUT) {
document.getElementById("terminal-input-td").innerHTML =
"<div id='terminal-input-header'>[" + Player.getCurrentServer().hostname + " ~]" + "$ </div>" +
'<textarea type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
//Auto re-size the line element as it wraps
autosize(document.getElementById("terminal-input-text-box"));
} else {
document.getElementById("terminal-input-td").innerHTML = document.getElementById("terminal-input-td").innerHTML =
"<div id='terminal-input-header'>[" + Player.getCurrentServer().hostname + " ~]" + "$ </div>" + "<div id='terminal-input-header'>[" + Player.getCurrentServer().hostname + " ~]" + "$ </div>" +
'<input type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>'; '<input type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
}
var hdr = document.getElementById("terminal-input-header"); var hdr = document.getElementById("terminal-input-header");
hdr.style.display = "inline"; hdr.style.display = "inline";
}, },
@ -824,7 +834,6 @@ let Terminal = {
Player.analyze(); Player.analyze();
//Disable terminal //Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>'; document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true); $('input[class=terminal-input]').prop('disabled', true);
iTutorialNextStep(); iTutorialNextStep();
@ -848,7 +857,6 @@ let Terminal = {
Player.hack(); Player.hack();
//Disable terminal //Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>'; document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true); $('input[class=terminal-input]').prop('disabled', true);
iTutorialNextStep(); iTutorialNextStep();
@ -929,7 +937,6 @@ let Terminal = {
Player.analyze(); Player.analyze();
//Disable terminal //Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>'; document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true); $('input[class=terminal-input]').prop('disabled', true);
break; break;
@ -1090,7 +1097,6 @@ let Terminal = {
Player.hack(); Player.hack();
//Disable terminal //Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>'; document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true); $('input[class=terminal-input]').prop('disabled', true);
} }
@ -1576,6 +1582,23 @@ let Terminal = {
post("No such alias exists"); post("No such alias exists");
} }
} }
break;
case "wget":
if (commandArray.length !== 2) {
return post("Incorrect usage of wget command. Usage: wget [url] [target file]");
}
var args = commandArray[1].split(" ");
if (args.length !== 2) {
return post("Incorrect usage of wget command. Usage: wget [url] [target file]");
}
let url = args[0];
let target = args[1];
$.get(url, function(data) {
post(data);
}, 'text').fail(function(e) {
post("wget failed: " + JSON.stringify(e));
})
break; break;
default: default:
post("Command not found"); post("Command not found");