georgemandis / konami-js

Adding the Konami Code easter egg to your projects since 2009! Compatible with gestures on smartphones and tablets as well. Compatible with all front-end frameworks and vanilla JavaScript
http://konamijs.mand.is/
MIT License
959 stars 122 forks source link

Broken on mobile #24

Closed Joan closed 8 years ago

Joan commented 8 years ago

A call is made to konami.touchCapture, but it exists as konami.iphone.touchCapture. Moreover, when logging result at the end of check_direction, the result for a UP gesture is UP, DOWN, idem for a DOWN gesture, and the result for a TAP is LEFT. Don't know if it's in relation, but doesn't work at all on any mobile device. Thanks!

remino commented 8 years ago

I don't know how to fix that code, but I've hit the same problem. I see the last commit is causing the issue and it was simply a minor refactor. What I did instead was the downgrade my konami.js to the previous commit: https://github.com/snaptortoise/konami-js/blob/1ac35c58e5a4554d60cfc0e174dcf4816a6207d6/konami.js

Actually, it never worked for me on mobile (only on desktop), but at least now it stopped breaking the whole site.

georgemandis commented 8 years ago

You are both correct. I played with it for a bit and the problem seemed to reside with the way it was returning TAP.

My fault for not testing the previous commit more thoroughly. I like the idea of optimizing it further — and perhaps even building some automated tests into this project? — but I'd prefer it simply work, so I've more or less reverted it to how it was.

I've updated the GitHub page to use the code for future testing: http://code.snaptortoise.com/konami-js/

If you guys can confirm the updated version is working correctly for you I'll close this and revisit bringing in some of the previous optimizations at another time.

Joan commented 8 years ago

This new version/downgrade is confirmed working. Thanks!