indications.js 687 B

1234567891011121314151617181920212223242526272829
  1. // implement `key` events
  2. document.onkeydown = checkKey;
  3. // Utils informations
  4. var KEYCODE_Q = '81'
  5. var KEYCODE_ENTER = '13'
  6. urlParams = new URLSearchParams(window.location.search);
  7. var scene = urlParams.get('scene')
  8. var expe = urlParams.get('expe')
  9. function checkKey(e) {
  10. e = e || window.event;
  11. if (e.keyCode == KEYCODE_Q) {
  12. // `q` for quit expe
  13. console.log('`q` key is pressed')
  14. window.location = ''
  15. }
  16. else if (e.keyCode == KEYCODE_ENTER) {
  17. // right arrow
  18. var params = "?scene=" + scene + "&expe=" + expe + "&iteration=0"
  19. console.log(expeUrl + params)
  20. window.location = expeUrl + params
  21. }
  22. }