Fully revert browserOutput.js

This commit is contained in:
mochi
2020-08-07 12:39:58 +02:00
parent 038bb7a3a6
commit cc04a0fb77
+12 -13
View File
@@ -72,7 +72,7 @@ var opts = {
'enableEmoji': true
};
var regexHasError = false; //variable to check if regex has excepted
var regexHasError = false; //variable to check if regex has excepted
function outerHTML(el) {
var wrap = document.createElement('div');
@@ -97,10 +97,10 @@ if (typeof String.prototype.trim !== 'function') {
if (!String.prototype.includes) {
String.prototype.includes = function(search, start) {
'use strict';
if (search instanceof RegExp) {
throw TypeError('first argument must not be a RegExp');
}
}
if (start === undefined) { start = 0; }
return this.indexOf(search, start) !== -1;
};
@@ -124,7 +124,7 @@ function byondDecode(message) {
// The replace for + is because FOR SOME REASON, BYOND replaces spaces with a + instead of %20, and a plus with %2b.
// Marvelous.
message = message.replace(/\+/g, "%20");
try {
try {
// This is a workaround for the above not always working when BYOND's shitty url encoding breaks.
// Basically, sometimes BYOND's double encoding trick just arbitrarily produces something that makes decodeURIComponent
// throw an "Invalid Encoding URI" URIError... the simplest way to work around this is to just ignore it and use unescape instead
@@ -217,13 +217,12 @@ function highlightTerms(el) {
ind = next_tag;
}
}
element.innerHTML = s;
}
for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term
if(opts.highlightTerms[i]) {
var term = opts.highlightTerms[i];
if(!opts.highlightRegexEnable){
var innerTerms = opts.highlightTerms[i].split(" ")
for(var a in innerTerms){
@@ -653,7 +652,7 @@ $(function() {
'shideSpam': getCookie('hidespam'),
'darkChat': getCookie('darkChat'),
};
if (savedConfig.sfontSize) {
$messages.css('font-size', savedConfig.sfontSize);
internalOutput('<span class="internal boldnshit">Loaded font size setting of: '+savedConfig.sfontSize+'</span>', 'internal');
@@ -1011,18 +1010,18 @@ $(function() {
} else {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
// synchronous requests are depricated in modern browsers
xmlHttp.open('GET', 'browserOutput.css', true);
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>'+
@@ -1032,7 +1031,7 @@ $(function() {
openWindow('Style Doc Retrieve Error: '+xmlHttp.statusText);
}
}
// timeout and request errors
xmlHttp.timeout = 300;
xmlHttp.ontimeout = function (e) {