1
0
Fork 0

Part of speech & conditional examples

This commit is contained in:
Alex Kotov 2023-02-18 12:12:33 +04:00
parent 03c059eb39
commit 6734d131e5
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
5 changed files with 37 additions and 13 deletions

View File

@ -1,3 +1,4 @@
.invisible { display: none }
.morpheme-root { color: #dd0000; }
.api-frame {

View File

@ -1,13 +1,21 @@
$(function() {
$('#examples').each(function(index, elem) {
$('#word').each(function(index, elem) {
$.getJSON(
'http://ksenia.causa-arcana.com/api/words/' + $(elem).data('id'),
function(data) {
var list_items = []
var part_of_speech = data['part_of_speech']
var examples = []
data['examples'].forEach(function(item) {
list_items.push('<li>' + item[0] + ' &mdash; ' + item[1] + '</li>')
examples.push('<li>' + item[0] + ' &mdash; ' + item[1] + '</li>')
})
$(elem).html('<ul>' + list_items.join('') + '</ul>')
$('#part-of-speech').text(part_of_speech)
if (examples.length > 0) {
$('#examples-data').html('<ul>' + list_items.join('') + '</ul>')
$('#examples').removeClass('invisible')
}
},
)
})

View File

@ -6,8 +6,12 @@
<link rel="stylesheet" href="../bundle.css"/>
</head>
<body>
<div id="word" data-id="1"></div>
<h1>არის</h1>
<p id="part-of-speech"></p>
<p>быть</p>
<p>Используется с существительным в именительном падеже или с
@ -42,9 +46,10 @@
</tbody>
</table>
<h2>Примеры употребления</h2>
<div id="examples" data-id="1"></div>
<div id="examples" class="invisible">
<h2>Примеры употребления</h2>
<div id="examples-data"></div>
</div>
<script
src="https://code.jquery.com/jquery-3.6.3.min.js"

View File

@ -6,8 +6,12 @@
<link rel="stylesheet" href="../bundle.css"/>
</head>
<body>
<div id="word" data-id="2"></div>
<h1>აქვს</h1>
<p id="part-of-speech"></p>
<p>иметь (неодушевлённое)</p>
<p>Глагол спрягается по объектному строю: меняется лицо и число
@ -47,9 +51,10 @@
</tbody>
</table>
<h2>Примеры употребления</h2>
<div id="examples" data-id="2"></div>
<div id="examples" class="invisible">
<h2>Примеры употребления</h2>
<div id="examples-data"></div>
</div>
<script
src="https://code.jquery.com/jquery-3.6.3.min.js"

View File

@ -6,8 +6,12 @@
<link rel="stylesheet" href="../bundle.css"/>
</head>
<body>
<div id="word" data-id="3"></div>
<h1>ყავს</h1>
<p id="part-of-speech"></p>
<p>иметь (одушевлённое)</p>
<h2>Спряжение</h2>
@ -99,9 +103,10 @@
</tbody>
</table>
<h2>Примеры употребления</h2>
<div id="examples" data-id="3"></div>
<div id="examples" class="invisible">
<h2>Примеры употребления</h2>
<div id="examples-data"></div>
</div>
<script
src="https://code.jquery.com/jquery-3.6.3.min.js"