289 lines
13 KiB
HTML
289 lines
13 KiB
HTML
{% extends 'participant_index.html' %}
|
|
{% block content %}
|
|
<div id="main-div" class="outer">
|
|
<div id="instructions">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h2>Instructions</h2>
|
|
<p>
|
|
In this test, you will be presented with sentences spoken in
|
|
background noise. Use the grid to select the word you hear from
|
|
each column. If you can't hear a word, take a guess. When you
|
|
have made your selection, press submit to continue to the next
|
|
sentence.</p>
|
|
<img src="/static/matrix_screen.png" class="center_matrix">
|
|
<br>
|
|
<button type="button" href="#" id="instr_continue" class="Btn Btn-primary">Continue</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container-fluid mat_grid">
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Peter</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">got</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">three</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">large</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">desks</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Kathy</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">sees</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">nine</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">small</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">chairs</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Lucy</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">bought</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">five</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">old</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">shoes</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Alan</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">gives</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">eight</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">dark</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">toys</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Rachel</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">sold</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">four</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">thin</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">spoons</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Barry</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">likes</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">six</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">green</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">mugs</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Steven</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">has</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">two</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">cheap</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">ships</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Thomas</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">kept</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">ten</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">pink</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">rings</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Hannah</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">wins</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">twelve</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">red</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">tins</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-0" class="Btn Btn-outline-secondary mat-button">Nina</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-1" class="Btn Btn-outline-secondary mat-button">wants</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-2" class="Btn Btn-outline-secondary mat-button">some</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-3" class="Btn Btn-outline-secondary mat-button">big</button>
|
|
</div>
|
|
<div class="col-md">
|
|
<button type="button" href="#" disabled id="mat-4" class="Btn Btn-outline-secondary mat-button">beds</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="mat_submit">
|
|
<button type="button" href="#" disabled id="mat-submit" class="Btn Btn-primary">Submit</button>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
// Initialise socketio with a namespace called "main"
|
|
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + '/main');
|
|
var part_ready = false;
|
|
loading = false;
|
|
waitingDialog.show('Loading... Please wait');
|
|
|
|
var choice = Array(5).fill('');
|
|
$('.mat-button').click(function(event) {
|
|
choice[this.id.slice(-1)] = $(this).text();
|
|
$('.mat-button#'+this.id).not(this).removeClass("active");
|
|
$(this).addClass("active");
|
|
console.log(choice);
|
|
return false;
|
|
});
|
|
|
|
$('#mat-submit').click(function(event) {
|
|
$('#mat-submit').prop("disabled", true);
|
|
if(choice.includes('')) {
|
|
alert("Please select a word from each column");
|
|
$('#mat-submit').prop("disabled", false);
|
|
return false;
|
|
}
|
|
else {
|
|
$('.mat-button').removeClass("active");
|
|
socket.emit('submit_response', {
|
|
resp: choice
|
|
});
|
|
choice = Array(5).fill('');
|
|
}
|
|
});
|
|
|
|
function displayInstructions() {
|
|
$("#instructions").css("display", "table-cell");
|
|
$("#instructions").fadeIn();
|
|
waitingDialog.hide();
|
|
}
|
|
|
|
function hideInstructions() {
|
|
$("#instructions").css("display", "none");
|
|
$("#instructions").fadeOut();
|
|
if(loading) {
|
|
waitingDialog.show('Loading... Please wait');
|
|
}
|
|
}
|
|
|
|
|
|
$('#instr_continue').click(function(event) {
|
|
hideInstructions();
|
|
part_ready = true;
|
|
socket.emit("part_ready")
|
|
});
|
|
|
|
socket.on('display_instructions', function(msg) {
|
|
displayInstructions();
|
|
});
|
|
|
|
socket.on('stim_playing', function(msg) {
|
|
// Disable all inputs whilst processing
|
|
$('#main-div').find('input, textarea, button, select').attr('disabled','disabled');
|
|
});
|
|
|
|
socket.on('question', function(msg) {
|
|
// Disable all inputs whilst processing
|
|
$('#question').text(msg);
|
|
});
|
|
|
|
socket.on('stim_done', function(msg) {
|
|
$('#main-div').find('input, textarea, button, select').removeAttr('disabled');
|
|
});
|
|
|
|
// 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/complete';
|
|
});
|
|
});
|
|
</script>
|
|
</div>
|
|
{% endblock %}
|