Add comments next to JavaScript key codes

This commit is contained in:
Giuseppe Criscione 2018-10-14 13:40:42 +02:00
parent 683c0dabe8
commit 7eb3823cc3
3 changed files with 22 additions and 22 deletions

22
admin/assets/js/app.js Normal file → Executable file
View File

@ -1166,20 +1166,20 @@ Formwork.Utils = {
var date = $(this).data('date');
calendar.setDate(helpers.isValidDate(date) ? date : new Date());
switch (event.which) {
case 13:
case 13: // enter
$('.calendar-day.selected').click();
$calendar.hide();
return false;
case 8:
case 8: // backspace
$this.val('');
$input.blur();
$calendar.hide();
return false;
case 27:
case 27: // escape
$input.blur();
$calendar.hide();
return false;
case 37:
case 37: // left arrow
if (event.ctrlKey || event.metaKey) {
if (event.shiftKey) {
calendar.prevYear();
@ -1190,10 +1190,10 @@ Formwork.Utils = {
calendar.prevDay();
}
break;
case 38:
case 38: // up arrow
calendar.prevWeek();
break;
case 39:
case 39: // right arrow
if (event.ctrlKey || event.metaKey) {
if (event.shiftKey) {
calendar.nextYear();
@ -1204,10 +1204,10 @@ Formwork.Utils = {
calendar.nextDay();
}
break;
case 40:
case 40: // down arrow
calendar.nextWeek();
break;
case 48:
case 48: // 0
if (event.ctrlKey || event.metaKey) {
var today = new Date();
calendar.setDate(today);
@ -1446,7 +1446,7 @@ Formwork.Utils = {
var value = $this.val().trim();
switch (event.which) {
case 8:
case 8: // backspace
if (value === '') {
removeTag($this, $this.prev().text());
$this.prev().remove();
@ -1455,8 +1455,8 @@ Formwork.Utils = {
}
$this.prop('size', Math.max($this.val().length, 1));
return true;
case 13:
case 188:
case 13: // enter
case 188: // comma
if (value !== '') {
addTag($this, value);
}

View File

@ -134,20 +134,20 @@
var date = $(this).data('date');
calendar.setDate(helpers.isValidDate(date) ? date : new Date());
switch (event.which) {
case 13:
case 13: // enter
$('.calendar-day.selected').click();
$calendar.hide();
return false;
case 8:
case 8: // backspace
$this.val('');
$input.blur();
$calendar.hide();
return false;
case 27:
case 27: // escape
$input.blur();
$calendar.hide();
return false;
case 37:
case 37: // left arrow
if (event.ctrlKey || event.metaKey) {
if (event.shiftKey) {
calendar.prevYear();
@ -158,10 +158,10 @@
calendar.prevDay();
}
break;
case 38:
case 38: // up arrow
calendar.prevWeek();
break;
case 39:
case 39: // right arrow
if (event.ctrlKey || event.metaKey) {
if (event.shiftKey) {
calendar.nextYear();
@ -172,10 +172,10 @@
calendar.nextDay();
}
break;
case 40:
case 40: // down arrow
calendar.nextWeek();
break;
case 48:
case 48: // 0
if (event.ctrlKey || event.metaKey) {
var today = new Date();
calendar.setDate(today);

View File

@ -73,7 +73,7 @@
var value = $this.val().trim();
switch (event.which) {
case 8:
case 8: // backspace
if (value === '') {
removeTag($this, $this.prev().text());
$this.prev().remove();
@ -82,8 +82,8 @@
}
$this.prop('size', Math.max($this.val().length, 1));
return true;
case 13:
case 188:
case 13: // enter
case 188: // comma
if (value !== '') {
addTag($this, value);
}