[FFXIV] Convert to block text
Converts to XIV-compatible block-text.
by MegaScience
HTML
<textarea id="input"></textarea>
<textarea id="output"></textarea>
CSS
html {
display: flex;
height: 100%;
}
body {
display: flex;
flex-grow: 1;
flex-direction: column;
}
textarea {
flex-grow: 1;
}
JavaScript
const XIV = ''
const ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
const input = document.getElementById('input')
const output = document.getElementById('output')
input.addEventListener('input', main)
function textMap(c) {
const i = ABC.indexOf(c)
console.log(c, i, c !== -1)
if(i > -1) return XIV[i]
else return c
}
function main() {
const [...MESSAGE] = input.value.toUpperCase()
output.value = MESSAGE.map(textMap).join('')
}
/*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*/