From 5612eee562fa42a612b85e7a7264ebecef3e4840 Mon Sep 17 00:00:00 2001 From: IK3I Date: Thu, 11 Jan 2018 02:48:26 -0600 Subject: [PATCH] Fixes #8540 Also adds a seperate iframe explaining how to save the output since IE8 lacks support for doing things nicely. --- goon/browserassets/html/saveInstructions.html | 19 ++++++ goon/browserassets/js/browserOutput.js | 64 +++++++++++++------ goon/code/datums/browserOutput.dm | 3 +- 3 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 goon/browserassets/html/saveInstructions.html diff --git a/goon/browserassets/html/saveInstructions.html b/goon/browserassets/html/saveInstructions.html new file mode 100644 index 00000000000..90040b041a0 --- /dev/null +++ b/goon/browserassets/html/saveInstructions.html @@ -0,0 +1,19 @@ + + + +Save Instructions + + +

Save Instructions

+Due to the primitive nature of IE8, this file must be saved manually. To do so, simply follow these steps. (() indicates windows specific instuctions) +
    +
  1. Click anywhere below the line
  2. +
  3. Use the Select All shortcut (ctrl+A)
  4. +
  5. Use the Copy shortcut (ctrl+C)
  6. +
  7. Create a new text document (right click desktop or explorer -> new text document)
  8. +
  9. Click the document and paste to it (ctrl+v)
  10. +
  11. Save the document with the extension .html instead of .txt
  12. +
+
+ + diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index e823fcb1c06..0632bad9688 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -872,31 +872,57 @@ $(function() { }); $('#saveLog').click(function(e) { - var saved = ''; + var openWindow = function (content) { //opens a window + var win; + try { + win = window.open('', 'RAW Chat Log', 'toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, width=1200, height=800, top='+(screen.height-400)+', left='+(screen.width-840)); + } catch (e) { + return; + } + if (win && win.document && window.document.body) { + win.document.body.innerHTML = content; + return win; + } + }; - if (window.XMLHtpRequest) { + if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } - xmlHttp.open('GET', 'browserOutput.css', false); + + // synchronous requests are depricated in modern browsers + xmlHttp.open('GET', 'browserOutput.css', true); + xmlHttp.onload = function (e) { + if (xmlHttp.status === 200) { // request successful + + // Generate Log + var saved = ''; + saved += $messages.html(); + saved = saved.replace(/&/g, '&'); + saved = saved.replace(/'; - - saved += $messages.html(); - saved = saved.replace(/&/g, '&'); - saved = saved.replace(/