Quellcode Diktat nach Diktat, kopieren, in windows editor kopieren, unter alle Dateien mit .html speichern,
dann sind Eingaben möglich!
<html><head><script>
let spr='de-DE';let sz='';let w='';let prmpt='';
function sleep(ms) {
prmpt=prompt('weiter');
return new Promise(resolve => setTimeout(resolve, ms));
}
async function dikt(){
let sek=document.getElementById('sek').value*1000;
let tx=document.getElementById('textarea').value;
let words = tx.split(' ');
for(let i=0;i<words.length;i++){w=w+words[i];sz=w.charAt(w.length-1);
if(sz==','|| sz=='.' ){w=w+' Pause';sprich(w);await sleep(sek);w='';};
}}
function download(text, name, type) {
let a = document.getElementById("a");
let file = new Blob([text], {type: type});
a.href = URL.createObjectURL(file);
a.download = name;
}
async function loadFile(file) {
let text = await file.text();
document.getElementById('textarea').textContent = text;
}
function sprich(p1) {
let satz=p1;
let hallo = new SpeechSynthesisUtterance(satz);
hallo.lang = spr;//'de-DE';
window.speechSynthesis.speak(hallo);
}
</script></head><body>
Diktat: Zuerst .txt Datei laden<br>
(falls Eingabetaste, vorher space)<br>
lies-Button, Pause=Satzzeichen , oder . <br>
<button onclick="let tx=document.getElementById('textarea').value;download(tx, 'myfilename.txt', 'text/plain')">Create file</button>
<a href="" id="a">click here to download your file</a><br>
lade txt-file nach Neustart<input type="file" onchange="loadFile(this.files[0])"><br>
<button onclick="tx=document.getElementById('textarea').value; sprich(tx);
">lies</button>
<button onclick="dikt();
">dikt</button>
<button onclick="spr='de-DE';">de-DE</button>
<button onclick="spr='en-EN';">en-EN</button>
Sekunden<input id="sek" type="number" min="1" max="10" value="4"><br>
<textarea id="textarea">Text eintippen oder laden, muss mit einem Punkt enden. </textarea><br>
</body></html>
code memo
<html><head><style>
body, textarea {font-size:20px;text-align: left;};
button, input {width:240px;height:30px;font-size:20px;text-align: left;};</style><script>
let text='', vtext='', pin=1, mod='v';//global
function vesl(){
let vtext='';
let lng=text.length;
for(i=0;i<lng;i++){
uc=text.charCodeAt(i);
px=pin.charAt(i%4)*1;
if(mod=='v'){
vc=uc+px;vtext=vtext+String.fromCharCode(vc);
};
if(mod=='e'){
vc=uc-px;vtext=vtext+String.fromCharCode(vc);
}}
ta.value=vtext;
}
function download(text, name, type) {
let a = document.getElementById("a");
let file = new Blob([text], {type: type});
a.href = URL.createObjectURL(file);
a.download = name;
}
async function loadFile(file) {
let text = await file.text();
document.getElementById('ta').textContent = text;
}
</script></head><body>
1. nacheinander button&link:<button onclick="let ta=document.getElementById('ta').value;download(ta, 'myfilename.txt', 'text/plain')">Create file</button>
<a href="" id="a">click here to download your file (in downloads)</a><br>
2. lade txt-file nach Neustart<input type="file" onchange="loadFile(this.files[0])"><br>
3.<button onclick="ta=getElementById('ta');text=ta.value;ip1=getElementById('ip1');pin=ip1.value;ip2=getElementById('ip2');mod=ip2.value;vesl();
">ver/entschlüsseln</button>
pin<input id="ip1" value="1234" type="number" min="1111" max="9999">
mod (v/e)<input type="text" id="ip2" value="v"><br>
<textarea id="ta" rows="20" cols="60"></textarea><br></body></html>