@SpaiR's recommendation for log saving

This commit is contained in:
Cyberboss
2017-05-08 09:28:34 -04:00
parent ffbdc49188
commit 4ad986bde8

View File

@@ -803,31 +803,25 @@ $(function() {
}); });
$('#saveLog').click(function(e) { $('#saveLog').click(function(e) {
var saved = ''; $.ajax({
type: 'GET',
if (window.XMLHttpRequest) { url: 'browserOutput.css',
xmlHttp = new XMLHttpRequest(); success: function(styleData) {
} else {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('GET', 'browserOutput.css', false);
xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlHttp.send();
saved += '<style>'+xmlHttp.responseText+'</style>';
saved += $messages.html();
saved = saved.replace(/&/g, '&amp;');
saved = saved.replace(/</g, '&lt;');
var win; var win;
try { try {
win = window.open('', 'Chat Log', 'toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, width=780, height=200, top='+(screen.height-400)+', left='+(screen.width-840)); 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) { } catch (e) {
return; return;
} }
if (win && win.document && window.document.body) {
win.document.body.innerHTML = saved; if (win) {
win.document.head.innerHTML = '<title>Chat Log</title>';
win.document.head.innerHTML += '<style>' + styleData + '</style>';
win.document.body.innerHTML = $messages.html();
} }
}
});
}); });
$('#highlightTerm').click(function(e) { $('#highlightTerm').click(function(e) {