Wraithan's changes

This commit is contained in:
danielyxie
2018-02-17 21:08:54 -06:00
parent ba6ed1f6b6
commit 24e99ed8d9
8 changed files with 36 additions and 368 deletions
+11 -3
View File
@@ -32,7 +32,7 @@ $(document).on('click', '.dialog-box-close-button', function( event ) {
var dialogBoxOpened = false;
function dialogBoxCreate(txt) {
function dialogBoxCreate(txt, preformatted=false) {
var container = document.createElement("div");
container.setAttribute("class", "dialog-box-container");
@@ -43,8 +43,16 @@ function dialogBoxCreate(txt) {
closeButton.setAttribute("class", "dialog-box-close-button");
closeButton.innerHTML = "×"
var textE = document.createElement("p");
textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, '<br>');
var textE;
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(textE);