Commit 3c36fb567d94e225efef401fef358f1067e42690
1 parent
fac28ea7
Exists in
master
and in
1 other branch
- tab in textarea replaced by 4 spaces
Showing
5 changed files
with
33 additions
and
22 deletions
Show diff stats
BUGS.md
| 1 | 1 | |
| 2 | 2 | # BUGS |
| 3 | 3 | |
| 4 | +- abrir o teste numa janela maximizada e que nao permite que o aluno a redimensione/mova. | |
| 5 | +- detectar scroll e enviar posição para servidor (analise de scroll para detectar copianço? ou simplesmente para analisar como os alunos percorrem o teste) | |
| 6 | +- detectar se janela perde focus e alertar o prof (http://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active) | |
| 7 | + | |
| 4 | 8 | - usar thread.Lock para aceder a variaveis de estado? |
| 5 | 9 | - permitir adicionar imagens nas perguntas. |
| 6 | 10 | - debug mode: log levels not working | ... | ... |
serve.py
| ... | ... | @@ -99,6 +99,13 @@ class AdminWebService(object): |
| 99 | 99 | elif args['cmd'] == 'reset': |
| 100 | 100 | return self.app.reset_password(args['name']) |
| 101 | 101 | |
| 102 | + else: | |
| 103 | + print(args) | |
| 104 | + # if args['cmd'] == 'focus': | |
| 105 | + # print('FOCUS', args['name']) | |
| 106 | + # elif args['cmd'] == 'blur': | |
| 107 | + # print('FOCUS', args['name']) | |
| 108 | + | |
| 102 | 109 | # ============================================================================ |
| 103 | 110 | # Webserver root |
| 104 | 111 | # ============================================================================ | ... | ... |
static/js/question_disabler.js
static/js/tabkey_in_textarea.js
| 1 | -$("textarea").keydown(function(e) { | |
| 2 | - if(e.keyCode === 9) { // tab was pressed | |
| 3 | - // get caret position/selection | |
| 4 | - var start = this.selectionStart; | |
| 5 | - var end = this.selectionEnd; | |
| 1 | +$(document).ready(function() { | |
| 6 | 2 | |
| 7 | - var $this = $(this); | |
| 8 | - var value = $this.val(); | |
| 3 | + $("textarea").keydown(function(e) { | |
| 4 | + if(e.keyCode === 9) { // tab was pressed | |
| 5 | + // get caret position/selection | |
| 6 | + var start = this.selectionStart; | |
| 7 | + var end = this.selectionEnd; | |
| 8 | + var value = $(this).val(); | |
| 9 | 9 | |
| 10 | - // set textarea value to: text before caret + tab + text after caret | |
| 11 | - $this.val(value.substring(0, start) | |
| 12 | - + "\t" | |
| 13 | - + value.substring(end)); | |
| 10 | + // set textarea value to: text before caret + tab + text after caret | |
| 11 | + $(this).val(value.substring(0, start) + " " + value.substring(end)); | |
| 14 | 12 | |
| 15 | - // put caret at right position again (add one for the tab) | |
| 16 | - this.selectionStart = this.selectionEnd = start + 1; | |
| 17 | - | |
| 18 | - // prevent the focus lose | |
| 19 | - e.preventDefault(); | |
| 20 | - } | |
| 21 | -}); | |
| 22 | 13 | \ No newline at end of file |
| 14 | + // put caret at right position again (add one for the tab) | |
| 15 | + this.selectionStart = this.selectionEnd = start + 4; | |
| 16 | + e.preventDefault(); // prevent the focus lose | |
| 17 | + } | |
| 18 | + }); | |
| 19 | +}); | ... | ... |
templates/test.html
| ... | ... | @@ -28,6 +28,10 @@ |
| 28 | 28 | |
| 29 | 29 | <!-- My javascripts --> |
| 30 | 30 | <script src="/static/js/question_disabler.js"></script> |
| 31 | + <script src="/static/js/prevent_enter_submit.js"></script> | |
| 32 | + <script src="/static/js/detect_unfocus.js"></script> | |
| 33 | + <script src="/static/js/tabkey_in_textarea.js"></script> | |
| 34 | + | |
| 31 | 35 | <style> |
| 32 | 36 | /* Fixes navigation panel overlaying content */ |
| 33 | 37 | body { |
| ... | ... | @@ -330,7 +334,6 @@ |
| 330 | 334 | </div> |
| 331 | 335 | </div> |
| 332 | 336 | |
| 333 | -<script src="/static/js/tabkey_in_textarea.js"></script> | |
| 334 | -<script src="/static/js/prevent_enter_submit.js"></script> | |
| 337 | + | |
| 335 | 338 | </body> |
| 336 | 339 | </html> | ... | ... |