From 4ad986bde853b6851b13d52bfeee23da672ce2e4 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 8 May 2017 09:28:34 -0400 Subject: [PATCH] @SpaiR's recommendation for log saving --- .../browserassets/js/browserOutput.js | 40 ++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/code/modules/goonchat/browserassets/js/browserOutput.js b/code/modules/goonchat/browserassets/js/browserOutput.js index a89a4039db6d..d8c8d5b8afe0 100644 --- a/code/modules/goonchat/browserassets/js/browserOutput.js +++ b/code/modules/goonchat/browserassets/js/browserOutput.js @@ -803,31 +803,25 @@ $(function() { }); $('#saveLog').click(function(e) { - var saved = ''; + $.ajax({ + type: 'GET', + url: 'browserOutput.css', + success: function(styleData) { + var win; - if (window.XMLHttpRequest) { - xmlHttp = new XMLHttpRequest(); - } else { - xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); - } - xmlHttp.open('GET', 'browserOutput.css', false); - xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xmlHttp.send(); - saved += ''; + try { + win = window.open('', 'Chat Log', 'toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, width=780, height=600, top=' + (screen.height/2 - 635/2) + ', left=' + (screen.width/2 - 780/2)); + } catch (e) { + return; + } - saved += $messages.html(); - saved = saved.replace(/&/g, '&'); - saved = saved.replace(/Chat Log'; + win.document.head.innerHTML += ''; + win.document.body.innerHTML = $messages.html(); + } + } + }); }); $('#highlightTerm').click(function(e) {