indications.js 709 B

12345678910111213141516171819202122232425262728293031
  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. console.log(expeUrl)
  10. function checkKey(e) {
  11. e = e || window.event;
  12. if (e.keyCode == KEYCODE_Q) {
  13. // `q` for quit expe
  14. console.log('`q` key is pressed')
  15. window.location = ''
  16. }
  17. else if (e.keyCode == KEYCODE_ENTER) {
  18. // right arrow
  19. var params = "?scene=" + scene + "&expe=" + expe + "&iteration=0"
  20. console.log(expeUrl + params)
  21. window.location = expeUrl + params
  22. }
  23. }