by n-gauge on 1/20/25, 8:38 PM with 0 comments
I found an old style yubikey after a clear out, plugged it in as you do to see if still worked - It did, and so I thought what other uses can you do with it.
Ended up turning into a web browser button for now, wonder if can be used for some game mechanic:
[code] <!DOCTYPE html><body><div id="t">press key to start</div><script> let startTime, count, press, posLeft = 0, o = document.getElementById("t"); o.style.position = "relative"; document.addEventListener('keyup', (event) => { if (!startTime) { startTime = Date.now(); o.innerHTML = "#"; } else { const endTime = Date.now(); const timeDiff = endTime - startTime; if (timeDiff > 100) { press = count = 0; } if (timeDiff > 3 && timeDiff < 33) { press++; } if (count == 44 && press == 44) { o.style.left = (posLeft+=10) + "px"; } count++; startTime = endTime; } }); </script></body></html> [/code]
(not sure if the code will show as expected but you get the idea)