[Minecraft] Convert to trick text

Converts to letter-look-alike text.

by MegaScience

HTML

<textarea id="input"></textarea>
<textarea id="output" readonly></textarea>

CSS

html {
  display: flex;
  height: 100%;
}

body {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
}

textarea {
  flex-grow: 1;
}

textarea#output:not(.matches) {
  box-shadow: 0px 0px 5px 0px #FF0000;
}

textarea#output.matches {
  box-shadow: 0px 0px 5px 0px #00FF00;
}

JavaScript

const debug = false

const ABC = 'eawmy'
const LAL = 'ɐəɯʍч'

const input = document.getElementById('input')
const output = document.getElementById('output')

input.addEventListener('input', main)

function textMap(c) {
	const i = ABC.indexOf(c)
	if (debug) console.log(c, i, i > -1)
	if (i > -1) return LAL[i]
	else return c
}

function main() {
	const iv = input.value
	const [...MESSAGE] = iv
	const ov = MESSAGE.map(textMap).join('')
	output.value = ov
	output.classList.toggle('matches', iv === ov)
}

/*const [...MESSAGE] = 'Your place is lovely, Savvvy! Thank you for having us over. You\'re lovely!'.toUpperCase()
const OUTPUT = MESSAGE.map(c => {
	const i = ABC.indexOf(c)
	console.log(c, i, c !== -1)
	if(i !== -1) return XIV[i]
	else return c
}).join('')
console.log(OUTPUT)
document.body.innerHTML = OUTPUT*/