Skip to content

Commit

Permalink
templates: Disable enter key and right mouse button
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Oct 8, 2024
1 parent 81e3d35 commit 62a294c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions notecheck/static/notecheck/disable_enter.js
Original file line number Diff line number Diff line change
@@ -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());
1 change: 1 addition & 0 deletions notecheck/templates/notecheck/grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<title>{{ submission.token.title }} - NoteCheck</title>
<link rel="bookmark icon" type="image/png" href="{% static 'notecheck/favicon.ico' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'notecheck/style.css' %}">
<script src="{% static 'notecheck/disable_enter.js' %}" type="text/javascript"></script>
</head>
<body>
<h1>{{ exercise.get_title }}</h1>
Expand Down
1 change: 1 addition & 0 deletions notecheck/templates/notecheck/playnotepitch.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<title>{{ submission.token.title }} - NoteCheck</title>
<link rel="bookmark icon" type="image/png" href="{% static 'notecheck/favicon.ico' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'notecheck/style.css' %}">
<script src="{% static 'notecheck/disable_enter.js' %}" type="text/javascript"></script>
<script src="https://unpkg.com/aubiojs"></script>
<script lang="javascript">

Expand Down
1 change: 1 addition & 0 deletions notecheck/templates/notecheck/scales.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<title>{{ submission.token.title }} - NoteCheck</title>
<link rel="bookmark icon" type="image/png" href="{% static 'notecheck/favicon.ico' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'notecheck/style.css' %}">
<script src="{% static 'notecheck/disable_enter.js' %}" type="text/javascript"></script>
</head>
<body>
<h1>{{ exercise.get_title }}</h1>
Expand Down

0 comments on commit 62a294c

Please sign in to comment.