mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-24 18:22:58 +02:00
Change terminal cat to use <pre> tag for txt files which are often data
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@ function showMessage(msg) {
|
|||||||
var txt = "Message received from unknown sender: <br><br>" +
|
var txt = "Message received from unknown sender: <br><br>" +
|
||||||
"<i>" + msg.msg + "</i><br><br>" +
|
"<i>" + msg.msg + "</i><br><br>" +
|
||||||
"This message was saved as " + msg.filename + " onto your home computer.";
|
"This message was saved as " + msg.filename + " onto your home computer.";
|
||||||
dialogBoxCreate(txt);
|
dialogBoxCreate(txt, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Adds a message to a server
|
//Adds a message to a server
|
||||||
|
|||||||
+11
-3
@@ -32,7 +32,7 @@ $(document).on('click', '.dialog-box-close-button', function( event ) {
|
|||||||
|
|
||||||
var dialogBoxOpened = false;
|
var dialogBoxOpened = false;
|
||||||
|
|
||||||
function dialogBoxCreate(txt) {
|
function dialogBoxCreate(txt, preformatted) {
|
||||||
var container = document.createElement("div");
|
var container = document.createElement("div");
|
||||||
container.setAttribute("class", "dialog-box-container");
|
container.setAttribute("class", "dialog-box-container");
|
||||||
|
|
||||||
@@ -43,8 +43,16 @@ function dialogBoxCreate(txt) {
|
|||||||
closeButton.setAttribute("class", "dialog-box-close-button");
|
closeButton.setAttribute("class", "dialog-box-close-button");
|
||||||
closeButton.innerHTML = "×"
|
closeButton.innerHTML = "×"
|
||||||
|
|
||||||
var textE = document.createElement("p");
|
var textE;
|
||||||
textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
if (preformatted) {
|
||||||
|
// For text files as they are often computed data that
|
||||||
|
// shouldn't be wrapped and should retain tabstops.
|
||||||
|
textE = document.createElement("pre");
|
||||||
|
textE.innerHTML = txt;
|
||||||
|
} else {
|
||||||
|
textE = document.createElement("p");
|
||||||
|
textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
||||||
|
}
|
||||||
|
|
||||||
content.appendChild(closeButton);
|
content.appendChild(closeButton);
|
||||||
content.appendChild(textE);
|
content.appendChild(textE);
|
||||||
|
|||||||
Reference in New Issue
Block a user