autonumeric-rails 1.9.43 → 1.9.46

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
  SHA1:
3
- metadata.gz: 9ed549bef320d06305343a6e57f2fc1d49092eea
4
- data.tar.gz: 785838c92068d1cc922ac4afc68e15509b54843e
3
+ metadata.gz: c1a8f7f176d03de69a9501a4827cc3cf13a252fd
4
+ data.tar.gz: '0480bab9a721cf7fbbaee10171299541dcd2ddd2'
5
5
  SHA512:
6
- metadata.gz: 37e5cc8999fe10f3cbec6a598f516a901215e9139ae0e9c8d5076d4999b8708e971e7045186e818ecc3b43143185488d50620ad24e21131baa3975dda7bacc61
7
- data.tar.gz: e537770091e2a11bc4ed0bdf94863655f8b2bf12bf2972c9195d07d802dd0cc80acc108ebafb28cd345e844624d025d52a42dd039656ae8615a35dab0e62aacf
6
+ metadata.gz: 74aacc1cbc12c1e6a37a41aa1fd0b456c137f34943dcc4373ec51e6ccceb3a61618f7d4f99d133094883e23d98960bb66417e5800f6f6c718d3a0d42dcf065c2
7
+ data.tar.gz: 9e863c03107d2934cf7ee1600386dfe9cf8c25cc6857db539deae4e0114fb4fdc7877c471303a0e8de7c36caf082352921a01f7b10dd74d0dfa4a81dd552c32c
@@ -1,3 +1,7 @@
1
+ ### 1.9.46
2
+
3
+ - Update autoNumeric v 1.9.46
4
+
1
5
  ### 1.9.43
2
6
 
3
7
  - Update autoNumeric v 1.9.43
data/README.md CHANGED
@@ -53,7 +53,7 @@ See [autoNumeric page](https://github.com/BobKnothe/autoNumeric) for all details
53
53
  ## AJAX
54
54
 
55
55
  autonumeric-rails looks for `ajaxComplete` events which are trigger by jQuery every time an Ajax request finishes.
56
- As a result, rails-ujs elements (i.e. `data-remote` elements) now automatically initialize autonumeric fields after the AJAX request is complete.
56
+ As a result, rails-ujs elements (i.e. `data-remote` elements) automatically initialize autonumeric fields after the AJAX request is complete.
57
57
 
58
58
  ## Javascript DOM manipulation
59
59
 
@@ -78,7 +78,7 @@ AutonumericRails.delete_autonumeric_object(element);
78
78
  ## Internal
79
79
 
80
80
  Autonumeric-rails creates in the DOM an hidden input with the same name as the text field.
81
- On each modification of the text field value (on `keyup` and `blue` events), the hidden input is updated with the sanitized value.
81
+ On each modification of the text field value (on `keyup` and `blur` events), the hidden input is updated with the sanitized value.
82
82
  When validating the form, the hidden field value is sent to the server as it is located after the text field in the DOM.
83
83
 
84
84
  ## Changes
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'rspec-html-matchers'
29
29
  spec.add_development_dependency 'database_cleaner'
30
30
  spec.add_development_dependency 'capybara'
31
- spec.add_development_dependency 'selenium-webdriver'
31
+ spec.add_development_dependency 'selenium-webdriver', '2.53.4'
32
32
  spec.add_development_dependency 'headless'
33
33
  end
@@ -1,5 +1,5 @@
1
1
  module Autonumeric
2
2
  module Rails
3
- VERSION = '1.9.43'
3
+ VERSION = '1.9.46'
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+ ../../spec
@@ -2,7 +2,7 @@
2
2
  * autoNumeric.js
3
3
  * @author: Bob Knothe
4
4
  * @author: Sokolov Yura
5
- * @version: 1.9.43 - 2015-12-19 GMT 4:00 PM / 16:00
5
+ * @version: 1.9.46 - 2016-09-11 GMT 10:00 PM / 22:00
6
6
  *
7
7
  * Created by Robert J. Knothe on 2010-10-25. Please report any bugs to https://github.com/BobKnothe/autoNumeric
8
8
  * Contributor by Sokolov Yura on 2010-11-07
@@ -880,8 +880,10 @@
880
880
  position -= settingsClone.aSign.length;
881
881
  }
