Widget:Deklinationsklasse ermitteln: Unterschied zwischen den Versionen

Aus KGS-Wiki
Keine Bearbeitungszusammenfassung
Markierung: Manuelle Zurücksetzung
Keine Bearbeitungszusammenfassung
Zeile 4: Zeile 4:
<label for="input-gen">Genitiv:</label><input type="text" id="input-gen" oninput="detectDecl()"/></p>
<label for="input-gen">Genitiv:</label><input type="text" id="input-gen" oninput="detectDecl()"/></p>
<script>
<script>
function edge(id) {
return document.querySelector('.edgePath[id*=' + id '] > path')
}
function node(id) {
return document.querySelector('.node[id*=-' + id + '-] > rect')
}


function detectDecl() {
function detectDecl() {


let nom = document.getElementById('input-nom').value
let nom = document.getElementById('input-nom').value
let gen = document.getElementById('input-gen').value
let gen = document.getElementById('input-gen').value
node('genis').style = null
node('geni').style = null
node('a').style = null
node('e').style = null
node('i').style = null
node('o').style = null
node('u').style = null
node('k').style = null
if (nom == '' || gen ==  '') {
if (nom == '' || gen ==  '') {
document.getElementById('L-gen-genis').children[0].style = "stroke: black; fill: none;"
edge('L-gen-genis').style = "stroke: black; fill: none;"
document.getElementById('L-genis-i').children[0].style = "stroke: black; fill: none;"
edge('L-genis-i').style = "stroke: black; fill: none;"
document.getElementById('L-genis-k').children[0].style = "stroke: black; fill: none;"
edge('L-genis-k').style = "stroke: black; fill: none;"
document.getElementById('L-gen-geni').children[0].style = "stroke: black; fill: none;"
edge('L-gen-geni').style = "stroke: black; fill: none;"
document.getElementById('L-geni-e').children[0].style = "stroke: black; fill: none;"
edge('L-geni-e').style = "stroke: black; fill: none;"
document.getElementById('L-geni-o').children[0].style = "stroke: black; fill: none;"
edge('L-geni-o').style = "stroke: black; fill: none;"
document.getElementById('L-gen-a').children[0].style = "stroke: black; fill: none;"
edge('L-gen-a').style = "stroke: black; fill: none;"
document.getElementById('L-gen-u').children[0].style = "stroke: black; fill: none;"
edge('L-gen-u').style = "stroke: black; fill: none;"
document.getElementById('L-gen-i').children[0].style = "stroke: black; fill: none;"
edge('L-gen-i').style = "stroke: black; fill: none;"
document.getElementById('L-gen-o').children[0].style = "stroke: black; fill: none;"
edge('L-gen-o').style = "stroke: black; fill: none;"
document.getElementById('L-gen-k').children[0].style = "stroke: black; fill: none;"
edge('L-gen-k').style = "stroke: black; fill: none;"
return
return
} else {
} else {
document.getElementById('L-gen-genis').children[0].style = "stroke: lightgray; fill: none;"
edge('L-gen-genis').style = "stroke: lightgray; fill: none;"
document.getElementById('L-genis-i').children[0].style = "stroke: lightgray; fill: none;"
edge('L-genis-i').style = "stroke: lightgray; fill: none;"
document.getElementById('L-genis-k').children[0].style = "stroke: lightgray; fill: none;"
edge('L-genis-k').style = "stroke: lightgray; fill: none;"
document.getElementById('L-gen-geni').children[0].style = "stroke: lightgray; fill: none;"
edge('L-gen-geni').style = "stroke: lightgray; fill: none;"
document.getElementById('L-geni-e').children[0].style = "stroke: lightgray; fill: none;"
edge('L-geni-e').style = "stroke: lightgray; fill: none;"
document.getElementById('L-geni-o').children[0].style = "stroke: lightgray; fill: none;"
edge('L-geni-o').style = "stroke: lightgray; fill: none;"
document.getElementById('L-gen-a').children[0].style = "stroke: lightgray; fill: none;"
edge('L-gen-a').style = "stroke: lightgray; fill: none;"
document.getElementById('L-gen-u').children[0].style = "stroke: lightgray; fill: none;"
edge('L-gen-u').style = "stroke: lightgray; fill: none;"
document.getElementById('L-gen-i').children[0].style = "stroke: lightgray; fill: none;"
edge('L-gen-i').style = "stroke: lightgray; fill: none;"
document.getElementById('L-gen-o').children[0].style = "stroke: lightgray; fill: none;"
edge('L-gen-o').style = "stroke: lightgray; fill: none;"
document.getElementById('L-gen-k').children[0].style = "stroke: lightgray; fill: none;"
edge('L-gen-k').style = "stroke: lightgray; fill: none;"
}
}
if (gen.endsWith('is')) {
if (gen.endsWith('is')) {
document.getElementById('L-gen-genis').children[0].style = "stroke: red; fill: none;"
edge('L-gen-genis').style = "stroke: red; fill: none;"
node('genis').style = "fill: red;"
if (nom == gen || nom.endsWith('ar') || nom.endsWith('e') || nom.endsWith('al')) {
if (nom == gen || nom.endsWith('ar') || nom.endsWith('e') || nom.endsWith('al')) {
document.getElementById('L-genis-i').children[0].style = "stroke: red; fill: none;"
node('i').style = "fill: red;"
edge('L-genis-i').style = "stroke: red; fill: none;"
} else {
} else {
document.getElementById('L-genis-k').children[0].style = "stroke: red; fill: none;"
node('k').style = "fill: red;"
edge('L-genis-k').style = "stroke: red; fill: none;"
}
}
return
return
}
}
if (gen.endsWith('i')) {
if (gen.endsWith('i')) {
document.getElementById('L-gen-geni').children[0].style = "stroke: red; fill: none;"
node('geni').style = "fill: red;"
edge('L-gen-geni').style = "stroke: red; fill: none;"
if (nom.endsWith('es')) {
if (nom.endsWith('es')) {
document.getElementById('L-geni-e').children[0].style = "stroke: red; fill: none;"
node('e').style = "fill: red;"
edge('L-geni-e').style = "stroke: red; fill: none;"
} else {
} else {
document.getElementById('L-geni-o').children[0].style = "stroke: red; fill: none;"
node('o').style = "fill: red;"
edge('L-geni-o').style = "stroke: red; fill: none;"
}
}
return
return
}
}
if (gen.endsWith('ae') || gen.endsWith('arum')) {
if (gen.endsWith('ae') || gen.endsWith('arum')) {
document.getElementById('L-gen-a').children[0].style = "stroke: red; fill: none;"
node('a').style = "fill: red;"
edge('L-gen-a').style = "stroke: red; fill: none;"
return
return
}
}
if (gen.endsWith('us') || gen.endsWith('ūs') || gen.endsWith('uum')) {
if (gen.endsWith('us') || gen.endsWith('ūs') || gen.endsWith('uum')) {
document.getElementById('L-gen-u').children[0].style = "stroke: red; fill: none;"
node('u').style = "fill: red;"
edge('L-gen-u').style = "stroke: red; fill: none;"
return
return
}
}
if (gen.endsWith('ium')) {
if (gen.endsWith('ium')) {
document.getElementById('L-gen-i').children[0].style = "stroke: red; fill: none;"
node('i').style = "fill: red;"
edge('L-gen-i').style = "stroke: red; fill: none;"
return
return
}
}
if (gen.endsWith('orum')) {
if (gen.endsWith('orum')) {
document.getElementById('L-gen-o').children[0].style = "stroke: red; fill: none;"
node('o').style = "fill: red;"
edge('L-gen-o').style = "stroke: red; fill: none;"
return
return
}
}
if (gen.endsWith('um')) {
if (gen.endsWith('um')) {
document.getElementById('L-gen-k').children[0].style = "stroke: red; fill: none;"
node('k').style = "fill: red;"
edge('L-gen-k').style = "stroke: red; fill: none;"
return
return
}
}
}
}
</script>
</script>

