Saving indicator

multichannel
HeNine 3 years ago
parent 7854d44437
commit 8be60d34b2

@ -44,7 +44,7 @@
<label for="new_transcription">New transcription</label><textarea id="new_transcription" rows="3" placeholder=""></textarea> <label for="new_transcription">New transcription</label><textarea id="new_transcription" rows="3" placeholder=""></textarea>
</div> </div>
<button id="submit_button" onclick="submit()" type="button">Submit</button> <button id="submit_button" onclick="submit()" type="button">Submit</button><span id="update_indicator"></span>
<script src="video.js/dist/video.min.js"></script> <script src="video.js/dist/video.min.js"></script>

@ -35,6 +35,9 @@ function fillLineInfo(line_json) {
} }
async function submit() { async function submit() {
document.getElementById("update_indicator").innerText = "⭯"
const new_transcription = document.getElementById("new_transcription").value; const new_transcription = document.getElementById("new_transcription").value;
const new_speakers = await Promise.all(document.getElementById("speaker_input").value const new_speakers = await Promise.all(document.getElementById("speaker_input").value
.trim() .trim()
@ -68,7 +71,13 @@ async function submit() {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({transcription: new_transcription, speakers: new_speakers}) body: JSON.stringify({transcription: new_transcription, speakers: new_speakers})
}) }).then(response => {
if (response.ok) {
document.getElementById("update_indicator").innerText = "\u2714\ufe0f"
} else {
document.getElementById("update_indicator").innerText = "\u2716\ufe0f"
}
})
} }
$(function () { $(function () {

@ -49,4 +49,11 @@ label {
button { button {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
}
#update_indicator {
width: 1.3em;
height: 1.3em;
margin-left: 1em;
vertical-align: middle;
} }
Loading…
Cancel
Save