oscargodson / jkey Goto Github PK
View Code? Open in Web Editor NEWKey shortcuts made simple
Home Page: http://oscargodson.github.com/jKey/
Key shortcuts made simple
Home Page: http://oscargodson.github.com/jKey/
Hi there. Great plug-in but missing the functionality I'm looking for.
I have numbered tables and I want a user to be able to select and highlight the data for say row number 22 just using the keyboard.
Is there anyway I can have some very short time delay in there to say if two keys are pressed 'in sequence' within a few milliseconds apart, treat this as a double digit key press?
Thanks,
Peter
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.
If you bind the up/down keys to window, you lose page scroll capabilities, I think it would be a good idea to add support for event bubbling so the event still makes it up the chain.
You can do this by passing a "bubble" Boolean into the function.
e.g.
$(window).jkey("up", true, function(key){ //do stuff with the up key}
This Plugin is really awesome and i like it very much. i am facing some issues in this .
When set the Key combination of alt+s. It show an alert correctly. after that i press S key in page it shows as same alert inappropriately. i didnt place the alert in jkey callback function. alert in save button it shows a mandatory. is there any way. Kindly fix this issue as soon as possible
Thanks
Rajesh.S
If you bind a combo like ctrl+enter on OS X, hold down the commend key and any other button (enter for example) you are able to “freeze” that button jKey's activeKeys array:
Let go of the enter button while still holding the command button; you'll notice that no keyup event was fired for the enter button. Thus the activeKeys array within still contains the pressed enter key.
Now you can trigger the ctrl+enter combo callback whenever you hit ctrl – no need to hit enter anymore, since it's registered as 'activeKey' forever... well until you hit enter again.
$(document).jkey('ctrl+enter',function(){
jkey.log('You pressed the enter+ctrl key.');
});
That also makes combos with the command button impossible.
I also noticed that jkey binds the keyCode 224 for the command button but it's different in all the browsers:
Firefox: 224
Opera: 17
WebKit (Safari/Chrome): 91 (Left Apple) or 93 (Right Apple)
One doesn’t see a page when going to http://oscargodson.com/labs/jkey/
I was using it to detect if a letter d is clicked like so
$(window).jkey('d',true,function(){alert('you clicked d');});
but it doesn't work in ie.
$(window).jkey('shift+?',function(){
console.log('key pressed');
});
Does not work in Firefox 3.6.13 / Mac OS X with a german keyboard. The keyUp-Code that jquery receives when I press the ?-Button is 223. Sadly, I couldnt find any assigned key name at the beginning of the jkey source.
Otherwise, thank you for the good script. Just what I needed.
Michael
Everything works fine for me, except that when I combine my javascript files into one, I get this cryptic error:
Do you have any idea what might cause this? I had the same problem with jquery.hotkeys, which is why I wanted to try and use jkey.
I'm using some custom javascript (so it may be my fault) and these:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>Any help would be very much appreciated. I'm really stuck.
It looks like part of the problem with #4 is this issue as well.
It is not possible to detect a '?' being pressed using the keydown event in Firefox on Mac OS X. See the key handler source in the google closure code; in particular, this comment:
// On the Mac, shift-/ triggers a question mark char code and no key code
Hi guys,
The keypress doesn't get registered for a number, if I press it on the numeric keyboard.
Am I missing something?
Thanks :)
Lines 197 and 248 should be as follows, respectively:
$this.unbind('keydown').bind('keydown',function(e){
}).unbind('keyup').bind('keyup',function(e) {
This will allow for re-applying the jKey class on ajax added elements.
Please, change the way you are traversing the keySplit
array, because actually the array has another properties itlself and causes problems, like at stackoverflow question
In the simplified example below, if I press a or b separately, nothing happens (expected).
If I press a and b and the same time, then the event fires (expected).
But after that point, the event fires every time I press a or b.
Behavior is reproducible in Chrome 13 and Firefox 6 and IE9
Am I doing something wrong?
Thanks!
<!doctype html>
<html>
<head>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery.jkey-1.2.js"></script>
<script type="text/javascript">
$(function() {
$(document).jkey('a+b',function() { alert('a and b pressed together!');});
});
</script>
</head>
<body>
</body>
Hi there,
I'd just wanted to point out that there's no explanation on how to unbind a jKey event, although I found it easily looking at your code, it may be something good to just write it somewhere in the README file or maybe making a more "clean" way to do it.
For now I made it this way
$(element).unbind('keydown.jkey');
For me it's all right, but it implies that I unbind every key event associated to element
If you're ok with patches I'd be pleased to write one in order to implement some way to make it possible to unbind specifical key events, in order to do something like that :
$(element).jkey('unbind', 'left, right');
Thanks for the plug, works really well!
Cheers
First I would like to thank you for this plugin, it saved me tons of time and headaches.
My issue is i am tracking when someone pastes into an input field. The key combo i set up is 'crtl+v' which works the first time you press it. Then after that anytime you press a v or crtl it will fire the callback function.
I made a fiddle for you with my code.
I'm looking to do something similar and some advice would be great
When I press command-c, I get the "c" trigger. Is this a known behavior?
$('*:not(:input)').jkey('b', function(key, e)
{
debugger;
})
In the input type 'b', will also perform?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.