preserve sub-elements

master
cynic 3 years ago committed by GitHub
parent 2e69fe8426
commit f4ddc50dd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      tolerance.user.js

@ -1,9 +1,10 @@
// ==UserScript== // ==UserScript==
// @name tolerance auto-decoder // @name tolerance auto-decoder
// @namespace anon // @namespace anon
// @match *://withtolerance.horse/friendshipthroughtheages/* // @match *://withtolerance.horse/friendshipthroughtheages/*
// @grant none // @grant none
// @version 1.0 // @version 1.1
// @author anon // @author anon
// @description 2/28/2022, 12:20:27 PM // @description 2/28/2022, 12:20:27 PM
// ==/UserScript== // ==/UserScript==
@ -20,6 +21,14 @@ console.log("decoding hex");
const answers = Array.from(document.querySelectorAll(".ama-answer-content, .ama-author-name")); const answers = Array.from(document.querySelectorAll(".ama-answer-content, .ama-author-name"));
answers.forEach(function(ans) { answers.forEach(function(ans) {
let temp = ans.cloneNode(true);
ans.innerText = ans.innerText.replaceAll(" ", "0A"); ans.innerText = ans.innerText.replaceAll(" ", "0A");
ans.innerText = hex2ascii8(ans.innerText); 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);
});
}); });

Loading…
Cancel
Save