From a3d45b3cc227fb8c3319432ee219af1dd8ed13dd Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Fri, 2 Jun 2017 12:18:53 -0500 Subject: [PATCH] Script editor now saves state when switching to other tabs. Updated to version 0.19.4 --- css/menupages.css | 8 -------- index.html | 4 +--- src/Constants.js | 3 ++- src/Script.js | 3 +-- src/engine.js | 6 ++---- 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/css/menupages.css b/css/menupages.css index 998a65876..1318bff0b 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -51,14 +51,6 @@ margin-right: 2px; } -#script-editor-netscript-doc-warning { - background-color: #555; - color: #FFFFFF; -} -#script-editor-netscript-doc-warning:hover { - background-color: #666; -} - #script-editor-wrapper { height:100%; width: 70%; diff --git a/index.html b/index.html index 3582addb8..00294ca47 100644 --- a/index.html +++ b/index.html @@ -155,9 +155,7 @@
Save & Close (Ctrl + b) - Netscript Documentation -

Warning: You will lose unsaved content!

-
+ Netscript Documentation



diff --git a/src/Constants.js b/src/Constants.js index a7984dfe3..66fba7fbb 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -1,5 +1,5 @@ CONSTANTS = { - Version: "0.19.3", + Version: "0.19.4", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -248,6 +248,7 @@ CONSTANTS = { "mem [script] - Check how much RAM a script requires to run
" + "nano [script] - Create/Edit a script
" + "ps - Displays all scripts that are actively running on the current server
" + + "rm [script] - Delete a script
" + "run [script] - Run a script
" + "tail [script] - Displays a script's logs
" + "top - Displays all active scripts and their RAM usage

" + diff --git a/src/Script.js b/src/Script.js index 26ae7fb12..20bbd6bbd 100644 --- a/src/Script.js +++ b/src/Script.js @@ -61,8 +61,7 @@ function saveAndCloseScriptEditor() { } if (filename == "") { - //If no filename...just close and do nothing - Engine.loadTerminalContent(); + dialogBoxCreate("You must specify a filename!"); return; } diff --git a/src/engine.js b/src/engine.js index e011efdaa..ed41ddff2 100644 --- a/src/engine.js +++ b/src/engine.js @@ -104,12 +104,10 @@ var Engine = { loadScriptEditorContent: function(filename = "", code = "") { Engine.hideAllContent(); Engine.Display.scriptEditorContent.style.visibility = "visible"; - if (filename == "") { - document.getElementById("script-editor-filename").value = "untitled"; - } else { + if (filename != "") { document.getElementById("script-editor-filename").value = filename; + document.getElementById("script-editor-text").value = code; } - document.getElementById("script-editor-text").value = code; document.getElementById("script-editor-text").focus(); Engine.currentPage = Engine.Page.ScriptEditor;