Tizenharmadik vizsga
This commit is contained in:
36
2020-21-1-02/Megoldás/script.js
Normal file
36
2020-21-1-02/Megoldás/script.js
Normal file
@ -0,0 +1,36 @@
|
||||
let dismissed = { 'á': 'a', 'é': 'e', 'í': 'i', 'ó': 'o', 'ö': 'o', 'ő': 'o', 'ú': 'u', 'ü': 'ű' }
|
||||
|
||||
function draw() {
|
||||
let text = document.getElementById("msg").value.toString()
|
||||
let out = document.getElementById("outdat");
|
||||
let keys = [];
|
||||
let lines = [];
|
||||
text = text.toLowerCase();
|
||||
text = formattext(text)
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
keys.push(text[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < 6; i++) {
|
||||
lines.push("");
|
||||
for (var j = 0; j < keys.length; j++) {
|
||||
lines[i] += font[text[j]][i];
|
||||
}
|
||||
}
|
||||
out.textContent = "";
|
||||
for (i in lines) {
|
||||
out.textContent += lines[i] + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
function formattext(text) {
|
||||
let text2 = "";
|
||||
for (i in text) {
|
||||
if (text[i] in dismissed) {
|
||||
text2 += dismissed[text[i]];
|
||||
} else {
|
||||
text2 += text[i]
|
||||
}
|
||||
}
|
||||
return text2;
|
||||
}
|
Reference in New Issue
Block a user