From f4ddc50dd0387e7c13e8c76c744ad0cc3a04ba58 Mon Sep 17 00:00:00 2001 From: cynic Date: Sun, 6 Mar 2022 03:35:52 -0500 Subject: [PATCH] preserve sub-elements --- tolerance.user.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tolerance.user.js b/tolerance.user.js index a3ba2ae..4d430ce 100644 --- a/tolerance.user.js +++ b/tolerance.user.js @@ -1,9 +1,10 @@ + // ==UserScript== // @name tolerance auto-decoder // @namespace anon // @match *://withtolerance.horse/friendshipthroughtheages/* // @grant none -// @version 1.0 +// @version 1.1 // @author anon // @description 2/28/2022, 12:20:27 PM // ==/UserScript== @@ -20,6 +21,14 @@ console.log("decoding hex"); const answers = Array.from(document.querySelectorAll(".ama-answer-content, .ama-author-name")); answers.forEach(function(ans) { + let temp = ans.cloneNode(true); ans.innerText = ans.innerText.replaceAll(" ", "0A"); ans.innerText = hex2ascii8(ans.innerText); + Array.from(temp.children).forEach(function(sub) { + sub.innerText = sub.innerText.replaceAll(" ", "0A"); + sub.innerText = hex2ascii8(sub.innerText); + ans.innerHTML = ans.innerHTML.replace(sub.innerText, sub.outerHTML); + }); }); + +