ID:2100115
 
Applies to:Website
Status: Open

Issue hasn't been assigned a status value.

It would be nice to limit the height of the <"dm"> tag "window" and have a vertical scroll in it, so as to not limit the size of the content inside of it. Basically, to be able to post a lot of code but not unnecessarily increase the height of the post by thousands of pixels.

My recommendation would be an already built in limit of around 300-500px, which would provide space for 30-50 lines with no need for scrolling.

And be about 3 to 5 times the size of this post. Not that bad, right?
I like this suggestion.
I already added this myself as a userscript, I don't have it since I updated my stuff, but I can probably write another copy up when I get a spare few minutes. The box already handles horizontal scrolling so it's a very trivial styling change.
#Testing
Does this bug still happen?
#Test 2
Woah indents!
#Test 3

^
While you're at it
You might want to look into something like https://github.com/isagalaev/highlight.js with a custom language definition.

There are already some pre-made DM language definitions for various editors that could possibly be re-used.

I wrote https://github.com/Chnkr/sublime-DM a while back for sublime text.

And there is also https://github.com/PJB3005/atomic-dreams which highlights text for atom.

You might be able to re-use those grammar definitions.
Here's a userscript for what you need. You need to install either GreaseMonkey on Firefox, or TamperMonkey on Chrome (unsure what IE/Edge uses, don't care).

// ==UserScript==
// @name BYOND DM Code Height Setter
// @namespace BYOND
// @version 1
// @description Sets the height of <dm> code on the forums to not fill the forum post.
// @author Nadrew
// @match http://www.byond.com/forum/?post=*
// @grant none
// ==/UserScript==

(function() {
var code_blocks = document.getElementsByClassName("dmcode");
for(block_found in code_blocks) {
var code_div = code_blocks[block_found];
if(typeof code_div != "object") {
continue;
}
else {
if(code_div.clientHeight > 512) {
code_div.style.height = "512px";
}
}
}
})();
In response to Nadrew
I prefer Stylish for that sort of thing, myself.
Yeah, I was gonna use Stylish but I got the idea to do something about being able to drag/drop the box to resize it so I went with javascript but never actually did what I went javascript for lol.
just set the max-height and overflow css properties