From 62a294c21f5eb22463d6746b4e3471c3c736fb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Wed, 9 Oct 2024 00:01:04 +0200 Subject: [PATCH] templates: Disable enter key and right mouse button --- notecheck/static/notecheck/disable_enter.js | 11 +++++++++++ notecheck/templates/notecheck/grid.html | 1 + notecheck/templates/notecheck/playnotepitch.html | 1 + notecheck/templates/notecheck/scales.html | 1 + 4 files changed, 14 insertions(+) create mode 100644 notecheck/static/notecheck/disable_enter.js diff --git a/notecheck/static/notecheck/disable_enter.js b/notecheck/static/notecheck/disable_enter.js new file mode 100644 index 0000000..aeb18cb --- /dev/null +++ b/notecheck/static/notecheck/disable_enter.js @@ -0,0 +1,11 @@ +window.addEventListener('keydown',function(e) { + if (e.keyIdentifier=='U+000A' || e.keyIdentifier=='Enter' || e.keyCode==13) { + if (e.target.nodeName=='INPUT' && e.target.type=='text') { + e.preventDefault(); + + return false; + } + } +}, true); + +document.addEventListener('contextmenu', event => event.preventDefault()); \ No newline at end of file diff --git a/notecheck/templates/notecheck/grid.html b/notecheck/templates/notecheck/grid.html index b91d04d..0f6fc22 100644 --- a/notecheck/templates/notecheck/grid.html +++ b/notecheck/templates/notecheck/grid.html @@ -9,6 +9,7 @@ {{ submission.token.title }} - NoteCheck +

{{ exercise.get_title }}

diff --git a/notecheck/templates/notecheck/playnotepitch.html b/notecheck/templates/notecheck/playnotepitch.html index 10abd09..104f94d 100644 --- a/notecheck/templates/notecheck/playnotepitch.html +++ b/notecheck/templates/notecheck/playnotepitch.html @@ -9,6 +9,7 @@ {{ submission.token.title }} - NoteCheck +

{{ exercise.get_title }}