thecore_dataentry_commons 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c9f5bd42e30742cb9feb550b009a01f50d212ee93c2e84ed97174dbc5bf5166
|
4
|
+
data.tar.gz: 91f383330d944dc003c5c3971a7f1bf526e6245f98a4f924a724f1aaf9f94ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cdd4f0d034c8c07a46241ac40b0f220fe991f36c5236633858e31c6fae80fcaf85632b6e4c9afee3ebe7de46382f79a42d41bbc6db0799133b3279a1d1efbaf
|
7
|
+
data.tar.gz: 7fae1272b45730a34725b7c1ef9f6d4698c6be0f04b4eb5644613c1aef84fadc5045530446c80a86de2b7ec473f55a78226b003df5e3e037dded5c3e3f0724f2
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<script>
|
2
|
-
function keypressAndReturn(event) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
2
|
+
// function keypressAndReturn(event) {
|
3
|
+
// // Capture all the keypresses and if they are a return,
|
4
|
+
// // then "click" the send button
|
5
|
+
// var keycode = (event.keyCode ? event.keyCode : event.which);
|
6
|
+
// if (keycode == '13') {
|
7
|
+
// $("#send").click();
|
8
|
+
// return true;
|
9
|
+
// }
|
10
|
+
// return false;
|
11
|
+
// }
|
12
12
|
var kpMode = "<%= Settings.datawedge_kp_mode %>";
|
13
13
|
// var clickedBtn; var code; Gestisco il keypress sull'input
|
14
14
|
// $("#barcode").on(kpMode, keypressAndReturn);
|
@@ -21,44 +21,61 @@
|
|
21
21
|
}
|
22
22
|
// var clickedBtn; var code; Gestisco il keypress sull'input
|
23
23
|
function manageScannedKeystrokes(event) {
|
24
|
-
|
25
|
-
|
24
|
+
const keycode = (event.keyCode ? event.keyCode : event.which);
|
25
|
+
const valid = !event.ctrlKey && !event.altKey &&
|
26
|
+
((keycode > 47 && keycode < 58) || // number keys
|
27
|
+
keycode == 32 || // spacebar
|
28
|
+
(keycode > 64 && keycode < 91) || // letter keys
|
29
|
+
(keycode > 95 && keycode < 112) || // numpad keys
|
30
|
+
(keycode > 185 && keycode < 193) || // ;=,-./` (in order)
|
31
|
+
(keycode > 218 && keycode < 223)); // [\]' (in order)
|
32
|
+
let prevent = false;
|
26
33
|
if (event.ctrlKey && keycode == '32') {
|
34
|
+
// Invia il form secondario
|
35
|
+
console.log("Send secondary form");
|
27
36
|
$("#data-action").click();
|
37
|
+
prevent = true;
|
28
38
|
//return true;
|
29
|
-
} else if(
|
30
|
-
//
|
39
|
+
} else if (keycode == '13') {
|
40
|
+
// Invia il form principale
|
41
|
+
console.log("Send main form");
|
42
|
+
$("#send").click();
|
43
|
+
prevent = true;
|
44
|
+
} else if (valid) { // if (event.target.id != "barcode")
|
31
45
|
// Scrivilo nell'input field (accumulando)
|
32
|
-
|
33
|
-
// Otherwise well get duplicate keystrokes
|
46
|
+
console.log("Write to the field");
|
34
47
|
$("#barcode").val(function (index, val) {
|
35
48
|
// Write
|
36
49
|
return val + event.key;
|
37
50
|
});
|
51
|
+
prevent = true;
|
52
|
+
}
|
53
|
+
|
54
|
+
if (prevent) {
|
55
|
+
event.stopPropagation();
|
56
|
+
event.preventDefault();
|
38
57
|
}
|
39
|
-
event.stopPropagation();
|
40
|
-
event.preventDefault();
|
41
58
|
}
|
42
59
|
|
43
|
-
function enableKSCapture(){
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
function disableKSCapture(){
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
60
|
+
// function enableKSCapture(){
|
61
|
+
// console.log("Enabling keypress capture");
|
62
|
+
// $(document).off(kpMode, manageScannedKeystrokes);
|
63
|
+
// $(document).on(kpMode, manageScannedKeystrokes);
|
64
|
+
// $("#barcode").off(kpMode, manageScannedKeystrokes);
|
65
|
+
// }
|
66
|
+
// function disableKSCapture(){
|
67
|
+
// console.log("Disabling keypress capture");
|
68
|
+
// $(document).off(kpMode, manageScannedKeystrokes);
|
69
|
+
// $("#barcode").off(kpMode, manageScannedKeystrokes);
|
70
|
+
// $("#barcode").on(kpMode, manageScannedKeystrokes);
|
71
|
+
// }
|
55
72
|
|
56
|
-
function startKSCapture() {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}
|
73
|
+
// function startKSCapture() {
|
74
|
+
// enableKSCapture();
|
75
|
+
// // Se $("#barcode") si becca il focus, elimino il keypress
|
76
|
+
// // $("#barcode").focusin(disableKSCapture);
|
77
|
+
// // $("#barcode").focusout(enableKSCapture);
|
78
|
+
// }
|
62
79
|
|
63
80
|
// $("#send").focus();
|
64
81
|
// Init
|
@@ -70,6 +87,7 @@
|
|
70
87
|
<%-if (start_disabled rescue false)%>
|
71
88
|
disableKSCapture();
|
72
89
|
<%-else%>
|
73
|
-
|
90
|
+
$(window).on('keydown', manageScannedKeystrokes);
|
91
|
+
// startKSCapture();
|
74
92
|
<%-end%>
|
75
93
|
</script>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_dataentry_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_settings
|