Commit 20024252 authored by Robin Sonnabend's avatar Robin Sonnabend

Forward and backward presenter keys

parent c44f89eb
var keyhash = "";
var changehash = false;
var keyhash_forward = "";
var keyhash_backward = "";
var changehash = 0;
var notificationArea;
var timeout;
......@@ -12,31 +13,49 @@ function clickNextSpeaker() {
link.click();
}
function clickPreviousSpeaker() {
var link = document.getElementById("previous-statement-button");
link.click();
}
window.onkeypress = function(e) {
if (changehash) {
keyhash = hashkey(e);
changehash = false;
sessionStorage["keyhash"] = keyhash;
notificationArea.innerHTML = "Key has been set.";
if (changehash == 2) {
keyhash_forward = hashkey(e);
changehash = 1;
sessionStorage["keyhash_forward"] = keyhash_forward;
notificationArea.innerHTML = "Please click the backward key.";
} else if (changehash == 1) {
keyhash_backward = hashkey(e);
changehash = 0;
sessionStorage["keyhash_backward"] = keyhash_backward;
notificationArea.innerHTML = "Both keys have been set.";
timeout = window.setTimeout(function() { notificationArea.innerHTML = ""; }, 5000);
} else {
if (hashkey(e) == keyhash) {
if (hashkey(e) == keyhash_forward) {
clickNextSpeaker();
} else if (hashkey(e) == keyhash_backward) {
clickPreviousSpeaker();
}
}
};
function setkeyhash() {
changehash = true;
notificationArea.innerHTML = "Please click the key.";
changehash = 2;
notificationArea.innerHTML = "Please click the forward key.";
window.clearTimeout(timeout);
}
var nextbuttoncachedonloadfunction = window.onload;
window.onload = function() {
nextbuttoncachedonloadfunction();
if (sessionStorage["keyhash"]) {
keyhash = sessionStorage["keyhash"];
var found = false;
if (sessionStorage["keyhash_forward"]) {
keyhash_forward = sessionStorage["keyhash_forward"];
found = true;
}
if (sessionStorage["keyhash_backward"]) {
keyhash_backward = sessionStorage["keyhash_backward"];
found = true;
}
notificationArea = document.getElementById("rede-layout-notification");
};
......@@ -71,7 +71,7 @@
<tr>
<td>
{% if can_undo_statement %}
<a href="{{ url_for(".statement_undo", topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a>
<a id="previous-statement-button" href="{{ url_for(".statement_undo", topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a>
{% endif %}
</td>
<td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment