ソースを参照

Merge branch 'dev'

Robin Herbots 13 年 前
コミット
765618f896
2 ファイル変更9 行追加4 行削除
  1. 8 3
      jquery.inputmask.extentions.js
  2. 1 1
      jquery.inputmask.js

+ 8 - 3
jquery.inputmask.extentions.js

@@ -3,7 +3,7 @@ Input Mask plugin extentions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 Robin Herbots
 Copyright (c) 2010 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 0.0.3b
+Version: 0.0.3c
 
 
 Optional extentions on the jquery.inputmask base
 Optional extentions on the jquery.inputmask base
 */
 */
@@ -284,14 +284,19 @@ Optional extentions on the jquery.inputmask base
                             placeholder: "",
                             placeholder: "",
                             repeat: 10,
                             repeat: 10,
                             greedy: false,
                             greedy: false,
+                            numericInput: true, //true => not working fixme
                             regex: {
                             regex: {
                                 number: function(radixPoint, digits) { return new RegExp("^([\+\-]?[0-9]*[" + radixPoint + "]?[0-9]" + digits + ")$"); }
                                 number: function(radixPoint, digits) { return new RegExp("^([\+\-]?[0-9]*[" + radixPoint + "]?[0-9]" + digits + ")$"); }
                             },
                             },
                             definitions: {
                             definitions: {
                                 '~': { //real number
                                 '~': { //real number
                                     validator: function(chrs, buffer, pos, strict, opts) {
                                     validator: function(chrs, buffer, pos, strict, opts) {
-                                        function digitExpression() { return opts.digits; } //enhance me
-                                        var bufferStr = buffer.slice().splice(pos, 0, chrs).join('');
+                                        function digitExpression() {
+                                            return isNaN(opts.digits) ? opts.digits : '{0,' + opts.digits + '}';
+                                        }
+                                        var cbuf = buffer.slice(0, pos + 1);
+                                        cbuf[pos + 1] = chrs;
+                                        var bufferStr = cbuf.join('');
                                         var isValid = opts.regex.number(opts.radixPoint, digitExpression()).test(bufferStr);
                                         var isValid = opts.regex.number(opts.radixPoint, digitExpression()).test(bufferStr);
                                         if (!strict && !isValid) {
                                         if (!strict && !isValid) {
                                             //todo grouping, radixpoint handling
                                             //todo grouping, radixpoint handling

+ 1 - 1
jquery.inputmask.js

@@ -840,7 +840,7 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                                 prepareBuffer(buffer, p, isRTL);
                                 prepareBuffer(buffer, p, isRTL);
                                 if ((np = isValid(p, c, buffer, false)) !== false) {
                                 if ((np = isValid(p, c, buffer, false)) !== false) {
                                     if (np !== true) p = np; //set new position from isValid
                                     if (np !== true) p = np; //set new position from isValid
-                                    if (opts.insertMode == true) shiftR(p, maskL, c); else setBufferElement(buffer, p, c);
+                                    if (opts.insertMode == true) shiftR(p, buffer.length, c); else setBufferElement(buffer, p, c);
                                     var next = seekNext(buffer, p);
                                     var next = seekNext(buffer, p);
                                     writeBuffer(input, buffer, next);
                                     writeBuffer(input, buffer, next);