Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Mac OS X Command Key #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions numeric/jquery.numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(function($) {
/*
* Allows only valid characters to be entered into input boxes.
* Note: fixes value when pasting via Ctrl+V, but not when using the mouse to paste
* Note: fixes value when pasting via Ctrl|Cmd+V, but not when using the mouse to paste
* side-effect: Ctrl+A does not work, though you can still use the mouse to select (or double-click to select all)
*
* @name numeric
Expand Down Expand Up @@ -65,16 +65,16 @@ $.fn.numeric.keypress = function(e)
return false;
}
var allow = false;
// allow Ctrl+A
if((e.ctrlKey && key == 97 /* firefox */) || (e.ctrlKey && key == 65) /* opera */) { return true; }
// allow Ctrl+X (cut)
if((e.ctrlKey && key == 120 /* firefox */) || (e.ctrlKey && key == 88) /* opera */) { return true; }
// allow Ctrl+C (copy)
if((e.ctrlKey && key == 99 /* firefox */) || (e.ctrlKey && key == 67) /* opera */) { return true; }
// allow Ctrl+Z (undo)
if((e.ctrlKey && key == 122 /* firefox */) || (e.ctrlKey && key == 90) /* opera */) { return true; }
// allow or deny Ctrl+V (paste), Shift+Ins
if((e.ctrlKey && key == 118 /* firefox */) || (e.ctrlKey && key == 86) /* opera */ ||
// allow Ctrl+A or (Mac)Cmd+A
if(((e.ctrlKey||e.metaKey) && key == 97 /* firefox */) || ((e.ctrlKey||e.metaKey) && key == 65) /* opera */) { return true; }
// allow Ctrl+X or (Mac)Cmd+X (cut)
if(((e.ctrlKey||e.metaKey) && key == 120 /* firefox */) || ((e.ctrlKey||e.metaKey) && key == 88) /* opera */) { return true; }
// allow Ctrl+C or (Mac)Cmd+C (copy)
if(((e.ctrlKey||e.metaKey) && key == 99 /* firefox */) || ((e.ctrlKey||e.metaKey) && key == 67) /* opera */) { return true; }
// allow Ctrl+Z or (Mac)Cmd+Z (undo)
if(((e.ctrlKey||e.metaKey) && key == 122 /* firefox */) || ((e.ctrlKey||e.metaKey) && key == 90) /* opera */) { return true; }
// allow or deny Ctrl+V or (Mac)Cmd+V (paste), Shift+Ins
if(((e.ctrlKey||e.metaKey) && key == 118 /* firefox */) || ((e.ctrlKey||e.metaKey) && key == 86) /* opera */ ||
(e.shiftKey && key == 45)) { return true; }
// if a number was not pressed
if(key < 48 || key > 57)
Expand Down
2 changes: 1 addition & 1 deletion numeric/jquery.numeric.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.