Free javascript Hosting


listinger.js

Uploaded on Mar 06 2022 00:52 by admin

carga=()=>{
document.write('<h3>Copia desde una hoja de calculo y pega en el campo de abajo.</h3>')
document.write('<textarea cols="50" rows="10" id="entrada" type="text" name="entrada" style="resize:none;"></textarea>')
document.write('<br>')
document.write('<input id="enviado" type="submit" onclick="enviaValores()" value="enviar">')
}
window.onload = carga()

let enter = document.querySelector('#entrada')
let impresion = []

enviaValores=()=>{
if (entrada.value == '') {
alert('Rellene el campo vacio')
} else {
let codigos = enter.value
codigos = codigos.split('\n')

for(i=-1;i<=codigos.length;i++){
if(codigos[i] == ''){
codigos.splice(i,1)
}
}

for(i=-1;i<=codigos.length;i++){
if(codigos[i] == ''){
codigos.splice(i,1)
}
}

for (i = 0; i < codigos.length; i++) {
impresion.push("\n"+"'" + codigos[i] + "'")
}
let unselectable = 'style="user-select: none;-moz-user-select: none;-khtml-user-select: none;-webkit-user-select: none;-o-user-select: none;"'
let style = 'style="background-color: lightyellow;display: inline-block; /*resize:none;*/ width:500px; height:200px"'
document.write('<p ' + unselectable + '>presione "Ctrl+A" para seleccionar el resultado</p>')
document.write('<textarea ' + style + 'readonly>' + impresion + '</textarea>')
document.write('<br ' + unselectable + '>')
document.write('<br ' + unselectable + '>')
document.write('<button class="btn" onclick="window.location.reload(true)" ' + unselectable + '>Restaurar</button>')
}
}

load=()=>{
let foco = document.querySelector('#entrada')
foco.focus()
}
window.onload = load

enter.addEventListener("keydown", function (event) {
if (event.keyCode === 13) {
event.preventDefault()
enviaValores()
}
})

Back to list