Script editor now saves state when switching to other tabs. Updated to version 0.19.4

This commit is contained in:
Daniel Xie 2017-06-02 12:18:53 -05:00
parent b85783cebc
commit a3d45b3cc2
5 changed files with 6 additions and 18 deletions

@ -51,14 +51,6 @@
margin-right: 2px; 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 { #script-editor-wrapper {
height:100%; height:100%;
width: 70%; width: 70%;

@ -155,9 +155,7 @@
<textarea id="script-editor-text" tabindex="2" autofocus> </textarea> <textarea id="script-editor-text" tabindex="2" autofocus> </textarea>
<div id="script-editor-buttons-wrapper"> <div id="script-editor-buttons-wrapper">
<span id="script-editor-save-and-close-button" class="a-link-button">Save & Close (Ctrl + b)</span> <span id="script-editor-save-and-close-button" class="a-link-button">Save & Close (Ctrl + b)</span>
<span id="script-editor-netscript-doc-button" class="a-link-button"> Netscript Documentation <span id="script-editor-netscript-doc-button" class="a-link-button"> Netscript Documentation </span>
<p id="script-editor-netscript-doc-warning" style="font-size:12px"> Warning: You will lose unsaved content! </p>
</span>
</div> </div>
</div> </div>
<p> <br><br> </p> <p> <br><br> </p>

@ -1,5 +1,5 @@
CONSTANTS = { 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 //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 //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<br>" + "mem [script] - Check how much RAM a script requires to run<br>" +
"nano [script] - Create/Edit a script <br>" + "nano [script] - Create/Edit a script <br>" +
"ps - Displays all scripts that are actively running on the current server<br>" + "ps - Displays all scripts that are actively running on the current server<br>" +
"rm [script] - Delete a script<br>" +
"run [script] - Run a script <br>" + "run [script] - Run a script <br>" +
"tail [script] - Displays a script's logs<br>" + "tail [script] - Displays a script's logs<br>" +
"top - Displays all active scripts and their RAM usage <br><br>" + "top - Displays all active scripts and their RAM usage <br><br>" +

@ -61,8 +61,7 @@ function saveAndCloseScriptEditor() {
} }
if (filename == "") { if (filename == "") {
//If no filename...just close and do nothing dialogBoxCreate("You must specify a filename!");
Engine.loadTerminalContent();
return; return;
} }

@ -104,12 +104,10 @@ var Engine = {
loadScriptEditorContent: function(filename = "", code = "") { loadScriptEditorContent: function(filename = "", code = "") {
Engine.hideAllContent(); Engine.hideAllContent();
Engine.Display.scriptEditorContent.style.visibility = "visible"; Engine.Display.scriptEditorContent.style.visibility = "visible";
if (filename == "") { if (filename != "") {
document.getElementById("script-editor-filename").value = "untitled";
} else {
document.getElementById("script-editor-filename").value = 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(); document.getElementById("script-editor-text").focus();
Engine.currentPage = Engine.Page.ScriptEditor; Engine.currentPage = Engine.Page.ScriptEditor;