autotab-rails 0.0.3 → 0.0.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
  SHA1:
3
- metadata.gz: 7bb40cdb63fcdad2e1c9e826bc7525453138fc28
4
- data.tar.gz: 582abdf750ecb6740c1c68455b9956d6393a8def
3
+ metadata.gz: 2846f4ea6a0a39a755845a89c21c9b901e5a219c
4
+ data.tar.gz: 8b18509417eb3b7b3f5e6403b072fd9f686e382c
5
5
  SHA512:
6
- metadata.gz: c4b524d2788305422e743c454b367ac47a11d4941fc44c6eeb47741c8d6e56f680138052fe8fae3e10011dfca7f2a0ffe4d5b4b6848cb8b8b69ef9f3ce3806d4
7
- data.tar.gz: e2e85e60d178d8ed4fa8bf903f468a3fbeb765dd9c9e4f3bdf4445c7c26152c7b59898a31e138cd7e6f4c825bacd46e92e568b38e40fffbd02898f432f816013
6
+ metadata.gz: f52884ef649be90eaca86834dce34da1c0cffbaab49630ca9ce927daec0018bb462596ad9375cf8693cce355b3ab3ce9a124b5e94c49413a793f662873be5f46
7
+ data.tar.gz: 004076656d41c26cc61ca5b9eb4bc840e0b333701061466ebe9ff7bfc6e8941d6273341f09e0a54bcff87797df4a28c53dc755da1bca4e26ae8a1d602cc2b992
data/.gitignore CHANGED
@@ -15,4 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- .idea
18
+ .idea/
@@ -15,5 +15,5 @@ when /^3\.[12]/
15
15
  when /^3\.[0]/
16
16
  require 'autotab-rails/railtie'
17
17
  else
18
- raise 'Unsupported rails version'
18
+ raise 'autotab-rails does not supports rails < 3.'
19
19
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module AutoTab
4
4
  module Rails
5
- VERSION = '0.0.3'
6
- AUTO_TAB_VERSION = '1.7.0'
5
+ VERSION = '0.0.4'
6
+ AUTO_TAB_VERSION = '1.8.0'
7
7
  end
8
8
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jquery.autotab",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "A jQuery plugin that provides auto-tabbing and filtering on text fields in a form.",
5
5
  "main": [ "./js/jquery.autotab.min.js" ],
6
6
  "homepage": "https://github.com/Mathachew/jquery-autotab",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Autotab - jQuery plugin 1.7
2
+ * Autotab - jQuery plugin 1.8.0
3
3
  * https://github.com/Mathachew/jquery-autotab
4
4
  *
5
5
  * Copyright (c) 2008, 2014 Matthew Miller
@@ -46,6 +46,19 @@
46
46
  tabOnSelect: false
47
47
  };
48
48
 
