Skip to content
Snippets Groups Projects
Commit 20024252 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Forward and backward presenter keys

parent c44f89eb
Branches
No related tags found
No related merge requests found
var keyhash = ""; var keyhash_forward = "";
var changehash = false; var keyhash_backward = "";
var changehash = 0;
var notificationArea; var notificationArea;
var timeout; var timeout;
...@@ -12,31 +13,49 @@ function clickNextSpeaker() { ...@@ -12,31 +13,49 @@ function clickNextSpeaker() {
link.click(); link.click();
} }
function clickPreviousSpeaker() {
var link = document.getElementById("previous-statement-button");
link.click();
}
window.onkeypress = function(e) { window.onkeypress = function(e) {
if (changehash) { if (changehash == 2) {
keyhash = hashkey(e); keyhash_forward = hashkey(e);
changehash = false; changehash = 1;
sessionStorage["keyhash"] = keyhash; sessionStorage["keyhash_forward"] = keyhash_forward;
notificationArea.innerHTML = "Key has been set."; 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); timeout = window.setTimeout(function() { notificationArea.innerHTML = ""; }, 5000);
} else { } else {
if (hashkey(e) == keyhash) { if (hashkey(e) == keyhash_forward) {
clickNextSpeaker(); clickNextSpeaker();
} else if (hashkey(e) == keyhash_backward) {
clickPreviousSpeaker();
} }
} }
}; };
function setkeyhash() { function setkeyhash() {
changehash = true; changehash = 2;
notificationArea.innerHTML = "Please click the key."; notificationArea.innerHTML = "Please click the forward key.";
window.clearTimeout(timeout); window.clearTimeout(timeout);
} }
var nextbuttoncachedonloadfunction = window.onload; var nextbuttoncachedonloadfunction = window.onload;
window.onload = function() { window.onload = function() {
nextbuttoncachedonloadfunction(); nextbuttoncachedonloadfunction();
if (sessionStorage["keyhash"]) { var found = false;
keyhash = sessionStorage["keyhash"]; 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"); notificationArea = document.getElementById("rede-layout-notification");
}; };
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<tr> <tr>
<td> <td>
{% if can_undo_statement %} {% 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 %} {% endif %}
</td> </td>
<td> <td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment