You’ll still need to scroll if the post is large, but it’s much better than it looks in the forum post, IMO.
Process
Bring up the DevTools, open the console.
Paste the following code into the console:
dump = function(post) {
var win = window.open("");
var style = win.document.createElement("style");
style.innerText = "body {background-color:#444;color:#ccc;}";
style.innerText += "#dump {font:normal 17px sans-serif;max-height:98vh;max-width:99vw;overflow:auto;scrollbar-color:#ace #444;scrollbar-width:thin;}}";
style.innerText += "#dump div {font:normal 17px sans serif;background-color:#555;margin:0 0 2em 2em;}";
style.innerText += "pre {font:normal 16px monospace;padding:10px 10px;white-space:pre;}";
win.document.body.appendChild(style);
var div = win.document.createElement("div");
div.id = "dump";
var codes = "";
var allcodes = document.querySelectorAll(post + " pre code");
for(var i = 0; i < allcodes.length; i++) {
codes += "Code block:<br><div><pre><code>" + allcodes[i].innerHTML + "</code></pre></div>";
}
div.innerHTML = codes;
win.document.body.appendChild(div);
}
dump("#post_1");
You will need to replace the id in dump("#post_1") with the id of the post you want to inspect.
Then hit return and a new window will popup with ALL the code blocks laid out for your viewing pleasure
And because @anon46315158 is a complete ass and pointed out I’d made a poor choice for <pre> whitespace handling, here’s the ALL NEW FIXED version dogfooding the code above:
I tried it. I copy&pasted your code above into TamperMonkey, then I got an error. Your code had a Global variable named dump, which TamplerMokey disliked.
That’s right. My code is not written for Tampermonkey. And the “problem” is not that Tampermonkey doesn’t like it, you’re using the “use strict” string (which you could but probably should not remove).
The idea, of course, is that @devalex88 will take the hint and give us a button on each code block that launches the code block in a separate window/tab without the need for console-pasting or even Tampermonkey.
I might give him an even BIGGER prize if he does that
Many people even don’t know CODE BLOCK formatting.
Posts with a long log pasted without CODE BLOCK formatting is annoying as well. If I want to these posts in the alternative style, I would write the UserScript as:
var allcodes = document.querySelectorAll(post + " p");