Open rushfrisby opened 13 years ago
Right now jKey does support "chains" but what we defined as a chain is:
alt+shift+t
You mean more of supporting "Key patterns" more specifically correct? The above example you gave would tell jKey to attach up
and alt+shift+m
. This is done like this to be like jQuery and CSS.
Do you have another example? What if it were wrapped in like square brackets like?
[up,up,down,down]
Like that?
First off, let me say this is a fantastic little plugin for jquery. Secondly, it's totally possible to do what you're requesting, but just requires some thought. Let's say you want to chain the following combination: J, K, E, Y. For each of those key functions, just populate an array adding the last pressed key, then check the array against your target chain "jkey". As soon as they don't match, clear the array and then add the last letter clicked (representing starting over). As long as it partially matches do nothing (basically maybe they've only gotten as far as "jke", and finally as soon as it fully matches do whatever event you want to fire.
@kameelyan Yeah, i was thinking if I put it in square brackets it'd trigger jKey to look for that pattern. Are you fluent in JS? You wanna do this and send a pull request?
Can you add support for key chaining? For example to fire when user presses up,up,alt+shift+m ...or something more complicated like the konami code.