Also adds a seperate iframe explaining how to save the output since IE8
lacks support for doing things nicely.
This commit is contained in:
IK3I
2018-01-11 03:02:21 -06:00
parent 0102dc512d
commit 5612eee562
3 changed files with 66 additions and 20 deletions
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Save Instructions</title>
</head>
<body>
<h2>Save Instructions</h2>
Due to the primitive nature of IE8, this file must be saved manually. To do so, simply follow these steps. (() indicates windows specific instuctions)
<ol>
<li>Click anywhere below the line</li>
<li>Use the Select All shortcut (ctrl+A)</li>
<li>Use the Copy shortcut (ctrl+C)</li>
<li>Create a new text document (right click desktop or explorer -> new text document)</li>
<li>Click the document and paste to it (ctrl+v)</li>
<li>Save the document with the extension .html instead of .txt</li>
</ol>
<hr>
</body>
</html>
+45 -19
View File
@@ -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 = '<style>'+xmlHttp.responseText+'</style>';
saved += $messages.html();
saved = saved.replace(/&/g, '&amp;');
saved = saved.replace(/</g, '&lt;');
// Generate final output and open the window
var finalText = '<head><title>Chat Log</title></head> \
<iframe src="saveInstructions.html" id="instructions" style="border:none;" height="220" width="100%"></iframe>'+
saved
openWindow(finalText);
} else { // request returned http error
openWindow('Style Doc Retrieve 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();
saved += '<style>'+xmlHttp.responseText+'</style>';
saved += $messages.html();
saved = saved.replace(/&/g, '&amp;');
saved = saved.replace(/</g, '&lt;');
var win;
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));
} catch (e) {
return;
}
if (win && win.document && window.document.body) {
win.document.body.innerHTML = saved;
}
xmlHttp.send(null);
});
$('#highlightTerm').click(function(e) {
+2 -1
View File
@@ -11,7 +11,8 @@ var/list/chatResources = list(
"goon/browserassets/css/fonts/PxPlus_IBM_MDA.ttf",
"goon/browserassets/css/font-awesome.css",
"goon/browserassets/css/browserOutput.css",
"goon/browserassets/json/unicode_9_annotations.json"
"goon/browserassets/json/unicode_9_annotations.json",
"goon/browserassets/html/saveInstructions.html"
)
/var/savefile/iconCache = new /savefile("data/iconCache.sav")