882
882
  }
883
- this.that.value = value;
884
- this.setPosition(position);
883
+ if (this.that.value !== value) {
884
+ this.that.value = value;
885
+ this.setPosition(position);
886
+ }
885
887
  this.formatted = true;
886
888
  }
887
889
  };
@@ -1036,7 +1038,8 @@
1036
1038
  $this.on('keyup.autoNumeric', function (e) {
1037
1039
  holder = getHolder($this);
1038
1040
  holder.init(e);
1039
- var skip = holder.skipAllways(e);
1041
+ var skip = holder.skipAllways(e),
1042
+ tab = holder.kdCode;
1040
1043
  holder.kdCode = 0;
1041
1044
  delete holder.valuePartsBeforePaste;
1042
1045
  if ($this[0].value === holder.settings.aSign) { /** added to properly place the caret when only the currency is present */
@@ -1045,6 +1048,8 @@
1045
1048
  } else {
1046
1049
  setElementSelection(this, holder.settings.aSign.length, holder.settings.aSign.length);
1047
1050
  }
1051
+ } else if (tab === 9) {
1052
+ setElementSelection(this, 0, $this.val().length);
1048
1053
  }
1049
1054
  if (skip) {
1050
1055
  return true;
@@ -1113,8 +1118,8 @@
1113
1118
  destroy: function () {
1114
1119
  return $(this).each(function () {
1115
1120
  var $this = $(this);
1116
- $this.off('.autoNumeric');
1117
1121
  $this.removeData('autoNumeric');
1122
+ $this.off('.autoNumeric');
1118
1123
  });
1119
1124
  },
1120
1125
 
@@ -1151,7 +1156,7 @@
1151
1156
  * must contain only numbers and one decimal (period) character
1152
1157
  */
1153
1158
  set: function (valueIn) {
1154
- if (valueIn === null) {
1159
+ if (valueIn === null || isNaN(valueIn)) {
1155
1160
  return;
1156
1161
  }
1157
1162
  return $(this).each(function () {
@@ -2,7 +2,7 @@
2
2
  * autoNumeric.js
3
3
  * @author: Bob Knothe
4
4
  * @contributor: Sokolov Yura
5
- * @version: 2.0-beta - 2015-12-19 GMT 4:00 PM / 16:00
5
+ * @version: 2.0-beta - 2016-09-11 GMT 10:00 PM / 22:00
6
6
  *
7
7
  * Created by Robert J. Knothe on 2009-08-09. Please report any bugs to https://github.com/BobKnothe/autoNumeric
8
8
  *
@@ -50,6 +50,7 @@
50
50
  /**
51
51
  * Cross browser routine for getting selected range/cursor position
52
52
  */
53
+
53
54
  function getElementSelection(that) {
54
55
  var position = {};
55
56
  if (that.selectionStart === undefined) {
@@ -70,6 +71,7 @@
70
71
  /**
71
72
  * Cross browser routine for setting selected range/cursor position
72
73
  */
74
+
73
75
  function setElementSelection(that, start, end) {
74
76
  if (that.selectionStart === undefined) {
75
77
  that.focus();
@@ -87,6 +89,7 @@
87
89
  /**
88
90
  * Function to handle errors messages
89
91
  */
92
+
90
93
  function throwErr(message, debug) {
91
94
  if (debug) {
92
95
  var err = new Error(message);
@@ -100,6 +103,7 @@
100
103
  * - a function, which invoked with jQuery element, parameters and this parameter name and returns parameter value
101
104
  * - a name of function, attached to $(selector).autoNumeric.functionName(){} - which was called previously
102
105
  */
106
+
103
107
  function runCallbacks($this, settings) {
104
108
  /**
105
109
  * loops through the settings object (option array) to find the following
@@ -122,6 +126,7 @@
122
126
  * Preparing user defined options for further usage
123
127
  * merge them with defaults appropriately
124
128
  */
129
+
125
130
  function autoCode($this, settings) {
126
131
  runCallbacks($this, settings);
127
132
  var vmax = settings.vMax.toString().split('.'),
@@ -167,6 +172,7 @@
167
172
  /**
168
173
  * strip all unwanted characters and leave only a number alert
169
174
  */
175
+
170
176
  function autoStrip(s, settings) {
171
177
  if (settings.aSign !== '') { /** remove currency sign */
172
178
  s = s.replace(settings.aSign, '');
@@ -214,6 +220,7 @@
214
220
  /**
215
221
  * places or removes brackets on negative values
216
222
  */
223
+
217
224
  function negativeBracket(s, settings) {
218
225
  if ((settings.pSign === 'p' && settings.pNeg === 'l') || (settings.pSign === 's' && settings.pNeg === 'p')) {
219
226
  var brackets = settings.nBracket.split(',');
@@ -238,6 +245,7 @@
238
245
  * '-1234,56' OK
239
246
  * '1234,56-' OK
240
247
  */
248
+
241
249
  function convertLocale(s) {
242
250
  s = s.replace(',', '.');
243
251
  if (s.lastIndexOf('-') !== -1 && s.lastIndexOf('-') === s.length - 1) {
@@ -250,6 +258,7 @@
250
258
  /**
251
259
  * prepare number string to be converted to real number
252
260
  */
261
+
253
262
  function fixNumber(s, aDec, aNeg) {
254
263
  if (aDec && aDec !== '.') {
255
264
  s = s.replace(aDec, '.');
@@ -266,6 +275,7 @@
266
275
  /**
267
276
  * prepare real number to be converted to our format
268
277
  */
278
+
269
279
  function presentNumber(s, aDec, aNeg) {
270
280
  if (aNeg && aNeg !== '-') {
271
281
  s = s.replace('-', aNeg);
@@ -279,6 +289,7 @@
279
289
  /**
280
290
  * private function to check for empty value
281
291
  */
292
+
282
293
  function checkEmpty(iv, settings, signOnEmpty) {
283
294
  if (iv === '' || iv === settings.aNeg) {
284
295
  if (settings.wEmpty === 'always' || signOnEmpty) {
@@ -298,10 +309,7 @@
298
309
  iv = '-' + iv;
299
310
  }
300
311
  var empty = checkEmpty(iv, settings, true),
301
- isNeg = iv.replace(',', '.') < 0;
302
- if (iv.indexOf('-') > -1 && Number(iv) === 0) {
303
- isNeg = true;
304
- }
312
+ isNeg = iv.indexOf('-') > -1;
305
313
  if (isNeg) {
306
314
  iv = iv.replace('-', '');
307
315
  }
@@ -347,7 +355,7 @@
347
355
  if (isNeg && settings.pNeg === 's') {
348
356
  iv = settings.aSign + iv + settings.aNeg;
349
357
  }
350
- if (!isNeg && !settings.trailingNegative) {
358
+ if (!isNeg) {
351
359
  iv = settings.aSign + iv;
352
360
  }
353
361
  }
@@ -378,6 +386,7 @@
378
386
  * please note this handled as text - JavaScript math function can return inaccurate values
379
387
  * also this offers multiple rounding methods that are not easily accomplished in JavaScript
380
388
  */
389
+
381
390
  function autoRound(iv, settings) { /** value to string */
382
391
  iv = (iv === '') ? '0' : iv.toString();
383
392
  if (settings.mRound === 'N05' || settings.mRound === 'U05' || settings.mRound === 'D05') {
@@ -387,7 +396,7 @@
387
396
  var ivRounded = '',
388
397
  i = 0,
389
398
  nSign = '',
390
- rDec = (typeof (settings.aPad) === 'boolean' || settings.aPad === null) ? (settings.aPad ? settings.mDec : 0) : Number(settings.aPad);
399
+ rDec = (typeof(settings.aPad) === 'boolean' || settings.aPad === null) ? (settings.aPad ? settings.mDec : 0) : Number(settings.aPad);
391
400
  var truncateZeros = function (ivRounded) { /** truncate not needed zeros */
392
401
  var regex = rDec === 0 ? (/(\.(?:\d*[1-9])?)0*$/) : rDec === 1 ? (/(\.\d(?:\d*[1-9])?)0*$/) : new RegExp('(\\.\\d{' + rDec + '}(?:\\d*[1-9])?)0*');
393
402
  ivRounded = ivRounded.replace(regex, '$1'); /** If there are no decimal places, we don't need a decimal point at the end */
@@ -471,6 +480,7 @@
471
480
  /**
472
481
  * truncate decimal part of a number
473
482
  */
483
+
474
484
  function truncateDecimal(s, settings, paste) {
475
485
  var aDec = settings.aDec,
476
486
  mDec = settings.mDec;
@@ -497,6 +507,7 @@
497
507
  * This function is adapted from Big.js https://github.com/MikeMcl/big.js/
498
508
  * Many thanks to Mike
499
509
  */
510
+
500
511
  function parseStr(n) {
501
512
  var x = {},
502
513
  e,
@@ -555,6 +566,7 @@
555
566
  * This function is adapted from Big.js https://github.com/MikeMcl/big.js/
556
567
  * Many thanks to Mike
557
568
  */
569
+
558
570
  function testMinMax(y, x) {
559
571
  var xNeg,
560
572
  xc = x.c,
@@ -595,7 +607,9 @@
595
607
  * and lays between settings.vMin and settings.vMax
596
608
  * and the string length does not exceed the digits in settings.vMin and settings.vMax
597
609
  */
610
+
598
611
  function autoCheck(s, settings) {
612
+ s = s.toString();
599
613
  s = s.replace(',', '.');
600
614
  var minParse = parseStr(settings.vMin),
601
615
  maxParse = parseStr(settings.vMax),
@@ -606,6 +620,7 @@
606
620
  /**
607
621
  * Holder object for field properties
608
622
  */
623
+
609
624
  function AutoNumericHolder(that, settings) {
610
625
  this.settings = settings;
611
626
  this.that = that;
@@ -799,9 +814,9 @@
799
814
  var valueLen = this.that.value.length,
800
815
  aSignLen = this.settings.aSign.length,
801
816
  negLen = (this.that.value.indexOf('-') === -1) ? 0 : 1,
802
- aSuffixLen = this.settings.aSuffix.length,
817
+ aSuffixLen = this.settings.aSuffix.length,
803
818
  pSign = this.settings.pSign,
804
- pNeg = this.settings.pNeg,
819
+ pNeg = this.settings.pNeg,
805
820
  start = (pSign === 's') ? 0 : (pNeg === 'l' && negLen === 1 && aSignLen > 0) ? aSignLen + 1 : aSignLen,
806
821
  end = (pSign === 'p') ? valueLen - aSuffixLen : (pNeg === 'l') ? valueLen - (aSuffixLen + aSignLen) : (pNeg === 'r') ? (aSignLen > 0) ? valueLen - (aSignLen + negLen + aSuffixLen) : valueLen - (aSignLen + aSuffixLen) : valueLen - (aSignLen + aSuffixLen);
807
822
  setElementSelection(this.that, start, end);
@@ -870,7 +885,7 @@
870
885
  }
871
886
  }
872
887
  if (settingsClone.pSign === 's' && settingsClone.pNeg === 'l') {
873
- settingsClone.caretFix = (this.selection.start >= this.value.indexOf(settingsClone.aNeg) + settingsClone.aNeg.length) ? true : false;
888
+ settingsClone.caretFix = (this.selection.start >= this.value.indexOf(settingsClone.aNeg) + settingsClone.aNeg.length) ? true : false;
874
889
  if (this.kdCode === 8) {
875
890
  if (this.selection.start === (this.value.indexOf(settingsClone.aNeg) + settingsClone.aNeg.length) && this.value.indexOf(settingsClone.aNeg) !== -1) {
876
891
  parts[0] = parts[0].substring(1);
@@ -887,7 +902,7 @@
887
902
  }
888
903
  }
889
904
  if (settingsClone.pSign === 's' && settingsClone.pNeg === 'r') {
890
- settingsClone.caretFix = (this.selection.start >= this.value.indexOf(settingsClone.aNeg) + settingsClone.aNeg.length) ? true : false;
905
+ settingsClone.caretFix = (this.selection.start >= this.value.indexOf(settingsClone.aNeg) + settingsClone.aNeg.length) ? true : false;
891
906
  if (this.kdCode === 8) {
892
907
  if (this.selection.start === (this.value.indexOf(settingsClone.aNeg) + settingsClone.aNeg.length)) {
893
908
  parts[0] = parts[0].substring(1);
@@ -920,7 +935,7 @@
920
935
  if (parts[0] === '' && parts[1] === '') {
921
936
  settingsClone.throwInput = false;
922
937
  }
923
- if ((settingsClone.pSign === 'p' && settingsClone.pNeg === 's') || (settingsClone.pSign === 's' && settingsClone.pNeg !== 'p')) {
938
+ if (((settingsClone.pSign === 'p' && settingsClone.pNeg === 's') || (settingsClone.pSign === 's' && (settingsClone.pNeg === 'l' || settingsClone.pNeg === 'r'))) && this.value.indexOf('-') !== -1) {
924
939
  parts = this.processTrailing(parts);
925
940
  } else {
926
941
  if (this.kdCode === 8) {
@@ -971,7 +986,7 @@
971
986
  this.setValueParts(left + settingsClone.aDec, right, null);
972
987
  return true;
973
988
  }
974
- if (cCode === '-' || cCode === '+') { /** prevent minus if not allowed */
989
+ if ((cCode === '-' || cCode === '+') && settingsClone.aNeg === '-') { /** prevent minus if not allowed ************************************************************************************************************************************/
975
990
  if (!settingsClone) {
976
991
  return true;
977
992
  } /** caret is always after minus */
@@ -1105,8 +1120,10 @@
1105
1120
  }
1106
1121
  }
1107
1122
  }
1108
- this.that.value = value;
1109
- this.setPosition(position);
1123
+ if (this.that.value !== value) {
1124
+ this.that.value = value;
1125
+ this.setPosition(position);
1126
+ }
1110
1127
  this.formatted = true;
1111
1128
  }
1112
1129
  };
@@ -1114,6 +1131,7 @@
1114
1131
  /**
1115
1132
  * thanks to Anthony & Evan C
1116
1133
  */
1134
+
1117
1135
  function autoGet(obj) {
1118
1136
  if (typeof obj === 'string') {
1119
1137
  obj = obj.replace(/\[/g, "\\[").replace(/\]/g, "\\]");
@@ -1128,6 +1146,7 @@
1128
1146
  * function to attach data to the element
1129
1147
  * and imitate the holder
1130
1148
  */
1149
+
1131
1150
  function getHolder($that, settings, update) {
1132
1151
  var data = $that.data('autoNumeric');
1133
1152
  if (!data) {
@@ -1145,6 +1164,7 @@
1145
1164
  /**
1146
1165
  * original settings saved for use when eDec & nSep options are being used
1147
1166
  */
1167
+
1148
1168
  function originalSettings(settings) {
1149
1169
  settings.oDec = settings.mDec;
1150
1170
  settings.oPad = settings.aPad;
@@ -1158,6 +1178,7 @@
1158
1178
  * original settings saved for use when eDec & nSep options are being used
1159
1179
  * taken from Quirksmode
1160
1180
  */
1181
+
1161
1182
  function readCookie(name) {
1162
1183
  var nameEQ = name + "=",
1163
1184
  ca = document.cookie.split(';'),
@@ -1178,6 +1199,7 @@
1178
1199
  /**
1179
1200
  * Test if sessionStorage is supported - taken from moderizr
1180
1201
  */
1202
+
1181
1203
  function storageTest() {
1182
1204
  var mod = 'modernizr';
1183
1205
  try {
@@ -1192,6 +1214,7 @@
1192
1214
  /**
1193
1215
  * creates or removes sessionStorage or cookie depending on browser support
1194
1216
  */
1217
+
1195
1218
  function autoSave($this, settings, toDo) {
1196
1219
  if (settings.aStor) {
1197
1220
  var storedName = ($this[0].name !== '' && $this[0].name !== undefined) ? 'AUTO_' + decodeURIComponent($this[0].name) : 'AUTO_' + $this[0].id;
@@ -1246,7 +1269,7 @@
1246
1269
  /** supported input types*/
1247
1270
  $input = $this.is('input[type=text], input[type=hidden], input[type=tel], input:not([type])');
1248
1271
  $.each(tagData, function (key, value) {
1249
- if (typeof value === 'number') {
1272
+ if (typeof value === 'number') {
1250
1273
  tagData[key] = value.toString();
1251
1274
  }
1252
1275
  });
@@ -1265,7 +1288,7 @@
1265
1288
  throwErr('autoNumeric will not function properly when the decimal character aDec: "' + settings.aDec + '" and thousand separator aSep: "' + settings.aSep + '" are the same character', settings.debug);
1266
1289
  }
1267
1290
  $.each(settings, function (key, value) {
1268
- if (value === 'true' || value === 'false') {
1291
+ if (value === 'true' || value === 'false') {
1269
1292
  settings[key] = (value === 'true') ? true : false;
1270
1293
  }
1271
1294
  });
@@ -1418,7 +1441,8 @@
1418
1441
  $this.on('keyup.autoNumeric', function (e) {
1419
1442
  holder = getHolder($this);
1420
1443
  holder.init(e);
1421
- var skip = holder.skipAllways(e);
1444
+ var skip = holder.skipAllways(e),
1445
+ tab = holder.kdCode;;
1422
1446
  holder.kdCode = 0;
1423
1447
  delete holder.valuePartsBeforePaste;
1424
1448
  if ($this[0].value === holder.settingsClone.aSign) { /** added to properly place the caret when only the currency sign is present */
@@ -1427,6 +1451,8 @@
1427
1451
  } else {
1428
1452
  setElementSelection(this, holder.settingsClone.aSign.length, holder.settingsClone.aSign.length);
1429
1453
  }
1454
+ } else if (tab === 9) {
1455
+ setElementSelection(this, 0, $this.val().length);
1430
1456
  }
1431
1457
  if ($this[0].value === holder.settingsClone.aSuffix) {
1432
1458
  setElementSelection(this, 0, 0);
@@ -1477,8 +1503,7 @@
1477
1503
  value = autoRound(value, $settings);
1478
1504
  value = presentNumber(value, $settings.aDec, $settings.aNeg);
1479
1505
  } else {
1480
- value = '';
1481
- $settings.rawValue = '';
1506
+ value = $settings.rawValue;
1482
1507
  }
1483
1508
  } else {
1484
1509
  $settings.rawValue = '';
@@ -1495,24 +1520,14 @@
1495
1520
  delete holder.inVal;
1496
1521
  }
1497
1522
  });
1498
- $this.on('paste.autoNumeric', function (e) {
1499
- holder = getHolder($this);
1500
- var clipboardData = e.clipboardData || e.originalEvent.clipboardData || window.clipboardData,
1501
- pastedData = clipboardData.getData('text');
1502
- if (pastedData !== holder.lastVal) {
1503
- $this.trigger('input'); /** throws input event on adding character */
1504
- holder.lastVal = window.setTimeout( function() {
1505
- $this.val();
1506
- }, 100);
1507
- }
1508
- });
1509
1523
  $this.closest('form').on('submit.autoNumeric', function () {
1510
1524
  holder = getHolder($this);
1511
- var $settings = holder.settingsClone;
1512
- if ($settings.unSetOnSubmit) {
1513
- $this.val($settings.rawValue);
1525
+ if (holder) {
1526
+ var $settings = holder.settingsClone;
1527
+ if ($settings.unSetOnSubmit) {
1528
+ $this.val($settings.rawValue);
1529
+ }
1514
1530
  }
1515
-
1516
1531
  });
1517
1532
  }
1518
1533
  });
@@ -1530,8 +1545,8 @@
1530
1545
  if (typeof settings === 'object') {
1531
1546
  $this.val('');
1532
1547
  autoSave($this, settings, 'wipe');
1533
- $this.off('.autoNumeric');
1534
1548
  $this.removeData('autoNumeric');
1549
+ $this.off('autoNumeric');
1535
1550
  }
1536
1551
  });
1537
1552
  },
@@ -1588,7 +1603,7 @@
1588
1603
  */
1589
1604
  set: function (valueIn) {
1590
1605
  return $(this).each(function () {
1591
- if (valueIn === null) {
1606
+ if (valueIn === null || isNaN(valueIn)) {
1592
1607
  return;
1593
1608
  }
1594
1609
  var $this = autoGet($(this)),
@@ -1698,7 +1713,7 @@
1698
1713
  if (settings.rawValue !== '') {
1699
1714
  getValue = settings.rawValue;
1700
1715
  }
1701
- if (((!/\d/).test(getValue) || Number(getValue) === 0) && settings.wEmpty === 'focus') {
1716
+ if (!((/\d/).test(getValue) || Number(getValue) === 0) && settings.wEmpty === 'focus') {
1702
1717
  return '';
1703
1718
  }
1704
1719
  if (getValue !== '' && settings.nBracket !== null) {
@@ -1734,10 +1749,14 @@
1734
1749
  formParts = formFields.split('&'),
1735
1750
  formIndex = $('form').index($this),
1736
1751
  allFormElements = $('form:eq(' + formIndex + ')'),
1737
- aiIndex = [], /** all input index */
1738
- scIndex = [], /** successful control index */
1739
- rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, /* from jQuery serialize method */
1740
- rsubmittable = /^(?:input|select|textarea|keygen)/i, /* from jQuery serialize method */
1752
+ aiIndex = [],
1753
+ /** all input index */
1754
+ scIndex = [],
1755
+ /** successful control index */
1756
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
1757
+ /* from jQuery serialize method */
1758
+ rsubmittable = /^(?:input|select|textarea|keygen)/i,
1759
+ /* from jQuery serialize method */
1741
1760
  rcheckableType = /^(?:checkbox|radio)$/i,
1742
1761
  rnonAutoNumericTypes = /^(?:button|checkbox|color|date|datetime|datetime-local|email|file|image|month|number|password|radio|range|reset|search|submit|time|url|week)/i,
1743
1762
  count = 0;
@@ -1794,10 +1813,14 @@
1794
1813
  formFields = $this.serializeArray(),
1795
1814
  formIndex = $('form').index($this),
1796
1815
  allFormElements = $('form:eq(' + formIndex + ')'),
1797
- aiIndex = [], /* all input index */
1798
- scIndex = [], /* successful control index */
1799
- rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, /* from jQuery serialize method */
1800
- rsubmittable = /^(?:input|select|textarea|keygen)/i, /* from jQuery serialize method */
1816
+ aiIndex = [],
1817
+ /* all input index */
1818
+ scIndex = [],
1819
+ /* successful control index */
1820
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
1821
+ /* from jQuery serialize method */
1822
+ rsubmittable = /^(?:input|select|textarea|keygen)/i,
1823
+ /* from jQuery serialize method */
1801
1824
  rcheckableType = /^(?:checkbox|radio)$/i,
1802
1825
  rnonAutoNumericTypes = /^(?:button|checkbox|color|date|datetime|datetime-local|email|file|image|month|number|password|radio|range|reset|search|submit|time|url|week)/i,
1803
1826
  count = 0;
@@ -1,2 +1,2 @@
1
- //= require autoNumeric-1.9.43.js
1
+ //= require autoNumeric-1.9.46.js
2
2
  //= require autonumeric_ujs.js
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autonumeric-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.43
4
+ version: 1.9.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - randoum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-26 00:00:00.000000000 Z
11
+ date: 2016-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails
@@ -140,16 +140,16 @@ dependencies:
140
140
  name: selenium-webdriver
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: 2.53.4
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: 2.53.4
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: headless
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -229,14 +229,15 @@ files:
229
229
  - spec/dummy/public/422.html
230
230
  - spec/dummy/public/500.html
231
231
  - spec/dummy/public/favicon.ico
232
+ - spec/dummy/spec
232
233
  - spec/spec_helper.rb
233
234
  - spec/support/setup_dummy_library.rb
234
235
  - spec/support/shared_examples.rb
235
236
  - spec/support/wait_for_jquery.rb
236
- - vendor/assets/javascripts/autoNumeric-1.9.43.js
237
+ - vendor/assets/javascripts/autoNumeric-1.9.46.js
237
238
  - vendor/assets/javascripts/autoNumeric-2.0-BETA.js
238
239
  - vendor/assets/javascripts/autonumeric.js
239
- - vendor/assets/javascripts/autonumeric2.js
240
+ - vendor/assets/javascripts/autonumeric2.0-beta.js
240
241
  - vendor/assets/javascripts/autonumeric_ujs.js
241
242
  homepage: https://github.com/randoum/autonumeric-rails
242
243
  licenses:
@@ -258,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
259
  version: '0'
259
260
  requirements: []
260
261
  rubyforge_project:
261
- rubygems_version: 2.4.8
262
+ rubygems_version: 2.5.1
262
263
  signing_key:
263
264
  specification_version: 4
264
265
  summary: autoNumeric.js library with an ujs flavor, ready-to-use for rails.