44 lines
1.5 KiB
HTML
44 lines
1.5 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);
|
|
});
|
|
|
|
// 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 %}
|