konami-code-js icon indicating copy to clipboard operation
konami-code-js copied to clipboard

Iphone IOS helper

Open audetcameron opened this issue 2 years ago • 1 comments

Howdy, I wanted to share that I could not get this to trigger on iPhone chrome/safari. I guess by default they pass passive as true, so I just added passive:false as the third params to the privates.listenCodeGestureSequence function.

seen here:


    privates.listenCodeGestureSequence = function () {
        privates.originalCodeGesture = privates.konamiCodeGesture;
        privates.stopCodeGestureSequence();
        privates.listener.addEventListener("touchstart", privates.codeSequenceEventTouchStart, { passive: false });
        // privates.listener.addEventListener("touchstart", privates.codeSequenceEventTouchStart);
        privates.listener.addEventListener("touchmove", privates.codeSequenceEventTouchMove, { passive: false });
        // privates.listener.addEventListener("touchmove", privates.codeSequenceEventTouchMove);
        privates.listener.addEventListener("touchend", privates.codeSequenceEventTouchEnd,  { passive: false });
        // privates.listener.addEventListener("touchend", privates.codeSequenceEventTouchEnd,  false);
    };




audetcameron avatar Nov 22 '23 18:11 audetcameron

Thank you @audetcameron!

I implemented your fix on my website and test all work fine through all previous browser I tested it and see no regression.

I just need your input from your iPhone chrome/safari to know if solve well your issue. If yes, I will implement it in the next 0.84.0 release.

So to test it: when you reach this website from your iPhone with chrome/safari: https://blog.lesieur.name/, if you do the gesture, the wesite « goes upside down » from your test?

MachinisteWeb avatar Dec 11 '24 15:12 MachinisteWeb