49
+ // If $.autotab.selectFilterByClas is true and the format not specified, automatically select an element's format based on a matching class name.
50
+ // The first matched element becomes the selected format for the filter.
51
+ if ($.autotab.selectFilterByClass === true && typeof $(e).data('autotab-format') === 'undefined') {
52
+ var classes = ['all', 'text', 'alpha', 'number', 'numeric', 'alphanumeric', 'hex', 'hexadecimal', 'custom'];
53
+
54
+ for (var key in classes) {
55
+ if ($(e).hasClass(classes[key])) {
56
+ settings.format = classes[key];
57
+ break;
58
+ }
59
+ }
60
+ }
61
+
49
62
  for (var key in settings) {
50
63
  if (typeof $(e).data('autotab-' + key) !== 'undefined') {
51
64
  settings[key] = $(e).data('autotab-' + key);
@@ -76,6 +89,8 @@
76
89
  $(':input').autotab(options);
77
90
  };
78
91
 
92
+ $.autotab.selectFilterByClass = false;
93
+
79
94
  $.autotab.next = function () {
80
95
  var e = $(document.activeElement);
81
96
 
@@ -100,6 +115,10 @@
100
115
  queryObject(e) ? $(e).autotab('restore') : $(':input').autotab('restore');
101
116
  };
102
117
 
118
+ $.autotab.refresh = function (e) {
119
+ queryObject(e) ? $(e).autotab('refresh') : $(':input').autotab('refresh');
120
+ };
121
+
103
122
  $.fn.autotab = function (method, options) {
104
123
  if (!this.length) {
105
124
  return this;
@@ -155,6 +174,61 @@
155
174
  setSettings(filtered[i], defaults);
156
175
  }
157
176
  }
177
+ // Refresh target/previous elements
178
+ else if (method == 'refresh') {
179
+ for (var i = 0, length = filtered.length; i < length; i++) {
180
+ var defaults = getSettings(filtered[i]),
181
+ n = i + 1,
182
+ p = i - 1;
183
+
184
+ // No selector was specified, so automatically set the target
185
+ if (defaults.target === null || typeof defaults.target === 'undefined' || defaults.target.selector === '') {
186
+ if (i > 0 && n < length) {
187
+ defaults.target = filtered[n];
188
+ }
189
+ else if (i > 0) {
190
+ defaults.target = null;
191
+ }
192
+ else {
193
+ defaults.target = filtered[n];
194
+ }
195
+ }
196
+ else {
197
+ console.log('target selector!');
198
+ }
199
+
200
+ // No selector was specified, so automatically set the previous
201
+ if (defaults.previous === null || typeof defaults.previous === 'undefined' || defaults.previous.selector === '') {
202
+ if (i > 0 && n < length) {
203
+ defaults.previous = filtered[p];
204
+ }
205
+ else if (i > 0) {
206
+ defaults.previous = filtered[p];
207
+ }
208
+ else {
209
+ defaults.previous = null;
210
+ }
211
+ }
212
+ else {
213
+ console.log('previous selector!');
214
+ }
215
+
216
+ if (!defaults.loaded) {
217
+ autotabBind(filtered[i], defaults);
218
+ }
219
+ else {
220
+ if (queryObject(defaults.target)) {
221
+ defaults.target = $(defaults.target);
222
+ }
223
+
224
+ if (queryObject(defaults.previous)) {
225
+ defaults.previous = $(defaults.previous);
226
+ }
227
+
228
+ setSettings(filtered[i], defaults);
229
+ }
230
+ }
231
+ }
158
232
  else {
159
233
  if (method === null || typeof method === 'undefined') {
160
234
  options = {};
@@ -331,8 +405,8 @@
331
405
  // Using focus on iOS devices is a pain, so use the browser's next/previous buttons to proceed
332
406
  if (!settings.iOS) {
333
407
 
334
- // Field is disabled, so tab to next element
335
- if (target.prop('disabled')) {
408
+ // Field is disabled/readonly, so tab to next element
409
+ if (target.prop('disabled') || target.prop('readonly')) {
336
410
  target.trigger('autotab-next');
337
411
  }
338
412
  else {
@@ -355,8 +429,8 @@
355
429
  if (!defaults.disabled && previous.length) {
356
430
  var value = previous.val();
357
431
 
358
- // Field is disabled, so tab to previous element
359
- if (previous.prop('disabled')) {
432
+ // Field is disabled/readonly, so tab to previous element
433
+ if (previous.prop('disabled') || previous.prop('readonly')) {
360
434
  previous.trigger('autotab-previous');
361
435
  }
362
436
  else if (value.length && previous.data('autotab-editable')) {
@@ -391,17 +465,18 @@
391
465
  // Go to the previous element when backspace
392
466
  // is pressed in an empty input field
393
467
  if (keyCode == 8) {
394
- if (!defaults.editable || this.value.length === 0) {
468
+ // Prevent the browser from of navigating to the previous page
469
+ if (this.type === 'select-one' || this.type === 'checkbox' || this.type === 'radio' || this.type === 'button' || this.type === 'submit' || this.type === 'range') {
395
470
  $(this).trigger('autotab-previous', defaults);
396
-
397
- // Prevent the browser from of navigating to the previous page
398
- if (!defaults.editable) {
399
- return false;
400
- }
471
+ return false;
401
472
  }
402
- else {
403
- setSettings(this, { changed: (this.value != defaults.originalValue) });
473
+
474
+ if (this.value.length === 0) {
475
+ $(this).trigger('autotab-previous', defaults);
476
+ return;
404
477
  }
478
+
479
+ setSettings(this, { changed: (this.value !== defaults.originalValue) });
405
480
  }
406
481
  else if (keyCode == 9 && settings.focusChange !== null) {
407
482
  // Tab backwards
@@ -525,6 +600,7 @@
525
600
  hiddenInput = document.createElement('input');
526
601
  hiddenInput.type = 'hidden';
527
602
  hiddenInput.value = e.value.toLowerCase();
603
+ hiddenInput.originalValue = e.value;
528
604
 
529
605
  e.maxLength = originDefaults.maxlength;
530
606
  e.value = filterValue(e, e.value, originDefaults).substr(0, originDefaults.maxlength);
@@ -534,12 +610,22 @@
534
610
  return;
535
611
  }
536
612
 
613
+ var defaults = getSettings(e);
614
+
615
+ if ($(e).prop('disabled') || $(e).prop('readonly')) {
616
+ $(e).trigger('autotab-next');
617
+
618
+ if (!settings.iOS) {
619
+ handlePaste(defaults.target[0], previousValue);
620
+ }
621
+ return;
622
+ }
623
+
537
624
  for (var i = 0, count = previousValue.length; i < count; i++) {
538
- lastIndex = hiddenInput.value.indexOf(previousValue.charAt(i), lastIndex) + 1;
625
+ lastIndex = hiddenInput.value.indexOf(previousValue.charAt(i).toLowerCase(), lastIndex) + 1;
539
626
  }
540
627
 
541
- var defaults = getSettings(e),
542
- trimmedValue = hiddenInput.value.substr(lastIndex),
628
+ var trimmedValue = hiddenInput.originalValue.substr(lastIndex),
543
629
  filteredValue = filterValue(e, trimmedValue, defaults).substr(0, defaults.maxlength);
544
630
 
545
631
  if (!filteredValue) {
@@ -573,7 +659,7 @@
573
659
 
574
660
  // Deprecated, here for backwards compatibility
575
661
  $.fn.autotab_magic = function (focus) {
576
- $(this).autotab();
662
+ return $(this).autotab();
577
663
  };
578
664
  $.fn.autotab_filter = function (options) {
579
665
  var defaults = {};
@@ -585,7 +671,7 @@
585
671
  $.extend(defaults, options);
586
672
  }
587
673
 
588
- $(this).autotab('filter', defaults);
674
+ return $(this).autotab('filter', defaults);
589
675
  };
590
676
 
591
677
  })(jQuery);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Autotab - jQuery plugin 1.7
2
+ * Autotab - jQuery plugin 1.8.0
3
3
  * https://github.com/Mathachew/jquery-autotab
4
4
  *
5
5
  * Copyright (c) 2008, 2014 Matthew Miller
@@ -8,16 +8,19 @@
8
8
  * http://www.opensource.org/licenses/mit-license.php
9
9
  */
10
10
 
11
- (function(e){var q=navigator.platform,k=null,r="iPad"===q||"iPhone"===q||"iPod"===q,v="undefined"!==typeof InstallTrigger,g=function(a,c){if(null!==c&&"undefined"!==typeof c)for(var b in c)e(a).data("autotab-"+b,c[b])},l=function(a){var c={format:"all",loaded:!1,disabled:!1,pattern:null,uppercase:!1,lowercase:!1,nospace:!1,maxlength:2147483647,target:null,previous:null,trigger:null,originalValue:"",changed:!1,editable:"text"==a.type||"password"==a.type||"textarea"==a.type,tabOnSelect:!1},b;for(b in c)"undefined"!==
12
- typeof e(a).data("autotab-"+b)&&(c[b]=e(a).data("autotab-"+b));c.loaded||(null!==c.trigger&&"string"===typeof c.trigger&&(c.trigger=c.trigger.toString()),g(a,c));return c},p=function(a){return"undefined"!==typeof a&&("string"===typeof a||!(a instanceof jQuery))};e.autotab=function(a){"object"!==typeof a&&(a={});e(":input").autotab(a)};e.autotab.next=function(){var a=e(document.activeElement);a.length&&a.trigger("autotab-next")};e.autotab.previous=function(){var a=e(document.activeElement);a.length&&
13
- a.trigger("autotab-previous")};e.autotab.remove=function(a){p(a)?e(a).autotab("remove"):e(":input").autotab("remove")};e.autotab.restore=function(a){p(a)?e(a).autotab("restore"):e(":input").autotab("restore")};e.fn.autotab=function(a,c){if(!this.length)return this;var b=e.grep(this,function(a,b){return"hidden"!=a.type});if("filter"==a){if("string"===typeof c||"function"===typeof c)c={format:c};for(var d=0,n=b.length;d<n;d++){var f=l(b[d]),h=c;h.target=f.target;h.previous=f.previous;e.extend(f,h);
14
- f.loaded?g(b[d],f):(f.disabled=!0,s(b[d],h))}}else if("remove"==a||"destroy"==a||"disable"==a)for(d=0,n=b.length;d<n;d++)f=l(b[d]),f.disabled=!0,g(b[d],f);else if("restore"==a||"enable"==a)for(d=0,n=b.length;d<n;d++)f=l(b[d]),f.disabled=!1,g(b[d],f);else if(null===a||"undefined"===typeof a?c={}:"string"===typeof a||"function"===typeof a?c={format:a}:"object"===typeof a&&(c=a),1<b.length)for(d=0,n=b.length;d<n;d++){var f=d+1,u=d-1,h=c;0<d&&f<n?(h.target=b[f],h.previous=b[u]):0<d?(h.target=null,h.previous=
15
- b[u]):(h.target=b[f],h.previous=null);s(b[d],h)}else s(b[0],c);return this};var t=function(a,c,b){if("function"===typeof b.format)return b.format(c,a);a=null;switch(b.format){case "text":a=RegExp("[0-9]+","g");break;case "alpha":a=RegExp("[^a-zA-Z]+","g");break;case "number":case "numeric":a=RegExp("[^0-9]+","g");break;case "alphanumeric":a=RegExp("[^0-9a-zA-Z]+","g");break;case "hex":case "hexadecimal":a=RegExp("[^0-9A-Fa-f]+","g");break;case "custom":a=new RegExp(b.pattern,"g")}null!==a&&(c=c.replace(a,
16
- ""));b.nospace&&(a=RegExp("[ ]+","g"),c=c.replace(a,""));b.uppercase&&(c=c.toUpperCase());b.lowercase&&(c=c.toLowerCase());return c},s=function(a,c){var b=l(a);b.disabled&&(b.disabled=!1,b.target=null,b.previous=null);e.extend(b,c);p(b.target)&&(b.target=e(b.target));p(b.previous)&&(b.previous=e(b.previous));var d=a.maxLength;"undefined"===typeof a.maxLength&&"textarea"==a.type&&(d=a.maxLength=a.getAttribute("maxlength"));2147483647==b.maxlength&&2147483647!=d&&-1!=d?b.maxlength=d:0<b.maxlength?a.maxLength=
17
- b.maxlength:b.target=null;if(b.loaded)g(a,b);else{b.loaded=!0;g(a,b);if("select-one"==a.type)e(a).on("change",function(a){l(this).tabOnSelect&&e(this).trigger("autotab-next")});e(a).on("autotab-next",function(a,b){var h=this;setTimeout(function(){b||(b=l(h));var a=b.target;b.disabled||!a.length||r||(a.prop("disabled")?a.trigger("autotab-next"):a.focus().select(),k=new Date)},1)}).on("autotab-previous",function(a,b){var h=this;setTimeout(function(){b||(b=l(h));var a=b.previous;if(!b.disabled&&a.length){var c=
18
- a.val();a.prop("disabled")?a.trigger("autotab-previous"):c.length&&a.data("autotab-editable")?(a.focus().val(c.substring(0,c.length-1)),g(a,{changed:!0})):a.focus();k=null}},1)}).on("focus",function(){g(this,{originalValue:this.value})}).on("blur",function(){var a=l(this);a.changed&&this.value!=a.originalValue&&(g(this,{changed:!1}),e(this).change())}).on("keydown",function(a){var b=l(this);if(!b||b.disabled)return!0;var c=a.which||a.charCode;if(8==c)if(b.editable&&0!==this.value.length)g(this,{changed:this.value!=
19
- b.originalValue});else{if(e(this).trigger("autotab-previous",b),!b.editable)return!1}else if(9==c&&null!==k)if(a.shiftKey)k=null;else if(800>(new Date).getTime()-k.getTime())return k=null,!1}).on("keypress",function(a){var b=l(this),c=a.which||a.keyCode;if(!b||b.disabled||v&&0===a.charCode||a.ctrlKey||a.altKey||13==c||"text"!=this.type&&"password"!=this.type&&"textarea"!=this.type||this.disabled)return!0;c=String.fromCharCode(c);if(null!==b.trigger&&0<=b.trigger.indexOf(c))return null!==k&&800>(new Date).getTime()-
20
- k.getTime()?k=null:e(this).trigger("autotab-next",b),!1;k=null;a=document.selection&&document.selection.createRange?!0:0<a.charCode;c=t(this,c,b);if(a&&(null===c||""===c))return!1;if(a&&this.value.length<=this.maxLength){var d,m;a=0;if("number"===typeof this.selectionStart&&"number"===typeof this.selectionEnd)d=this.selectionStart,m=this.selectionEnd,a=1;else if(document.selection&&document.selection.createRange){m=document.selection.createRange();d=this.createTextRange();a=this.createTextRange();
21
- var w=m.getBookmark();d.moveToBookmark(w);a.setEndPoint("EndToStart",d);d=a.text.length;m=d+m.text.length;a=2}if(0===d&&m==this.value.length)this.value=c;else{if(this.value.length==this.maxLength&&d===m)return e(this).trigger("autotab-next",b),!1;this.value=this.value.slice(0,d)+c+this.value.slice(m)}g(this,{changed:this.value!=b.originalValue});this.value.length!=b.maxlength&&(d++,1==a?this.selectionStart=this.selectionEnd=d:2==a&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",d),
22
- c.moveStart("character",d),c.select()))}this.value.length==b.maxlength&&e(this).trigger("autotab-next",b);return!1}).on("paste",function(a){var b=l(this);if(!b)return!0;this.maxLength=2147483647;(function(a,c){setTimeout(function(){var d=-1,g=document.createElement("input");g.type="hidden";g.value=a.value.toLowerCase();a.maxLength=c.maxlength;a.value=t(a,a.value,c).substr(0,c.maxlength);var k=function(a,b){if(a){for(var c=0,f=b.length;c<f;c++)d=g.value.indexOf(b.charAt(c),d)+1;c=l(a);f=g.value.substr(d);
23
- (f=t(a,f,c).substr(0,c.maxlength))?(a.value=f,f.length==c.maxlength&&(e(a).trigger("autotab-next",c),r||k(c.target[0],f))):a.value=""}};a.value.length==c.maxlength&&(e(a).trigger("autotab-next",b),r||k(c.target[0],a.value.toLowerCase()))},1)})(this,b)})}};e.fn.autotab_magic=function(a){e(this).autotab()};e.fn.autotab_filter=function(a){var c={};"string"===typeof a||"function"===typeof a?c.format=a:e.extend(c,a);e(this).autotab("filter",c)}})(jQuery);
11
+ (function(d){var t=navigator.platform,n=null,r="iPad"===t||"iPhone"===t||"iPod"===t,v="undefined"!==typeof InstallTrigger,g=function(a,e){if(null!==e&&"undefined"!==typeof e)for(var b in e)d(a).data("autotab-"+b,e[b])},m=function(a){var e={format:"all",loaded:!1,disabled:!1,pattern:null,uppercase:!1,lowercase:!1,nospace:!1,maxlength:2147483647,target:null,previous:null,trigger:null,originalValue:"",changed:!1,editable:"text"==a.type||"password"==a.type||"textarea"==a.type,tabOnSelect:!1};if(!0===
12
+ d.autotab.selectFilterByClass&&"undefined"===typeof d(a).data("autotab-format")){var b="all text alpha number numeric alphanumeric hex hexadecimal custom".split(" "),c;for(c in b)if(d(a).hasClass(b[c])){e.format=b[c];break}}for(c in e)"undefined"!==typeof d(a).data("autotab-"+c)&&(e[c]=d(a).data("autotab-"+c));e.loaded||(null!==e.trigger&&"string"===typeof e.trigger&&(e.trigger=e.trigger.toString()),g(a,e));return e},p=function(a){return"undefined"!==typeof a&&("string"===typeof a||!(a instanceof
13
+ jQuery))};d.autotab=function(a){"object"!==typeof a&&(a={});d(":input").autotab(a)};d.autotab.selectFilterByClass=!1;d.autotab.next=function(){var a=d(document.activeElement);a.length&&a.trigger("autotab-next")};d.autotab.previous=function(){var a=d(document.activeElement);a.length&&a.trigger("autotab-previous")};d.autotab.remove=function(a){p(a)?d(a).autotab("remove"):d(":input").autotab("remove")};d.autotab.restore=function(a){p(a)?d(a).autotab("restore"):d(":input").autotab("restore")};d.autotab.refresh=
14
+ function(a){p(a)?d(a).autotab("refresh"):d(":input").autotab("refresh")};d.fn.autotab=function(a,e){if(!this.length)return this;var b=d.grep(this,function(a,b){return"hidden"!=a.type});if("filter"==a){if("string"===typeof e||"function"===typeof e)e={format:e};for(var c=0,h=b.length;c<h;c++){var f=m(b[c]),k=e;k.target=f.target;k.previous=f.previous;d.extend(f,k);f.loaded?g(b[c],f):(f.disabled=!0,s(b[c],k))}}else if("remove"==a||"destroy"==a||"disable"==a)for(c=0,h=b.length;c<h;c++)f=m(b[c]),f.disabled=
15
+ !0,g(b[c],f);else if("restore"==a||"enable"==a)for(c=0,h=b.length;c<h;c++)f=m(b[c]),f.disabled=!1,g(b[c],f);else if("refresh"==a)for(c=0,h=b.length;c<h;c++){var f=m(b[c]),q=c+1,l=c-1;null===f.target||"undefined"===typeof f.target||""===f.target.selector?f.target=0<c&&q<h?b[q]:0<c?null:b[q]:console.log("target selector!");null===f.previous||"undefined"===typeof f.previous||""===f.previous.selector?f.previous=0<c&&q<h?b[l]:0<c?b[l]:null:console.log("previous selector!");f.loaded?(p(f.target)&&(f.target=
16
+ d(f.target)),p(f.previous)&&(f.previous=d(f.previous)),g(b[c],f)):s(b[c],f)}else if(null===a||"undefined"===typeof a?e={}:"string"===typeof a||"function"===typeof a?e={format:a}:"object"===typeof a&&(e=a),1<b.length)for(c=0,h=b.length;c<h;c++)q=c+1,l=c-1,k=e,0<c&&q<h?(k.target=b[q],k.previous=b[l]):0<c?(k.target=null,k.previous=b[l]):(k.target=b[q],k.previous=null),s(b[c],k);else s(b[0],e);return this};var u=function(a,d,b){if("function"===typeof b.format)return b.format(d,a);a=null;switch(b.format){case "text":a=
17
+ RegExp("[0-9]+","g");break;case "alpha":a=RegExp("[^a-zA-Z]+","g");break;case "number":case "numeric":a=RegExp("[^0-9]+","g");break;case "alphanumeric":a=RegExp("[^0-9a-zA-Z]+","g");break;case "hex":case "hexadecimal":a=RegExp("[^0-9A-Fa-f]+","g");break;case "custom":a=new RegExp(b.pattern,"g")}null!==a&&(d=d.replace(a,""));b.nospace&&(a=RegExp("[ ]+","g"),d=d.replace(a,""));b.uppercase&&(d=d.toUpperCase());b.lowercase&&(d=d.toLowerCase());return d},s=function(a,e){var b=m(a);b.disabled&&(b.disabled=
18
+ !1,b.target=null,b.previous=null);d.extend(b,e);p(b.target)&&(b.target=d(b.target));p(b.previous)&&(b.previous=d(b.previous));var c=a.maxLength;"undefined"===typeof a.maxLength&&"textarea"==a.type&&(c=a.maxLength=a.getAttribute("maxlength"));2147483647==b.maxlength&&2147483647!=c&&-1!=c?b.maxlength=c:0<b.maxlength?a.maxLength=b.maxlength:b.target=null;if(b.loaded)g(a,b);else{b.loaded=!0;g(a,b);if("select-one"==a.type)d(a).on("change",function(a){m(this).tabOnSelect&&d(this).trigger("autotab-next")});
19
+ d(a).on("autotab-next",function(a,b){var d=this;setTimeout(function(){b||(b=m(d));var a=b.target;b.disabled||!a.length||r||(a.prop("disabled")||a.prop("readonly")?a.trigger("autotab-next"):a.focus().select(),n=new Date)},1)}).on("autotab-previous",function(a,b){var d=this;setTimeout(function(){b||(b=m(d));var a=b.previous;if(!b.disabled&&a.length){var c=a.val();a.prop("disabled")||a.prop("readonly")?a.trigger("autotab-previous"):c.length&&a.data("autotab-editable")?(a.focus().val(c.substring(0,c.length-
20
+ 1)),g(a,{changed:!0})):a.focus();n=null}},1)}).on("focus",function(){g(this,{originalValue:this.value})}).on("blur",function(){var a=m(this);a.changed&&this.value!=a.originalValue&&(g(this,{changed:!1}),d(this).change())}).on("keydown",function(a){var b=m(this);if(!b||b.disabled)return!0;var c=a.which||a.charCode;if(8==c){if("select-one"===this.type||"checkbox"===this.type||"radio"===this.type||"button"===this.type||"submit"===this.type||"range"===this.type)return d(this).trigger("autotab-previous",
21
+ b),!1;0===this.value.length?d(this).trigger("autotab-previous",b):g(this,{changed:this.value!==b.originalValue})}else if(9==c&&null!==n)if(a.shiftKey)n=null;else if(800>(new Date).getTime()-n.getTime())return n=null,!1}).on("keypress",function(a){var b=m(this),c=a.which||a.keyCode;if(!b||b.disabled||v&&0===a.charCode||a.ctrlKey||a.altKey||13==c||"text"!=this.type&&"password"!=this.type&&"textarea"!=this.type||this.disabled)return!0;c=String.fromCharCode(c);if(null!==b.trigger&&0<=b.trigger.indexOf(c))return null!==
22
+ n&&800>(new Date).getTime()-n.getTime()?n=null:d(this).trigger("autotab-next",b),!1;n=null;a=document.selection&&document.selection.createRange?!0:0<a.charCode;c=u(this,c,b);if(a&&(null===c||""===c))return!1;if(a&&this.value.length<=this.maxLength){var e,l;a=0;if("number"===typeof this.selectionStart&&"number"===typeof this.selectionEnd)e=this.selectionStart,l=this.selectionEnd,a=1;else if(document.selection&&document.selection.createRange){l=document.selection.createRange();e=this.createTextRange();
23
+ a=this.createTextRange();var p=l.getBookmark();e.moveToBookmark(p);a.setEndPoint("EndToStart",e);e=a.text.length;l=e+l.text.length;a=2}if(0===e&&l==this.value.length)this.value=c;else{if(this.value.length==this.maxLength&&e===l)return d(this).trigger("autotab-next",b),!1;this.value=this.value.slice(0,e)+c+this.value.slice(l)}g(this,{changed:this.value!=b.originalValue});this.value.length!=b.maxlength&&(e++,1==a?this.selectionStart=this.selectionEnd=e:2==a&&(c=this.createTextRange(),c.collapse(!0),
24
+ c.moveEnd("character",e),c.moveStart("character",e),c.select()))}this.value.length==b.maxlength&&d(this).trigger("autotab-next",b);return!1}).on("paste",function(a){var b=m(this);if(!b)return!0;this.maxLength=2147483647;(function(a,c){setTimeout(function(){var e=-1,g=document.createElement("input");g.type="hidden";g.value=a.value.toLowerCase();g.originalValue=a.value;a.maxLength=c.maxlength;a.value=u(a,a.value,c).substr(0,c.maxlength);var h=function(a,b){if(a){var c=m(a);if(d(a).prop("disabled")||
25
+ d(a).prop("readonly"))d(a).trigger("autotab-next"),r||h(c.target[0],b);else{for(var f=0,k=b.length;f<k;f++)e=g.value.indexOf(b.charAt(f).toLowerCase(),e)+1;f=g.originalValue.substr(e);(f=u(a,f,c).substr(0,c.maxlength))?(a.value=f,f.length==c.maxlength&&(d(a).trigger("autotab-next",c),r||h(c.target[0],f))):a.value=""}}};a.value.length==c.maxlength&&(d(a).trigger("autotab-next",b),r||h(c.target[0],a.value.toLowerCase()))},1)})(this,b)})}};d.fn.autotab_magic=function(a){return d(this).autotab()};d.fn.autotab_filter=
26
+ function(a){var e={};"string"===typeof a||"function"===typeof a?e.format=a:d.extend(e,a);return d(this).autotab("filter",e)}})(jQuery);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotab-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sachin Singh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties