mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Better fix for ctrl+Enter for Windows.
This commit is contained in:
parent
634b7f26d7
commit
0ca950d109
1 changed files with 6 additions and 5 deletions
|
@ -33,12 +33,13 @@
|
||||||
jQuery(function($) {
|
jQuery(function($) {
|
||||||
$('.autofocus textarea:first').focus();
|
$('.autofocus textarea:first').focus();
|
||||||
$('.superenter textarea').on('keydown', function(e){
|
$('.superenter textarea').on('keydown', function(e){
|
||||||
// Windows does not have a metaKey, use ctrl instead.
|
var metaKey;
|
||||||
// https://github.com/jquery/jquery/blob/633ca9c1610c49dbb780e565f4f1202e1fe20fae/src/event.js#L552-555
|
if (navigator.appVersion.indexOf("Win")!=-1) {
|
||||||
if (event.metaKey === undefined) {
|
metaKey = e.ctrlKey;
|
||||||
event.metaKey = event.ctrlKey;
|
} else {
|
||||||
|
metaKey = event.metaKey;
|
||||||
}
|
}
|
||||||
if (e.keyCode == 13 && e.metaKey) {
|
if (e.keyCode == 13 && metaKey) {
|
||||||
$(this).closest('form').submit();
|
$(this).closest('form').submit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue