This repository was archived by the owner on Nov 8, 2017. It is now read-only.
sends key history to triggered function#68
Open
2x2xplz wants to merge 1 commit intokeithamus:masterfrom
Open
Conversation
Tracks key press history and adds a 'keySequence' object to the final 'event' (which is already sent to triggered function). Useful when using multiple-choice or regex-like syntax. i.e. get the actual 3-digit code that triggered 'shift+;,[0-9],[0-9],[0-9]'. keySequence is an object that contains an object per key press, and also a string representation called 'sequence' using pipes to separate keys: shift+h|e|l|l|o|space|ctrl+w|o|r|l|d
example usage: jwerty.key('ctrl+shift+;,[a-e],[f-j],[k-o]' , function() { alert(this.event.keySequence.sequence); });
|
+1 for this type of functionality -- I also have had to fork out to create something similar but some core support for exposing the captures that exercised the event just makes sense given the regex functionality. Not sure I think the stringified result in this patch is the best option but given a choice between this or nothing this is better. =) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracks key press history and adds a
keySequenceobject to the finalevent(which is already sent to triggered function). Useful when using multiple-choice or regex-like syntax. i.e. get the actual 3-digit code that triggeredshift+;,[0-9],[0-9],[0-9]. keySequence is an object that contains an object per key press, and also a string representation calledsequenceusing pipes to separate keys:shift+h|e|l|l|o|space|ctrl+w|o|r|l|dexample usage:
jwerty has tremendous potential because of regex support, which other libraries do not have. However its overall support for sequences is spotty, for example, (on Chrome 51/Windows at least) sequences which end in a modifier like
a,b,shift+cdo not trigger. Some regex edge cases are also unsupported:[a-z],[a-z],[a-z],enterwill not be triggered by abcd-enter (I would expect bcd-enter to be the match). Still, the support it does have is great and along with ajax requests, allows for simple password-type sequences that can't be revealed with View Source. I really hope you'll revisit this library and finish 0.4. Thanks.