autotab-rails 0.0.2 → 0.0.3

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: a5996412b1831ab12acf35bf1710a8f4b1b8c7da
4
- data.tar.gz: 813c8b43ac9d108c1dfb17e5378e5f550e41db07
3
+ metadata.gz: 7bb40cdb63fcdad2e1c9e826bc7525453138fc28
4
+ data.tar.gz: 582abdf750ecb6740c1c68455b9956d6393a8def
5
5
  SHA512:
6
- metadata.gz: 8fb3f1a5e521cbc21ea5d5df06cd92382f6ff2b38280104ad47e86886fd2567887f35f11a0d737147ea345e1c6d03d1515ed65a2d59177f4516b217a0608c57c
7
- data.tar.gz: 3b9b0f44e3a4718cc88dad27e89926784a7ab398424cb28a14f60d3b78d32265d95f6931ecf79621df0be06ed4c2122a22a006d164e2ad62d1176c19045ac71a
6
+ metadata.gz: c4b524d2788305422e743c454b367ac47a11d4941fc44c6eeb47741c8d6e56f680138052fe8fae3e10011dfca7f2a0ffe4d5b4b6848cb8b8b69ef9f3ce3806d4
7
+ data.tar.gz: e2e85e60d178d8ed4fa8bf903f468a3fbeb765dd9c9e4f3bdf4445c7c26152c7b59898a31e138cd7e6f4c825bacd46e92e568b38e40fffbd02898f432f816013
data/.gitignore CHANGED
File without changes
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in autotab-rails.gemspec
4
- gemspec
5
-
6
- gem 'debugger'
4
+ gemspec
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # AutoTab for rails asset pipeline
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/autotab-rails.svg)](http://badge.fury.io/rb/autotab-rails)
4
+ [![Code Climate](https://codeclimate.com/github/sachin87/autotab-rails.png)](https://codeclimate.com/github/sachin87/autotab-rails)
5
+ [![License](http://img.shields.io/license/MIT.png?color=green)](http://opensource.org/licenses/MIT)
6
+
3
7
  [Autotab](https://github.com/Mathachew/jquery-autotab) is a jQuery plugin that provides auto tabbing and filtering on text fields in a form. Once the maximum number of characters has been reached within a text field, the focus is automatically set to a defined element. Likewise, clearing out the text field's content by pressing backspace eventually places the focus on a previous element.
4
8
 
5
9
  The `autotab-rails` gem integrates the `AutoTab` with the Rails asset pipeline.
@@ -45,6 +49,9 @@ And this file must be included in `application.js`
45
49
  //= require autotab-jquery
46
50
  //= require custom
47
51
 
52
+ ## Limitations
53
+
54
+ jquery-autotab does not supports iphone.[READ MORE](https://github.com/Mathachew/jquery-autotab/issues/45)
48
55
 
49
56
  ## Gem maintenance
50
57
 
@@ -58,6 +65,10 @@ Publish gem.
58
65
 
59
66
  rake release
60
67
 
68
+ ## Contributing to jquery-autotab
69
+
70
+ Fork, fix, then send me a pull request.
71
+
61
72
  ## License
62
73
 
63
- use MIT license.
74
+ MIT license.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@
4
4
  require 'bundler/gem_tasks'
5
5
  require File.expand_path('../lib/autotab-rails/source_file', __FILE__)
6
6
 
7
- desc "Update with Harvest's AutoTab Library"
7
+ desc "Update with Matthew's AutoTab Library"
8
8
  task 'update-autotab', 'repository_url', 'branch' do |task, args|
9
9
  remote = args['repository_url'] || 'https://github.com/Mathachew/jquery-autotab'
10
10
  branch = args['branch'] || 'master'
@@ -3,22 +3,29 @@
3
3
  require File.expand_path('../lib/autotab-rails/version', __FILE__)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
+ gem.platform = Gem::Platform::RUBY
7
+ gem.name = 'autotab-rails'
6
8
  gem.authors = ['Sachin Singh']
7
9
  gem.email = ['sachin.y87@hmail.com']
8
10
  gem.description = %q{AutoTab is a is a jQuery plugin that provides auto tabbing and filtering on text fields in a form.}
9
11
  gem.summary = %q{Integrate AutoTab javascript library with Rails asset pipeline}
10
12
  gem.homepage = 'https://github.com/sachin87/autotab-rails'
13
+ gem.version = AutoTab::Rails::VERSION
14
+
15
+ gem.required_ruby_version = '>= 1.9.3'
16
+ gem.required_rubygems_version = '>= 2.2.2'
17
+
18
+ gem.license = 'MIT'
11
19
 
12
20
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
21
  gem.files = `git ls-files`.split("\n")
14
22
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- gem.name = 'autotab-rails'
16
23
  gem.require_paths = ['lib']
17
- gem.version = AutoTab::Rails::VERSION
18
24
 
19
25
  gem.add_dependency 'railties', '>= 3.0'
26
+ gem.add_dependency 'rails', '>= 3.0'
20
27
 
21
28
  gem.add_development_dependency 'bundler', '>= 1.0'
22
- gem.add_development_dependency 'rails', '>= 3.0'
23
29
  gem.add_development_dependency 'thor', '>= 0.14'
30
+ gem.add_development_dependency 'debugger'
24
31
  end
data/lib/autotab-rails.rb CHANGED
@@ -14,4 +14,6 @@ when /^3\.[12]/
14
14
  require 'autotab-rails/engine3'
15
15
  when /^3\.[0]/
16
16
  require 'autotab-rails/railtie'
17
+ else
18
+ raise 'Unsupported rails version'
17
19
  end
File without changes
File without changes
File without changes
@@ -7,25 +7,25 @@ class SourceFile < Thor
7
7
  include Thor::Actions
8
8
 
9
9
  desc 'fetch source files', 'fetch source files from GitHub'
10
- def fetch remote, branch
10
+ def fetch(remote, branch)
11
11
  self.destination_root = 'vendor/assets'
12
12
  get "#{remote}/raw/#{branch}/js/jquery.autotab.js", 'javascripts/autotab-jquery.js'
13
13
  get "#{remote}/raw/#{branch}/js/jquery.autotab.min.js", 'javascripts/autotab-jquery.min.js'
14
- get "#{remote}/raw/#{branch}/component.json", 'component.json'
14
+ get "#{remote}/raw/#{branch}/bower.json", 'bower.json'
15
15
  bump_version
16
16
  end
17
17
 
18
18
  desc 'clean up useless files', 'clean up useless files'
19
19
  def cleanup
20
20
  self.destination_root = 'vendor/assets'
21
- remove_file 'component.json'
21
+ remove_file 'bower.json'
22
22
  end
23
23
 
24
24
  protected
25
25
 
26
26
  def bump_version
27
27
  inside destination_root do
28
- component_json = JSON.load(File.open('component.json'))
28
+ component_json = JSON.load(File.open('bower.json'))
29
29
  version = component_json['version']
30
30
  gsub_file '../../lib/autotab-rails/version.rb', /AUTO_TAB_VERSION\s=\s'(\d|\.)+'$/ do |match|
31
31
  %Q{AUTO_TAB_VERSION = '#{version}'}
File without changes
@@ -2,7 +2,7 @@
2
2
 
3
3
  module AutoTab
4
4
  module Rails
5
- VERSION = '0.0.2'
6
- AUTO_TAB_VERSION = '1.6'
5
+ VERSION = '0.0.3'
6
+ AUTO_TAB_VERSION = '1.7.0'
7
7
  end
8
8
  end
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "jquery.autotab",
3
+ "version": "1.7.0",
4
+ "description": "A jQuery plugin that provides auto-tabbing and filtering on text fields in a form.",
5
+ "main": [ "./js/jquery.autotab.min.js" ],
6
+ "homepage": "https://github.com/Mathachew/jquery-autotab",
7
+ "dependencies" : {
8
+ "jquery" : ">= 1.7"
9
+ },
10
+ "keywords": [
11
+ "autotab",
12
+ "filter"
13
+ ],
14
+ "author" : {
15
+ "name" : "Matthew Miller",
16
+ "web" : "https://github.com/Mathachew"
17
+ },
18
+ "license": [
19
+ "http://www.opensource.org/licenses/mit-license.php"
20
+ ]
21
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Autotab - jQuery plugin 1.6
2
+ * Autotab - jQuery plugin 1.7
3
3
  * https://github.com/Mathachew/jquery-autotab
4
4
  *
5
5
  * Copyright (c) 2008, 2014 Matthew Miller
@@ -17,8 +17,6 @@
17
17
  firefox: (typeof InstallTrigger !== 'undefined')
18
18
  };
19
19
 
20
- // Native get/setAttribute methods are much faster than $.data, so $.data is used for objects only: http://jsperf.com/dataset-vs-jquery-data/4
21
- // When removing then resetting auto tab, storing an object resulted in overwritten values, leading to this implementation
22
20
  var setSettings = function (e, settings) {
23
21
  if (settings === null || typeof settings === 'undefined') {
24
22
  return;
@@ -43,11 +41,15 @@
43
41
  previous: null,
44
42
  trigger: null,
45
43
  originalValue: '',
46
- changed: false
44
+ changed: false,
45
+ editable: (e.type == 'text' || e.type == 'password' || e.type == 'textarea'),
46
+ tabOnSelect: false
47
47
  };
48
48
 
49
49
  for (var key in settings) {
50
- settings[key] = $(e).data('autotab-' + key) || settings[key];
50
+ if (typeof $(e).data('autotab-' + key) !== 'undefined') {
51
+ settings[key] = $(e).data('autotab-' + key);
52
+ }
51
53
  }
52
54
 
53
55
  // Save settings on first run
@@ -62,38 +64,60 @@
62
64
  return settings;
63
65
  };
64
66
 
65
- // The 1ms timeouts allow for keypress events to complete in case a
66
- // custom function or exterior method calls for a manual auto tab
67
- $.autotab = {
68
- next: function () {
69
- var e = $(document.activeElement);
67
+ var queryObject = function (e) {
68
+ return (typeof e !== 'undefined' && (typeof e === 'string' || !(e instanceof jQuery)));
69
+ };
70
70
 
71
- if (e.length) {
72
- e.trigger('autotab-next');
73
- }
74
- },
75
- previous: function () {
76
- var e = $(document.activeElement);
71
+ $.autotab = function (options) {
72
+ if (typeof options !== 'object') {
73
+ options = {};
74
+ }
77
75
 
78
- if (e.length) {
79
- e.trigger('autotab-previous');
80
- }
76
+ $(':input').autotab(options);
77
+ };
78
+
79
+ $.autotab.next = function () {
80
+ var e = $(document.activeElement);
81
+
82
+ if (e.length) {
83
+ e.trigger('autotab-next');
81
84
  }
82
85
  };
83
86
 
87
+ $.autotab.previous = function () {
88
+ var e = $(document.activeElement);
89
+
90
+ if (e.length) {
91
+ e.trigger('autotab-previous');
92
+ }
93
+ };
94
+
95
+ $.autotab.remove = function (e) {
96
+ queryObject(e) ? $(e).autotab('remove') : $(':input').autotab('remove');
97
+ };
98
+
99
+ $.autotab.restore = function (e) {
100
+ queryObject(e) ? $(e).autotab('restore') : $(':input').autotab('restore');
101
+ };
102
+
84
103
  $.fn.autotab = function (method, options) {
85
104
  if (!this.length) {
86
105
  return this;
87
106
  }
88
107
 
108
+ // Remove hidden fields since tabbing backwards is supported on different form elements
109
+ var filtered = $.grep(this, function (e, i) {
110
+ return e.type != 'hidden';
111
+ });
112
+
89
113
  // Apply filter options
90
114
  if (method == 'filter') {
91
115
  if (typeof options === 'string' || typeof options === 'function') {
92
116
  options = { format: options };
93
117
  }
94
118
 
95
- for (var i = 0, length = this.length; i < length; i++) {
96
- var defaults = getSettings(this[i]),
119
+ for (var i = 0, length = filtered.length; i < length; i++) {
120
+ var defaults = getSettings(filtered[i]),
97
121
  newOptions = options;
98
122
 
99
123
  // Retain the established target/previous values as this area is for filtering only
@@ -104,31 +128,31 @@
104
128
 
105
129
  if (!defaults.loaded) {
106
130
  defaults.disabled = true;
107
- autotabBind(this[i], newOptions);
131
+ autotabBind(filtered[i], newOptions);
108
132
  }
109
133
  else {
110
- setSettings(this[i], defaults);
134
+ setSettings(filtered[i], defaults);
111
135
  }
112
136
  }
113
137
  }
114
138
  // Disable auto tab and filtering
115
139
  else if (method == 'remove' || method == 'destroy' || method == 'disable') {
116
- for (var i = 0, length = this.length; i < length; i++) {
117
- var defaults = getSettings(this[i]);
140
+ for (var i = 0, length = filtered.length; i < length; i++) {
141
+ var defaults = getSettings(filtered[i]);
118
142
 
119
143
  defaults.disabled = true;
120
144
 
121
- setSettings(this[i], defaults);
145
+ setSettings(filtered[i], defaults);
122
146
  }
123
147
  }
124
148
  // Re-enable auto tab and filtering
125
149
  else if (method == 'restore' || method == 'enable') {
126
- for (var i = 0, length = this.length; i < length; i++) {
127
- var defaults = getSettings(this[i]);
150
+ for (var i = 0, length = filtered.length; i < length; i++) {
151
+ var defaults = getSettings(filtered[i]);
128
152
 
129
153
  defaults.disabled = false;
130
154
 
131
- setSettings(this[i], defaults);
155
+ setSettings(filtered[i], defaults);
132
156
  }
133
157
  }
134
158
  else {
@@ -143,30 +167,30 @@
143
167
  }
144
168
 
145
169
  // Bind key events to element(s) passed
146
- if (this.length > 1) {
147
- for (var i = 0, length = this.length; i < length; i++) {
170
+ if (filtered.length > 1) {
171
+ for (var i = 0, length = filtered.length; i < length; i++) {
148
172
  var n = i + 1,
149
173
  p = i - 1,
150
174
  newOptions = options;
151
175
 
152
176
  if (i > 0 && n < length) {
153
- newOptions.target = this[n];
154
- newOptions.previous = this[p];
177
+ newOptions.target = filtered[n];
178
+ newOptions.previous = filtered[p];
155
179
  }
156
180
  else if (i > 0) {
157
181
  newOptions.target = null;
158
- newOptions.previous = this[p];
182
+ newOptions.previous = filtered[p];
159
183
  }
160
184
  else {
161
- newOptions.target = this[n];
185
+ newOptions.target = filtered[n];
162
186
  newOptions.previous = null;
163
187
  }
164
188
 
165
- autotabBind(this[i], newOptions);
189
+ autotabBind(filtered[i], newOptions);
166
190
  }
167
191
  }
168
192
  else {
169
- autotabBind(this[0], options);
193
+ autotabBind(filtered[0], options);
170
194
  }
171
195
  }
172
196
 
@@ -244,16 +268,20 @@
244
268
  $.extend(defaults, options);
245
269
 
246
270
  // Sets targets to element based on the name or ID passed if they are not currently objects
247
- if (typeof defaults.target === 'string' || !(defaults.target instanceof jQuery)) {
271
+ if (queryObject(defaults.target)) {
248
272
  defaults.target = $(defaults.target);
249
273
  }
250
274
 
251
- if (typeof defaults.previous === 'string' || !(defaults.previous instanceof jQuery)) {
275
+ if (queryObject(defaults.previous)) {
252
276
  defaults.previous = $(defaults.previous);
253
277
  }
254
278
 
255
279
  var oldMaxlength = element.maxLength;
256
280
 
281
+ if (typeof element.maxLength === 'undefined' && element.type == 'textarea') {
282
+ oldMaxlength = element.maxLength = element.getAttribute('maxlength');
283
+ }
284
+
257
285
  // defaults.maxlength has not changed and maxlength was specified
258
286
  if (defaults.maxlength == 2147483647 && oldMaxlength != 2147483647 && oldMaxlength != -1) {
259
287
  defaults.maxlength = oldMaxlength;
@@ -277,6 +305,19 @@
277
305
  return;
278
306
  }
279
307
 
308
+ // Add a change event to select lists only so that we can auto tab when a value is selected
309
+ if (element.type == 'select-one') {
310
+ $(element).on('change', function (e) {
311
+ var defaults = getSettings(this);
312
+
313
+ if (defaults.tabOnSelect) {
314
+ $(this).trigger('autotab-next');
315
+ }
316
+ });
317
+ }
318
+
319
+ // The 1ms timeouts allow for keypress events to complete in case a
320
+ // custom function or exterior method calls for a manual auto tab
280
321
  $(element).on('autotab-next', function (event, defaults) {
281
322
  var self = this;
282
323
  setTimeout(function () {
@@ -284,10 +325,20 @@
284
325
  defaults = getSettings(self);
285
326
  }
286
327
 
287
- if (!defaults.disabled && defaults.target.length) {
328
+ var target = defaults.target;
329
+
330
+ if (!defaults.disabled && target.length) {
288
331
  // Using focus on iOS devices is a pain, so use the browser's next/previous buttons to proceed
289
332
  if (!settings.iOS) {
290
- defaults.target.focus().select();
333
+
334
+ // Field is disabled, so tab to next element
335
+ if (target.prop('disabled')) {
336
+ target.trigger('autotab-next');
337
+ }
338
+ else {
339
+ target.focus().select();
340
+ }
341
+
291
342
  settings.focusChange = new Date();
292
343
  }
293
344
  }
@@ -304,7 +355,11 @@
304
355
  if (!defaults.disabled && previous.length) {
305
356
  var value = previous.val();
306
357
 
307
- if (value.length) {
358
+ // Field is disabled, so tab to previous element
359
+ if (previous.prop('disabled')) {
360
+ previous.trigger('autotab-previous');
361
+ }
362
+ else if (value.length && previous.data('autotab-editable')) {
308
363
  previous.focus().val(value.substring(0, value.length - 1));
309
364
  setSettings(previous, { changed: true });
310
365
  }
@@ -336,8 +391,13 @@
336
391
  // Go to the previous element when backspace
337
392
  // is pressed in an empty input field
338
393
  if (keyCode == 8) {
339
- if (this.value.length === 0 && defaults.previous.length) {
394
+ if (!defaults.editable || this.value.length === 0) {
340
395
  $(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
+ }
341
401
  }
342
402
  else {
343
403
  setSettings(this, { changed: (this.value != defaults.originalValue) });
@@ -360,7 +420,7 @@
360
420
  keyCode = e.which || e.keyCode;
361
421
 
362
422
  // e.charCode == 0 indicates a special key has been pressed, which only Firefox triggers
363
- if (!defaults || defaults.disabled || (settings.firefox && e.charCode === 0) || e.ctrlKey || e.altKey || keyCode == 13 || (this.type != 'text' && this.type != 'password')) {
423
+ if (!defaults || defaults.disabled || (settings.firefox && e.charCode === 0) || e.ctrlKey || e.altKey || keyCode == 13 || (this.type != 'text' && this.type != 'password' && this.type != 'textarea') || this.disabled) {
364
424
  return true;
365
425
  }
366
426
 
@@ -511,7 +571,7 @@
511
571
  });
512
572
  };
513
573
 
514
- // Backwards compatibility
574
+ // Deprecated, here for backwards compatibility
515
575
  $.fn.autotab_magic = function (focus) {
516
576
  $(this).autotab();
517
577
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Autotab - jQuery plugin 1.6
2
+ * Autotab - jQuery plugin 1.7
3
3
  * https://github.com/Mathachew/jquery-autotab
4
4
  *
5
5
  * Copyright (c) 2008, 2014 Matthew Miller
@@ -8,15 +8,16 @@
8
8
  * http://www.opensource.org/licenses/mit-license.php
9
9
  */
10
10
 
11
- (function(f){var n=navigator.platform,m=null,p="iPad"===n||"iPhone"===n||"iPod"===n,t="undefined"!==typeof InstallTrigger,h=function(b,c){if(null!==c&&"undefined"!==typeof c)for(var a in c)f(b).data("autotab-"+a,c[a])},l=function(b){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},a;for(a in c)c[a]=f(b).data("autotab-"+a)||c[a];c.loaded||(null!==c.trigger&&"string"===
12
- typeof c.trigger&&(c.trigger=c.trigger.toString()),h(b,c));return c};f.autotab={next:function(){var b=f(document.activeElement);b.length&&b.trigger("autotab-next")},previous:function(){var b=f(document.activeElement);b.length&&b.trigger("autotab-previous")}};f.fn.autotab=function(b,c){if(!this.length)return this;if("filter"==b){if("string"===typeof c||"function"===typeof c)c={format:c};for(var a=0,d=this.length;a<d;a++){var e=l(this[a]),k=c;k.target=e.target;k.previous=e.previous;f.extend(e,k);e.loaded?
13
- h(this[a],e):(e.disabled=!0,q(this[a],k))}}else if("remove"==b||"destroy"==b||"disable"==b)for(a=0,d=this.length;a<d;a++)e=l(this[a]),e.disabled=!0,h(this[a],e);else if("restore"==b||"enable"==b)for(a=0,d=this.length;a<d;a++)e=l(this[a]),e.disabled=!1,h(this[a],e);else if(null===b||"undefined"===typeof b?c={}:"string"===typeof b||"function"===typeof b?c={format:b}:"object"===typeof b&&(c=b),1<this.length)for(a=0,d=this.length;a<d;a++){var e=a+1,s=a-1,k=c;0<a&&e<d?(k.target=this[e],k.previous=this[s]):
14
- 0<a?(k.target=null,k.previous=this[s]):(k.target=this[e],k.previous=null);q(this[a],k)}else q(this[0],c);return this};var r=function(b,c,a){if("function"===typeof a.format)return a.format(c,b);b=null;switch(a.format){case "text":b=RegExp("[0-9]+","g");break;case "alpha":b=RegExp("[^a-zA-Z]+","g");break;case "number":case "numeric":b=RegExp("[^0-9]+","g");break;case "alphanumeric":b=RegExp("[^0-9a-zA-Z]+","g");break;case "hex":case "hexadecimal":b=RegExp("[^0-9A-Fa-f]+","g");break;case "custom":b=
15
- RegExp(a.pattern,"g")}null!==b&&(c=c.replace(b,""));a.nospace&&(b=RegExp("[ ]+","g"),c=c.replace(b,""));a.uppercase&&(c=c.toUpperCase());a.lowercase&&(c=c.toLowerCase());return c},q=function(b,c){var a=l(b);a.disabled&&(a.disabled=!1,a.target=null,a.previous=null);f.extend(a,c);"string"!==typeof a.target&&a.target instanceof jQuery||(a.target=f(a.target));"string"!==typeof a.previous&&a.previous instanceof jQuery||(a.previous=f(a.previous));var d=b.maxLength;2147483647==a.maxlength&&2147483647!=d&&
16
- -1!=d?a.maxlength=d:0<a.maxlength?b.maxLength=a.maxlength:a.target=null;a.loaded?h(b,a):(a.loaded=!0,h(b,a),f(b).on("autotab-next",function(a,b){var c=this;setTimeout(function(){b||(b=l(c));b.disabled||!b.target.length||p||(b.target.focus().select(),m=new Date)},1)}).on("autotab-previous",function(a,b){var c=this;setTimeout(function(){b||(b=l(c));var a=b.previous;if(!b.disabled&&a.length){var e=a.val();e.length?(a.focus().val(e.substring(0,e.length-1)),h(a,{changed:!0})):a.focus();m=null}},1)}).on("focus",
17
- function(){h(this,{originalValue:this.value})}).on("blur",function(){var a=l(this);a.changed&&this.value!=a.originalValue&&(h(this,{changed:!1}),f(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)0===this.value.length&&b.previous.length?f(this).trigger("autotab-previous",b):h(this,{changed:this.value!=b.originalValue});else if(9==c&&null!==m)if(a.shiftKey)m=null;else if(800>(new Date).getTime()-m.getTime())return m=null,!1}).on("keypress",
18
- function(a){var b=l(this),c=a.which||a.keyCode;if(!b||b.disabled||t&&0===a.charCode||a.ctrlKey||a.altKey||13==c||"text"!=this.type&&"password"!=this.type)return!0;c=String.fromCharCode(c);if(null!==b.trigger&&0<=b.trigger.indexOf(c))return null!==m&&800>(new Date).getTime()-m.getTime()?m=null:f(this).trigger("autotab-next",b),!1;m=null;a=document.selection&&document.selection.createRange?!0:0<a.charCode;c=r(this,c,b);if(a&&(null===c||""===c))return!1;if(a&&this.value.length<=this.maxLength){var g,
19
- d;a=0;if("number"===typeof this.selectionStart&&"number"===typeof this.selectionEnd)g=this.selectionStart,d=this.selectionEnd,a=1;else if(document.selection&&document.selection.createRange){d=document.selection.createRange();g=this.createTextRange();a=this.createTextRange();var u=d.getBookmark();g.moveToBookmark(u);a.setEndPoint("EndToStart",g);g=a.text.length;d=g+d.text.length;a=2}if(0===g&&d==this.value.length)this.value=c;else{if(this.value.length==this.maxLength&&g===d)return f(this).trigger("autotab-next",
20
- b),!1;this.value=this.value.slice(0,g)+c+this.value.slice(d)}h(this,{changed:this.value!=b.originalValue});this.value.length!=b.maxlength&&(g++,1==a?this.selectionStart=this.selectionEnd=g:2==a&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",g),c.moveStart("character",g),c.select()))}this.value.length==b.maxlength&&f(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,
21
- e=document.createElement("input");e.type="hidden";e.value=a.value.toLowerCase();a.maxLength=c.maxlength;a.value=r(a,a.value,c).substr(0,c.maxlength);var h=function(a,b){if(a){for(var c=0,g=b.length;c<g;c++)d=e.value.indexOf(b.charAt(c),d)+1;c=l(a);g=e.value.substr(d);(g=r(a,g,c).substr(0,c.maxlength))?(a.value=g,g.length==c.maxlength&&(f(a).trigger("autotab-next",c),p||h(c.target[0],g))):a.value=""}};a.value.length==c.maxlength&&(f(a).trigger("autotab-next",b),p||h(c.target[0],a.value.toLowerCase()))},
22
- 1)})(this,b)}))};f.fn.autotab_magic=function(b){f(this).autotab()};f.fn.autotab_filter=function(b){var c={};"string"===typeof b||"function"===typeof b?c.format=b:f.extend(c,b);f(this).autotab("filter",c)}})(jQuery);
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);
metadata CHANGED
@@ -1,71 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotab-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-04-30 00:00:00.000000000 Z
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
25
39
  - !ruby/object:Gem::Version
26
40
  version: '3.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - '>='
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
47
  version: '1.0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - '>='
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1.0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: rails
56
+ name: thor
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - '>='
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: '3.0'
61
+ version: '0.14'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '>='
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: '3.0'
68
+ version: '0.14'
55
69
  - !ruby/object:Gem::Dependency
56
- name: thor
70
+ name: debugger
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '0.14'
75
+ version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '0.14'
82
+ version: '0'
69
83
  description: AutoTab is a is a jQuery plugin that provides auto tabbing and filtering
70
84
  on text fields in a form.
71
85
  email:
@@ -74,7 +88,7 @@ executables: []
74
88
  extensions: []
75
89
  extra_rdoc_files: []
76
90
  files:
77
- - .gitignore
91
+ - ".gitignore"
78
92
  - Gemfile
79
93
  - LICENSE
80
94
  - README.md
@@ -87,10 +101,12 @@ files:
87
101
  - lib/autotab-rails/source_file.rb
88
102
  - lib/autotab-rails/tasks.rake
89
103
  - lib/autotab-rails/version.rb
104
+ - vendor/assets/bower.json
90
105
  - vendor/assets/javascripts/autotab-jquery.js
91
106
  - vendor/assets/javascripts/autotab-jquery.min.js
92
107
  homepage: https://github.com/sachin87/autotab-rails
93
- licenses: []
108
+ licenses:
109
+ - MIT
94
110
  metadata: {}
95
111
  post_install_message:
96
112
  rdoc_options: []
@@ -98,17 +114,17 @@ require_paths:
98
114
  - lib
99
115
  required_ruby_version: !ruby/object:Gem::Requirement
100
116
  requirements:
101
- - - '>='
117
+ - - ">="
102
118
  - !ruby/object:Gem::Version
103
- version: '0'
119
+ version: 1.9.3
104
120
  required_rubygems_version: !ruby/object:Gem::Requirement
105
121
  requirements:
106
- - - '>='
122
+ - - ">="
107
123
  - !ruby/object:Gem::Version
108
- version: '0'
124
+ version: 2.2.2
109
125
  requirements: []
110
126
  rubyforge_project:
111
- rubygems_version: 2.0.3
127
+ rubygems_version: 2.2.2
112
128
  signing_key:
113
129
  specification_version: 4
114
130
  summary: Integrate AutoTab javascript library with Rails asset pipeline