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;
}
#terminal-input-td textarea {
overflow: hidden;
resize:none;
height:auto;
}
#terminal-input-header {
white-space: pre;
}

@ -17,9 +17,9 @@ v0.40.2 - 8/27/2018
* There are now, on average, more Synthoid communities in a city
* 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
* Stock Market Changes:
*Added a watchlist filter feature to the UI that allows you to specify which stocks to show
*Added the Four Sigma (4S) Market Data feed, which provides volatility and price forecast information about stocks
*Added the 4S Market Data TIX API, which lets you access the aforementioned data through Netscript
* Added a watchlist filter feature to the UI that allows you to specify which stocks to show
* Added the Four Sigma (4S) Market Data feed, which provides volatility and price forecast information about stocks
* Added the 4S Market Data TIX API, which lets you access the aforementioned data through Netscript
* There is now a setting for enabling/disabling the popup that appears when you are hospitalized
* Bug Fix: Stock market should now be correctly initialized in BitNode-8 (by Kline-)
* Bug Fix: bladeburner.getCurrentAction() should now properly an 'Idle' object rather than null (by Kline-)

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

5
package-lock.json generated

@ -608,6 +608,11 @@
"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": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",

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

@ -493,32 +493,8 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access<br>",
LatestUpdate:
"v0.40.2<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>"
"v0.40.3<br>" +
""
}

@ -1,8 +1,9 @@
import {parse, Node} from "../utils/acorn";
var FconfSettings = {
ENABLE_BASH_HOTKEYS: false,
ENABLE_TIMESTAMPS: false,
ENABLE_BASH_HOTKEYS: false,
ENABLE_TIMESTAMPS: false,
WRAP_INPUT: false,
}
var FconfComments = {
@ -15,6 +16,11 @@ var FconfComments = {
"http://bitburner.readthedocs.io/en/latest/shortcuts.html",
ENABLE_TIMESTAMPS: "Terminal commands and log entries will be timestamped. The timestamp\n" +
"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
@ -74,6 +80,7 @@ function parseFconfSetting(setting, value) {
switch(setting) {
case "ENABLE_BASH_HOTKEYS":
case "ENABLE_TIMESTAMPS":
case "WRAP_INPUT":
var value = value.toLowerCase();
if (value === "1" || value === "true" || value === "y") {
value = true;

@ -48,6 +48,7 @@ import {yesNoBoxCreate,
import {post, hackProgressBarPost,
hackProgressPost} from "./ui/postToTerminal";
import autosize from 'autosize';
import * as JSZip from 'jszip';
import * as FileSaver from 'file-saver';
@ -64,8 +65,8 @@ $(document).keydown(function(event) {
if (event.keyCode === KEY.ENTER) {
event.preventDefault(); //Prevent newline from being entered in Script Editor
var command = $('input[class=terminal-input]').val();
post(
var command = terminalInput.value;
post(
"[" +
(FconfSettings.ENABLE_TIMESTAMPS ? getTimestamp() + " " : "") +
Player.getCurrentServer().hostname +
@ -520,9 +521,18 @@ let Terminal = {
commandHistoryIndex: 0,
resetTerminalInput: function() {
document.getElementById("terminal-input-td").innerHTML =
"<div id='terminal-input-header'>[" + Player.getCurrentServer().hostname + " ~]" + "$ </div>" +
'<input type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
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 =
"<div id='terminal-input-header'>[" + Player.getCurrentServer().hostname + " ~]" + "$ </div>" +
'<input type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
}
var hdr = document.getElementById("terminal-input-header");
hdr.style.display = "inline";
},
@ -824,7 +834,6 @@ let Terminal = {
Player.analyze();
//Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true);
iTutorialNextStep();
@ -848,7 +857,6 @@ let Terminal = {
Player.hack();
//Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true);
iTutorialNextStep();
@ -929,7 +937,6 @@ let Terminal = {
Player.analyze();
//Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true);
break;
@ -1090,7 +1097,6 @@ let Terminal = {
Player.hack();
//Disable terminal
//Terminal.resetTerminalInput();
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true);
}
@ -1576,6 +1582,23 @@ let Terminal = {
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;
default:
post("Command not found");
@ -1809,7 +1832,7 @@ let Terminal = {
* @returns {void}
*/
/**
* @type {Object.<string, ProgramHandler}
* @type {Object.<string, ProgramHandler}
*/
const programHandlers = {};
programHandlers[Programs.NukeProgram.name] = (server) => {

@ -548,11 +548,11 @@ let Engine = {
displayCharacterOverviewInfo: function() {
Engine.overview.update();
const save = document.getElementById("character-overview-save-button");
const flashClass = "flashing-button";
if(!Settings.AutosaveInterval) {
if(!Settings.AutosaveInterval) {
save.classList.add(flashClass);
} else {
save.classList.remove(flashClass);

@ -1,4 +1,4 @@
import { getElementById } from "../../utils/uiHelpers/getElementById";
import { getElementById } from "../../utils/uiHelpers/getElementById";
/**
* Adds some output to the terminal.