• The site has now migrated to Xenforo 2. If you see any issues with the forum operation, please post them in the feedback thread.
  • Due to issues with external spam filters, QQ is currently unable to send any mail to Microsoft E-mail addresses. This includes any account at live.com, hotmail.com or msn.com. Signing up to the forum with one of these addresses will result in your verification E-mail never arriving. For best results, please use a different E-mail provider for your QQ address.
  • For prospective new members, a word of warning: don't use common names like Dennis, Simon, or Kenny if you decide to create an account. Spammers have used them all before you and gotten those names flagged in the anti-spam databases. Your account registration will be rejected because of it.
  • Since it has happened MULTIPLE times now, I want to be very clear about this. You do not get to abandon an account and create a new one. You do not get to pass an account to someone else and create a new one. If you do so anyway, you will be banned for creating sockpuppets.
  • Due to the actions of particularly persistent spammers and trolls, we will be banning disposable email addresses from today onward.
  • The rules regarding NSFW links have been updated. See here for details.

Encoding thread fix

zmikez

Not too sore, are you?
Joined
Nov 24, 2021
Messages
257
Likes received
1,849
Hey guys, not sure exactly where to place this and figured general was a safe place.

I've noticed that a large number of the threads I've read that have been moved over from the previous forums are having formatting issues. Obviously, this isn't going to be fixed quickly since there are so many threads that are having issues and for some it's literally dozens of posts.

This fix requires a javascript addon, I personally use opera gx's "scripter" extension and firefox's javascript extension (by chee), pretty sure there's a similar addon for each browser so this should be usable by most everyone with no editing needed. All you really need to do is install an addon that executes javascript automatically on page load, like the two previously mention, then copy and paste the code below into it.


If anyone knows a better way to do this, please chime in, I'm a back-end dev so I only mess with js in an as needed basis. I haven't been able to figure out how to get rid of the italics issue without also removing the rest of the italics formatting so that's still up in the air.



Hopefully this helps someone out.



javascript to fix the encoding and font size
//This will load the pages content into the pageContent variable
var pageContent = document.body.innerHTML;

//This should fix any encoding issues with the % characters, as well as fixing some of the size issues I've noticed cropping up.
var updatedPageContent = pageContent
.replace(/%20/g, " ")
.replace(/%21/g, "!")
.replace(/%22/g, '"')
.replace(/%23/g, "#")
.replace(/%24/g, "$")
.replace(/%25/g, "%")
.replace(/%26/g, "&")
.replace(/%27/g, "'")
.replace(/%28/g, "(")
.replace(/%29/g, ")")
.replace(/%2A/g, "*")
.replace(/%2B/g, "+")
.replace(/%2C/g, ",")
.replace(/%2D/g, "-")
.replace(/%2E/g, ".")
.replace(/%2F/g, "/")
.replace(/%3A/g, ":")
.replace(/%3B/g, ";")
.replace(/%3C/g, "<")
.replace(/%3D/g, "=")
.replace(/%3E/g, ">")
.replace(/%3F/g, "?")
.replace(/%40/g, "@")
.replace(/%5B/g, "[")
.replace(/%5C/g, "\\")
.replace(/%5D/g, "]")
.replace(/%5E/g, "^")
.replace(/%5F/g, "_")
.replace(/%60/g, "`")
.replace(/%7B/g, "{")
.replace(/%7C/g, "|")
.replace(/%7D/g, "}")
.replace(/%7E/g, "~")
.replace(/font-size:\s*[\d.]+rem/g, "font-size: 1rem");

// This will update the page automatically
document.body.innerHTML = updatedPageContent;

Example on firefox, apparently the image linking isn't working so imgur it is
 
Last edited:

Users who are viewing this thread

Back
Top