Version vom 4. Juli 2024, 18:27 Uhr

Probier es selbst aus! Gib hier den Nominativ und Genitiv eines Substantivs ein und ermittle die Deklinationsklasse!

<label for="input-nom">Nominativ:</label><input type="text" id="input-nom" oninput="detectDecl()"/> <label for="input-gen">Genitiv:</label><input type="text" id="input-gen" oninput="detectDecl()"/>

<script>

function edge(id) { return document.querySelector('.edgePath[id*=' + id '] > path') }

function node(id) { return document.querySelector('.node[id*=-' + id + '-] > rect') }

function detectDecl() {

let nom = document.getElementById('input-nom').value let gen = document.getElementById('input-gen').value node('genis').style = null node('geni').style = null node('a').style = null node('e').style = null node('i').style = null node('o').style = null node('u').style = null node('k').style = null if (nom == || gen == ) { edge('L-gen-genis').style = "stroke: black; fill: none;" edge('L-genis-i').style = "stroke: black; fill: none;" edge('L-genis-k').style = "stroke: black; fill: none;" edge('L-gen-geni').style = "stroke: black; fill: none;" edge('L-geni-e').style = "stroke: black; fill: none;" edge('L-geni-o').style = "stroke: black; fill: none;" edge('L-gen-a').style = "stroke: black; fill: none;" edge('L-gen-u').style = "stroke: black; fill: none;" edge('L-gen-i').style = "stroke: black; fill: none;" edge('L-gen-o').style = "stroke: black; fill: none;" edge('L-gen-k').style = "stroke: black; fill: none;" return } else { edge('L-gen-genis').style = "stroke: lightgray; fill: none;" edge('L-genis-i').style = "stroke: lightgray; fill: none;" edge('L-genis-k').style = "stroke: lightgray; fill: none;" edge('L-gen-geni').style = "stroke: lightgray; fill: none;" edge('L-geni-e').style = "stroke: lightgray; fill: none;" edge('L-geni-o').style = "stroke: lightgray; fill: none;" edge('L-gen-a').style = "stroke: lightgray; fill: none;" edge('L-gen-u').style = "stroke: lightgray; fill: none;" edge('L-gen-i').style = "stroke: lightgray; fill: none;" edge('L-gen-o').style = "stroke: lightgray; fill: none;" edge('L-gen-k').style = "stroke: lightgray; fill: none;" } if (gen.endsWith('is')) { edge('L-gen-genis').style = "stroke: red; fill: none;" node('genis').style = "fill: red;" if (nom == gen || nom.endsWith('ar') || nom.endsWith('e') || nom.endsWith('al')) { node('i').style = "fill: red;" edge('L-genis-i').style = "stroke: red; fill: none;" } else { node('k').style = "fill: red;" edge('L-genis-k').style = "stroke: red; fill: none;" } return } if (gen.endsWith('i')) { node('geni').style = "fill: red;" edge('L-gen-geni').style = "stroke: red; fill: none;" if (nom.endsWith('es')) { node('e').style = "fill: red;" edge('L-geni-e').style = "stroke: red; fill: none;" } else { node('o').style = "fill: red;" edge('L-geni-o').style = "stroke: red; fill: none;" } return } if (gen.endsWith('ae') || gen.endsWith('arum')) { node('a').style = "fill: red;" edge('L-gen-a').style = "stroke: red; fill: none;" return } if (gen.endsWith('us') || gen.endsWith('ūs') || gen.endsWith('uum')) { node('u').style = "fill: red;" edge('L-gen-u').style = "stroke: red; fill: none;" return } if (gen.endsWith('ium')) { node('i').style = "fill: red;" edge('L-gen-i').style = "stroke: red; fill: none;" return } if (gen.endsWith('orum')) { node('o').style = "fill: red;" edge('L-gen-o').style = "stroke: red; fill: none;" return } if (gen.endsWith('um')) { node('k').style = "fill: red;" edge('L-gen-k').style = "stroke: red; fill: none;" return } } </script>