TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

What to Do with Old Yubikeys?

2 点作者 n-gauge4 个月前
What do you do with yours?<p>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.<p>Ended up turning into a web browser button for now, wonder if can be used for some game mechanic:<p>[code] &lt;!DOCTYPE html&gt;&lt;body&gt;&lt;div id=&quot;t&quot;&gt;press key to start&lt;&#x2F;div&gt;&lt;script&gt; let startTime, count, press, posLeft = 0, o = document.getElementById(&quot;t&quot;); o.style.position = &quot;relative&quot;; document.addEventListener(&#x27;keyup&#x27;, (event) =&gt; { if (!startTime) { startTime = Date.now(); o.innerHTML = &quot;#&quot;; } else { const endTime = Date.now(); const timeDiff = endTime - startTime; if (timeDiff &gt; 100) { press = count = 0; } if (timeDiff &gt; 3 &amp;&amp; timeDiff &lt; 33) { press++; } if (count == 44 &amp;&amp; press == 44) { o.style.left = (posLeft+=10) + &quot;px&quot;; } count++; startTime = endTime; } }); &lt;&#x2F;script&gt;&lt;&#x2F;body&gt;&lt;&#x2F;html&gt; [&#x2F;code]<p>(not sure if the code will show as expected but you get the idea)

暂无评论

暂无评论