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)
+
+ - Click anywhere below the line
+ - Use the Select All shortcut (ctrl+A)
+ - Use the Copy shortcut (ctrl+C)
+ - Create a new text document (right click desktop or explorer -> new text document)
+ - Click the document and paste to it (ctrl+v)
+ - Save the document with the extension .html instead of .txt
+
+
+
+
diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js
index e9b5c3dff17..0632bad9688 100644
--- a/goon/browserassets/js/browserOutput.js
+++ b/goon/browserassets/js/browserOutput.js
@@ -871,40 +871,19 @@ $(function() {
setCookie('pingdisabled', (opts.pingDisabled ? 'true' : 'false'), 365);
});
- $('#saveLog').click(function(e) { //note that this will only work in browsers supporting CORS (IE 8+ and literally every alternative)
- var makeHaste = function(txt) { //creates a haste and returns the url
- if (window.XMLHttpRequest) {
- hasteRequest = new XMLHttpRequest();
- } else {
- hasteRequest = new ActiveXObject("Microsoft.XMLHTTP");
+ $('#saveLog').click(function(e) {
+ 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;
}
- hasteRequest.open('POST', 'http://localhost:7777/documents', true);
- hasteRequest.onerror = function () {
- internalOutput('Error in CORS request.');
- };
- hasteRequest.onreadystatechange = function() {
- if(hasteRequest.readyState == XMLHttpRequest.DONE) {
- if(hasteRequest.responseText != '') {
- var data = JSON.parse(hasteRequest.responseText);
- if(data.key) {
- var d = new Date();
- var timestamp = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate()+' '+
- d.getHours()+':'+d.getMinutes()+':'+d.getSeconds();
-
- internalOutput('Chat log generated. Please click the link below to view the raw data.');
- internalOutput('To save your log: Open it, right click anywhere on the page, then select Save As.
\
- For best results, save the file as [name].html then open it in any browser.');
- internalOutput('Chat Log: '+timestamp+'');
- } else {
- internalOutput('Error in CORS Response, no key provided Response: '+JSON.stringify(hasteRequest.responseText));
- }
- } else {
- internalOutput('Error in CORS Response, null sting recieved')
- }
- }
- };
- hasteRequest.send(txt);
- }
+ if (win && win.document && window.document.body) {
+ win.document.body.innerHTML = content;
+ return win;
+ }
+ };
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
@@ -914,30 +893,36 @@ $(function() {
// synchronous requests are depricated in modern browsers
xmlHttp.open('GET', 'browserOutput.css', true);
- xmlHttp.onload = function () {
- if (xmlHttp.status == 200) { // request successful
+ xmlHttp.onload = function (e) {
+ if (xmlHttp.status === 200) { // request successful
+
// Generate Log
var saved = '';
saved += $messages.html();
+ saved = saved.replace(/&/g, '&');
+ saved = saved.replace(/Chat Log' + saved
- makeHaste(finalText);
+ // Generate final output and open the window
+ var finalText = 'Chat Log \
+ '+
+ saved
+ openWindow(finalText);
} else { // request returned http error
- internalOutput('Style Doc Retrieve Error: '+xmlHttp.statusText);
+ openWindow('Style Doc Retrieve Error: '+xmlHttp.statusText);
}
}
- // Request error handler
- xmlHttp.onerror = function () {
- internalOutput('XMLHttpRequest Error: '+xmlHttp.statusText);
+ // timeout and request errors
+ xmlHttp.timeout = 300;
+ xmlHttp.ontimeout = function (e) {
+ openWindow('XMLHttpRequest Timeout');
+ }
+ xmlHttp.onerror = function (e) {
+ openWindow('XMLHttpRequest Error: '+xmlHttp.statusText);
}
// css needs special headers
xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
- xmlHttp.send(null);
+ xmlHttp.send(null);
});
$('#highlightTerm').click(function(e) {
diff --git a/goon/code/datums/browserOutput.dm b/goon/code/datums/browserOutput.dm
index a75e6840a82..32a2dcd8b88 100644
--- a/goon/code/datums/browserOutput.dm
+++ b/goon/code/datums/browserOutput.dm
@@ -12,6 +12,7 @@ var/list/chatResources = list(
"goon/browserassets/css/font-awesome.css",
"goon/browserassets/css/browserOutput.css",
"goon/browserassets/json/unicode_9_annotations.json",
+ "goon/browserassets/html/saveInstructions.html"
)
/var/savefile/iconCache = new /savefile("data/iconCache.sav")