minecraft armour stand command block generator

A command generator for mincraft command blocks, based on https://gaming.stackexchange.com/questions/364033/copying-pasting-multiple-commands-to-minecraft-terminal

by Tschallacka Blazetificate

HTML

If you prefer full screen editor, you can also visit the generator on my website:<BR/> <a href="https://www.tschallacka.de/minecraft/multiple-commands-generator">https://www.tschallacka.de/minecraft/multiple-commands-generator</a>
<p>Enter your minecraft commands. One command per line.<p>
<textarea id="input"></textarea>
<button id="generate">Get generated command blocks</button>
<textarea id="output"></textarea>

CSS

body {
  background: #eee;
}
textarea {
  width: 100%;
  height: 200px;
  background: #333;
  color: #eee;
}
button {
  width: 100%;
  height: 50px;
  font-size: 30px;
  line-height: 40px;
  font-weight: 800;
  background: #7b2b2b;
  color: #eee;
  text-shadow: 1px 1px 1px #333, -1px 1px 1px #333, 1px -1px 1px #333, -1px -1px 1px #333; 
  cursor: pointer
}

JavaScript

let child_armour = (child) => {
    return (child ? ',Passengers:[{'+
          						'id:"armor_stand",'+
                      'Health:0,'+
                      'Passengers:['+child+']'+
                      '}]':'');
};
let command_block = (command, child, falling) => {
   let escaped_command = command.replace('"','\\"');
   return '{' +
      (falling ? 'id:"falling_block",':'')+
    	'Time:1,'+
      'BlockState:{'+
  		   'Name:"command_block"'+ 
      '},'+
      'TileEntityData:{'+
    	  'auto:1,'+
        'Command:"'+escaped_command+'"'+
      '}'+
      child_armour(child)+
    '}';
}

let create_command = (commands) => {
    let base = 'summon falling_block ~ ~2 ~ ';
    commands.reverse();
    let lastIndex = commands.length - 1;
    let child = command_block('fill ~ ~-' + commands.length + ' ~ ~ ~ ~ air', null, true);
    commands.forEach((command, index) => {
    	child = command_block(command, child, index != lastIndex);
    });
    return base + child;
}
document.getElementById('generate').addEventListener('click', () => { 
    let input = document.getElementById('input').value.trim();
    if(input.length > 0) {
      let commands = input.split(/\r\n|\n|\r/)
      if(commands.length > 0) {
         document.getElementById('output').value = create_command(commands);
      }
    }
  });