diff --git a/_web/_includes/go-js.html b/_web/_includes/go-js.html index 773eb91..7c57ef0 100644 --- a/_web/_includes/go-js.html +++ b/_web/_includes/go-js.html @@ -1144,10 +1144,6 @@ } - if (evt.which === 17) { // control - controlled = true; - } - if (evt.which === 72) { // h jukeboxData.infiniteMode = !jukeboxData.infiniteMode; if (jukeboxData.infiniteMode) { @@ -1157,10 +1153,6 @@ } } - if (evt.which === 16) { // shift - shifted = true; - } - if (evt.which === 32) { // space evt.preventDefault(); if (driver.isRunning()) { @@ -1172,13 +1164,14 @@ } - function keyup(evt) { - if (evt.which == 17) { // control - controlled = false; - } - if (evt.which == 16) { // shift - shifted = false; - } + function updateCtrlShift(evt) { + controlled = evt.ctrlKey + shifted = evt.shiftKey + } + + function resetCtrlShit() { + controlled = false; + shifted = false; } function getShareURL(callback) { @@ -1207,7 +1200,12 @@ }; $(document).keydown(keydown); - $(document).keyup(keyup); + + window.addEventListener('keydown', updateCtrlShift) + window.addEventListener('keyup', updateCtrlShift) + window.addEventListener('keypress', updateCtrlShift) + document.addEventListener('blur', resetCtrlShit); + window.addEventListener('blur', resetCtrlShit); paper = Raphael("tiles", W, H);