Files
BPLabs/templates/mat_test_clinician_view.html
T

52 lines
1.8 KiB
HTML

{% extends 'index.html' %}
{% block content %}
<div>
<div style="height: 75%;">
<img id="mat_plot" class="center" src="/static/default_adaptive_plot.png"/>
</div>
<div class="d-flex justify-content-center mt-2" role="group">
<button type="button" id="mat-repeat" class="btn btn-primary mx-3">Repeat audio</button>
<button type="button" id="mat-save" class="btn btn-primary mx-3">Save test state</button>
<button type="button" id="mat-finish" class="btn btn-primary mx-3">Finish test</button>
</div>
</div>
<script>
$(document).ready(function(){
// Initialise socketio with a namespace called "main"
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + '/main');
$('#mat-save').click(function(event) {
socket.emit("open_save_file_dialog")
});
$('#mat-repeat').click(function(event) {
socket.emit("repeat_stimulus")
});
$('#mat-finish').click(function(event) {
socket.emit("finish_test")
});
socket.on('mat_plot_ready', function(msg) {
$('#mat_plot').attr('src', msg.data);
});
// FIXME: A terrible hack because I can't get the main thread to talk to
// the subthread directly using socketio...
socket.on('save_file_dialog_resp', function(msg) {
socket.emit("save_file_dialog_resp", msg)
});
socket.on('load_file_dialog_resp', function(msg) {
socket.emit("load_file_dialog_resp", msg)
});
// Catch message when asynchronous process is complete
socket.on('processing-complete', function(msg) {
// Re-enable all inputs
$('#main-div').find('input, textarea, button, select').removeAttr('disabled');
alert("Matrix stimulus processing complete!")
window.location.href = '/matrix_test/clinician/complete';
});
});
</script>
{% endblock %}