quantum 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.project +13 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +82 -0
  7. data/Rakefile +1 -0
  8. data/lib/quantum.rb +8 -0
  9. data/lib/quantum/version.rb +3 -0
  10. data/quantum.gemspec +23 -0
  11. data/vendor/assets/.keep +0 -0
  12. data/vendor/assets/javascripts/alert.js +99 -0
  13. data/vendor/assets/javascripts/chart.js +1424 -0
  14. data/vendor/assets/javascripts/collapse.js +167 -0
  15. data/vendor/assets/javascripts/date_picker.js +474 -0
  16. data/vendor/assets/javascripts/dropdown.js +169 -0
  17. data/vendor/assets/javascripts/file_input.js +100 -0
  18. data/vendor/assets/javascripts/input_mask.js +355 -0
  19. data/vendor/assets/javascripts/map.js +1982 -0
  20. data/vendor/assets/javascripts/modal.js +247 -0
  21. data/vendor/assets/javascripts/popover.js +114 -0
  22. data/vendor/assets/javascripts/qrcode.js +89 -0
  23. data/vendor/assets/javascripts/qrcoder.js +1237 -0
  24. data/vendor/assets/javascripts/tab.js +144 -0
  25. data/vendor/assets/javascripts/time_picker.js +888 -0
  26. data/vendor/assets/javascripts/tooltip.js +361 -0
  27. data/vendor/assets/javascripts/transitions.js +60 -0
  28. data/vendor/assets/javascripts/typeahead.js +335 -0
  29. data/vendor/assets/javascripts/wizard.js +114 -0
  30. data/vendor/assets/stylesheets/alert.css.scss +42 -0
  31. data/vendor/assets/stylesheets/breadcrumb.css.scss +24 -0
  32. data/vendor/assets/stylesheets/button.css.scss +252 -0
  33. data/vendor/assets/stylesheets/chart.css.scss +10 -0
  34. data/vendor/assets/stylesheets/code.css.scss +47 -0
  35. data/vendor/assets/stylesheets/collapse.css.scss +16 -0
  36. data/vendor/assets/stylesheets/datepicker.css.scss +111 -0
  37. data/vendor/assets/stylesheets/dropdown.css.scss +98 -0
  38. data/vendor/assets/stylesheets/file_input.css.scss +7 -0
  39. data/vendor/assets/stylesheets/footer.css.scss +99 -0
  40. data/vendor/assets/stylesheets/form.css.scss +190 -0
  41. data/vendor/assets/stylesheets/grid.css.scss +334 -0
  42. data/vendor/assets/stylesheets/header.css.scss +162 -0
  43. data/vendor/assets/stylesheets/icon.css.scss +533 -0
  44. data/vendor/assets/stylesheets/image.css.scss +48 -0
  45. data/vendor/assets/stylesheets/label_and_badge.css.scss +60 -0
  46. data/vendor/assets/stylesheets/link.css.scss +22 -0
  47. data/vendor/assets/stylesheets/map.css.scss +13 -0
  48. data/vendor/assets/stylesheets/modal.css.scss +100 -0
  49. data/vendor/assets/stylesheets/pagination.css.scss +65 -0
  50. data/vendor/assets/stylesheets/popover.css.scss +110 -0
  51. data/vendor/assets/stylesheets/progress.css.scss +81 -0
  52. data/vendor/assets/stylesheets/qrcode.css.scss +7 -0
  53. data/vendor/assets/stylesheets/reset.css.scss +75 -0
  54. data/vendor/assets/stylesheets/tab.css.scss +202 -0
  55. data/vendor/assets/stylesheets/table.css.scss +71 -0
  56. data/vendor/assets/stylesheets/timepicker.css.scss +74 -0
  57. data/vendor/assets/stylesheets/tooltip.css.scss +83 -0
  58. data/vendor/assets/stylesheets/transitions.css.scss +14 -0
  59. data/vendor/assets/stylesheets/trunk.css.scss +80 -0
  60. data/vendor/assets/stylesheets/typeahead.css.scss +7 -0
  61. data/vendor/assets/stylesheets/typography.css.scss +130 -0
  62. data/vendor/assets/stylesheets/wizard.css.scss +27 -0
  63. metadata +134 -0
@@ -0,0 +1,169 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v2.3.2
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4
+ * ============================================================
5
+ * Copyright 2012 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ============================================================ */
19
+
20
+
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* DROPDOWN CLASS DEFINITION
27
+ * ========================= */
28
+
29
+ var toggle = '[data-toggle=dropdown]'
30
+ , Dropdown = function (element) {
31
+ var $el = $(element).on('click.dropdown.data-api', this.toggle)
32
+ $('html').on('click.dropdown.data-api', function () {
33
+ $el.parent().removeClass('open')
34
+ })
35
+ }
36
+
37
+ Dropdown.prototype = {
38
+
39
+ constructor: Dropdown
40
+
41
+ , toggle: function (e) {
42
+ var $this = $(this)
43
+ , $parent
44
+ , isActive
45
+
46
+ if ($this.is('.disabled, :disabled')) return
47
+
48
+ $parent = getParent($this)
49
+
50
+ isActive = $parent.hasClass('open')
51
+
52
+ clearMenus()
53
+
54
+ if (!isActive) {
55
+ if ('ontouchstart' in document.documentElement) {
56
+ // if mobile we we use a backdrop because click events don't delegate
57
+ $('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
58
+ }
59
+ $parent.toggleClass('open')
60
+ }
61
+
62
+ $this.focus()
63
+
64
+ return false
65
+ }
66
+
67
+ , keydown: function (e) {
68
+ var $this
69
+ , $items
70
+ , $active
71
+ , $parent
72
+ , isActive
73
+ , index
74
+
75
+ if (!/(38|40|27)/.test(e.keyCode)) return
76
+
77
+ $this = $(this)
78
+
79
+ e.preventDefault()
80
+ e.stopPropagation()
81
+
82
+ if ($this.is('.disabled, :disabled')) return
83
+
84
+ $parent = getParent($this)
85
+
86
+ isActive = $parent.hasClass('open')
87
+
88
+ if (!isActive || (isActive && e.keyCode == 27)) {
89
+ if (e.which == 27) $parent.find(toggle).focus()
90
+ return $this.click()
91
+ }
92
+
93
+ $items = $('[role=menu] li:not(.divider):visible a', $parent)
94
+
95
+ if (!$items.length) return
96
+
97
+ index = $items.index($items.filter(':focus'))
98
+
99
+ if (e.keyCode == 38 && index > 0) index-- // up
100
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
101
+ if (!~index) index = 0
102
+
103
+ $items
104
+ .eq(index)
105
+ .focus()
106
+ }
107
+
108
+ }
109
+
110
+ function clearMenus() {
111
+ $('.dropdown-backdrop').remove()
112
+ $(toggle).each(function () {
113
+ getParent($(this)).removeClass('open')
114
+ })
115
+ }
116
+
117
+ function getParent($this) {
118
+ var selector = $this.attr('data-target')
119
+ , $parent
120
+
121
+ if (!selector) {
122
+ selector = $this.attr('href')
123
+ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
124
+ }
125
+
126
+ $parent = selector && $(selector)
127
+
128
+ if (!$parent || !$parent.length) $parent = $this.parent()
129
+
130
+ return $parent
131
+ }
132
+
133
+
134
+ /* DROPDOWN PLUGIN DEFINITION
135
+ * ========================== */
136
+
137
+ var old = $.fn.dropdown
138
+
139
+ $.fn.dropdown = function (option) {
140
+ return this.each(function () {
141
+ var $this = $(this)
142
+ , data = $this.data('dropdown')
143
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
144
+ if (typeof option == 'string') data[option].call($this)
145
+ })
146
+ }
147
+
148
+ $.fn.dropdown.Constructor = Dropdown
149
+
150
+
151
+ /* DROPDOWN NO CONFLICT
152
+ * ==================== */
153
+
154
+ $.fn.dropdown.noConflict = function () {
155
+ $.fn.dropdown = old
156
+ return this
157
+ }
158
+
159
+
160
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
161
+ * =================================== */
162
+
163
+ $(document)
164
+ .on('click.dropdown.data-api', clearMenus)
165
+ .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
166
+ .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
167
+ .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
168
+
169
+ }(window.jQuery);
@@ -0,0 +1,100 @@
1
+ /*
2
+ Bootstrap - File Input
3
+ ======================
4
+
5
+ This is meant to convert all file input tags into a set of elements that displays consistently in all browsers.
6
+
7
+ Converts all
8
+ <input type="file">
9
+ into Bootstrap buttons
10
+ <a class="btn">Browse</a>
11
+
12
+ */
13
+ $(function() {
14
+
15
+ $('input[type=file].btn-file').each(function(i,elem){
16
+
17
+ // Maybe some fields don't need to be standardized.
18
+ if (typeof $(this).attr('data-bfi-disabled') != 'undefined') {
19
+ return;
20
+ }
21
+
22
+ // Set the word to be displayed on the button
23
+ var buttonWord = 'Browse';
24
+
25
+ if (typeof $(this).attr('title') != 'undefined') {
26
+ buttonWord = $(this).attr('title');
27
+ }
28
+
29
+ // Start by getting the HTML of the input element.
30
+ // Thanks for the tip http://stackoverflow.com/a/1299069
31
+ var input = $('<div>').append( $(elem).eq(0).clone() ).html();
32
+
33
+ // Now we're going to replace that input field with a Bootstrap button.
34
+ // The input will actually still be there, it will just be float above and transparent (done with the CSS).
35
+ $(elem).replaceWith('<a class="file-input-wrapper btn btn-block">'+buttonWord+input+'</a>');
36
+ })
37
+ // After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
38
+ // This is important because the in order to give the illusion that this is a button in FF we actually need to move the button from the file input under the cursor. Ugh.
39
+ .promise().done( function(){
40
+
41
+ // As the cursor moves over our new Bootstrap button we need to adjust the position of the invisible file input Browse button to be under the cursor.
42
+ // This gives us the pointer cursor that FF denies us
43
+ $('.file-input-wrapper').mousemove(function(cursor) {
44
+
45
+ var input, wrapper,
46
+ wrapperX, wrapperY,
47
+ inputWidth, inputHeight,
48
+ cursorX, cursorY;
49
+
50
+ // This wrapper element (the button surround this file input)
51
+ wrapper = $(this);
52
+ // The invisible file input element
53
+ input = wrapper.find("input");
54
+ // The left-most position of the wrapper
55
+ wrapperX = wrapper.offset().left;
56
+ // The top-most position of the wrapper
57
+ wrapperY = wrapper.offset().top;
58
+ // The with of the browsers input field
59
+ inputWidth= input.width();
60
+ // The height of the browsers input field
61
+ inputHeight= input.height();
62
+ //The position of the cursor in the wrapper
63
+ cursorX = cursor.pageX;
64
+ cursorY = cursor.pageY;
65
+
66
+ //The positions we are to move the invisible file input
67
+ // The 20 at the end is an arbitrary number of pixels that we can shift the input such that cursor is not pointing at the end of the Browse button but somewhere nearer the middle
68
+ moveInputX = cursorX - wrapperX - inputWidth + 20;
69
+ // Slides the invisible input Browse button to be positioned middle under the cursor
70
+ moveInputY = cursorY- wrapperY - (inputHeight/2);
71
+
72
+ // Apply the positioning styles to actually move the invisible file input
73
+ input.css({
74
+ left:moveInputX,
75
+ top:moveInputY
76
+ });
77
+ });
78
+
79
+ $('.file-input-wrapper input[type=file]').change(function(){
80
+
81
+ // Remove any previous file names
82
+ $(this).parent().next().has('file-input-name').remove();
83
+ $(this).parent().after('<span class="file-input-name">'+$(this).val()+'</span>');
84
+
85
+ });
86
+
87
+
88
+
89
+ });
90
+
91
+ // Add the styles before the first stylesheet
92
+ // This ensures they can be easily overridden with developer styles
93
+ var cssHtml = '<style>'+
94
+ '.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
95
+ '.file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover { position: absolute; top: 0; left: 0; cursor: pointer; opacity: 0; filter: alpha(opacity=0); z-index: 99; outline: 0; }'+
96
+ '.file-input-name { margin-left: 8px; }'+
97
+ '</style>';
98
+ $('link[rel=stylesheet]').eq(0).before(cssHtml);
99
+
100
+ });
@@ -0,0 +1,355 @@
1
+ /* ===========================================================
2
+ * bootstrap-inputmask.js j2
3
+ * http://twitter.github.com/bootstrap/javascript.html#tooltips
4
+ * Based on Masked Input plugin by Josh Bush (digitalbush.com)
5
+ * ===========================================================
6
+ * Copyright 2012 Jasny BV, Netherlands.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License")
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ * ========================================================== */
20
+
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
25
+ var isIphone = (window.orientation !== undefined),
26
+ isAndroid = navigator.userAgent.toLowerCase().indexOf("android") > -1
27
+
28
+
29
+ /* INPUTMASK PUBLIC CLASS DEFINITION
30
+ * ================================= */
31
+
32
+ var Inputmask = function (element, options) {
33
+ if (isAndroid) return // No support because caret positioning doesn't work on Android
34
+
35
+ this.$element = $(element)
36
+ this.options = $.extend({}, $.fn.inputmask.defaults, options)
37
+ this.mask = String(options.mask)
38
+
39
+ this.init()
40
+ this.listen()
41
+
42
+ this.checkVal() //Perform initial check for existing values
43
+ }
44
+
45
+ Inputmask.prototype = {
46
+
47
+ init: function() {
48
+ var defs = this.options.definitions
49
+ var len = this.mask.length
50
+
51
+ this.tests = []
52
+ this.partialPosition = this.mask.length
53
+ this.firstNonMaskPos = null
54
+
55
+ $.each(this.mask.split(""), $.proxy(function(i, c) {
56
+ if (c == '?') {
57
+ len--
58
+ this.partialPosition = i
59
+ } else if (defs[c]) {
60
+ this.tests.push(new RegExp(defs[c]))
61
+ if(this.firstNonMaskPos === null)
62
+ this.firstNonMaskPos = this.tests.length - 1
63
+ } else {
64
+ this.tests.push(null)
65
+ }
66
+ }, this))
67
+
68
+ this.buffer = $.map(this.mask.split(""), $.proxy(function(c, i) {
69
+ if (c != '?') return defs[c] ? this.options.placeholder : c
70
+ }, this))
71
+
72
+ this.focusText = this.$element.val()
73
+
74
+ this.$element.data("rawMaskFn", $.proxy(function() {
75
+ return $.map(this.buffer, function(c, i) {
76
+ return this.tests[i] && c != this.options.placeholder ? c : null
77
+ }).join('')
78
+ }, this))
79
+ },
80
+
81
+ listen: function() {
82
+ if (this.$element.attr("readonly")) return
83
+
84
+ var pasteEventName = (navigator.userAgent.match(/msie/i) ? 'paste' : 'input') + ".mask"
85
+
86
+ this.$element
87
+ .on("unmask", $.proxy(this.unmask, this))
88
+
89
+ .on("focus.mask", $.proxy(this.focusEvent, this))
90
+ .on("blur.mask", $.proxy(this.blurEvent, this))
91
+
92
+ .on("keydown.mask", $.proxy(this.keydownEvent, this))
93
+ .on("keypress.mask", $.proxy(this.keypressEvent, this))
94
+
95
+ .on(pasteEventName, $.proxy(this.pasteEvent, this))
96
+ },
97
+
98
+ //Helper Function for Caret positioning
99
+ caret: function(begin, end) {
100
+ if (this.$element.length === 0) return
101
+ if (typeof begin == 'number') {
102
+ end = (typeof end == 'number') ? end : begin
103
+ return this.$element.each(function() {
104
+ if (this.setSelectionRange) {
105
+ this.setSelectionRange(begin, end)
106
+ } else if (this.createTextRange) {
107
+ var range = this.createTextRange()
108
+ range.collapse(true)
109
+ range.moveEnd('character', end)
110
+ range.moveStart('character', begin)
111
+ range.select()
112
+ }
113
+ })
114
+ } else {
115
+ if (this.$element[0].setSelectionRange) {
116
+ begin = this.$element[0].selectionStart
117
+ end = this.$element[0].selectionEnd
118
+ } else if (document.selection && document.selection.createRange) {
119
+ var range = document.selection.createRange()
120
+ begin = 0 - range.duplicate().moveStart('character', -100000)
121
+ end = begin + range.text.length
122
+ }
123
+ return {
124
+ begin: begin,
125
+ end: end
126
+ }
127
+ }
128
+ },
129
+
130
+ seekNext: function(pos) {
131
+ var len = this.mask.length
132
+ while (++pos <= len && !this.tests[pos]);
133
+
134
+ return pos
135
+ },
136
+
137
+ seekPrev: function(pos) {
138
+ while (--pos >= 0 && !this.tests[pos]);
139
+
140
+ return pos
141
+ },
142
+
143
+ shiftL: function(begin,end) {
144
+ var len = this.mask.length
145
+
146
+ if(begin<0) return
147
+
148
+ for (var i = begin,j = this.seekNext(end); i < len; i++) {
149
+ if (this.tests[i]) {
150
+ if (j < len && this.tests[i].test(this.buffer[j])) {
151
+ this.buffer[i] = this.buffer[j]
152
+ this.buffer[j] = this.options.placeholder
153
+ } else
154
+ break;
155
+ j = this.seekNext(j)
156
+ }
157
+ }
158
+ this.writeBuffer()
159
+ this.caret(Math.max(this.firstNonMaskPos, begin))
160
+ },
161
+
162
+ shiftR: function(pos) {
163
+ var len = this.mask.length
164
+
165
+ for (var i = pos, c = this.options.placeholder; i < len; i++) {
166
+ if (this.tests[i]) {
167
+ var j = this.seekNext(i)
168
+ var t = this.buffer[i]
169
+ this.buffer[i] = c
170
+ if (j < len && this.tests[j].test(t))
171
+ c = t
172
+ else
173
+ break;
174
+ }
175
+ }
176
+ },
177
+
178
+ unmask: function() {
179
+ this.$element
180
+ .unbind(".mask")
181
+ .removeData("inputmask")
182
+ },
183
+
184
+ focusEvent: function() {
185
+ this.focusText = this.$element.val()
186
+ var len = this.mask.length
187
+ var pos = this.checkVal()
188
+ this.writeBuffer()
189
+
190
+ var that = this
191
+ var moveCaret = function() {
192
+ if (pos == len)
193
+ that.caret(0, pos)
194
+ else
195
+ that.caret(pos)
196
+ }
197
+
198
+ if ($.browser.msie)
199
+ moveCaret()
200
+ else
201
+ setTimeout(moveCaret, 0)
202
+ },
203
+
204
+ blurEvent: function() {
205
+ this.checkVal()
206
+ if (this.$element.val() != this.focusText)
207
+ this.$element.trigger('change')
208
+ },
209
+
210
+ keydownEvent: function(e) {
211
+ var k=e.which
212
+
213
+ //backspace, delete, and escape get special treatment
214
+ if (k == 8 || k == 46 || (isIphone && k == 127)) {
215
+ var pos = this.caret(),
216
+ begin = pos.begin,
217
+ end = pos.end
218
+
219
+ if (end-begin === 0) {
220
+ begin = k!=46 ? this.seekPrev(begin) : (end=this.seekNext(begin-1))
221
+ end = k==46 ? this.seekNext(end) : end
222
+ }
223
+ this.clearBuffer(begin, end)
224
+ this.shiftL(begin,end-1)
225
+
226
+ return false
227
+ } else if (k == 27) {//escape
228
+ this.$element.val(this.focusText)
229
+ this.caret(0, this.checkVal())
230
+ return false
231
+ }
232
+ },
233
+
234
+ keypressEvent: function(e) {
235
+ var len = this.mask.length
236
+
237
+ var k = e.which,
238
+ pos = this.caret()
239
+
240
+ if (e.ctrlKey || e.altKey || e.metaKey || k<32) {//Ignore
241
+ return true
242
+ } else if (k) {
243
+ if (pos.end - pos.begin !== 0) {
244
+ this.clearBuffer(pos.begin, pos.end)
245
+ this.shiftL(pos.begin, pos.end-1)
246
+ }
247
+
248
+ var p = this.seekNext(pos.begin - 1)
249
+ if (p < len) {
250
+ var c = String.fromCharCode(k)
251
+ if (this.tests[p].test(c)) {
252
+ this.shiftR(p)
253
+ this.buffer[p] = c
254
+ this.writeBuffer()
255
+ var next = this.seekNext(p)
256
+ this.caret(next)
257
+ }
258
+ }
259
+ return false
260
+ }
261
+ },
262
+
263
+ pasteEvent: function() {
264
+ var that = this
265
+
266
+ setTimeout(function() {
267
+ that.caret(that.checkVal(true))
268
+ }, 0)
269
+ },
270
+
271
+ clearBuffer: function(start, end) {
272
+ var len = this.mask.length
273
+
274
+ for (var i = start; i < end && i < len; i++) {
275
+ if (this.tests[i])
276
+ this.buffer[i] = this.options.placeholder
277
+ }
278
+ },
279
+
280
+ writeBuffer: function() {
281
+ return this.$element.val(this.buffer.join('')).val()
282
+ },
283
+
284
+ checkVal: function(allow) {
285
+ var len = this.mask.length
286
+ //try to place characters where they belong
287
+ var test = this.$element.val()
288
+ var lastMatch = -1
289
+
290
+ for (var i = 0, pos = 0; i < len; i++) {
291
+ if (this.tests[i]) {
292
+ this.buffer[i] = this.options.placeholder
293
+ while (pos++ < test.length) {
294
+ var c = test.charAt(pos - 1)
295
+ if (this.tests[i].test(c)) {
296
+ this.buffer[i] = c
297
+ lastMatch = i
298
+ break;
299
+ }
300
+ }
301
+ if (pos > test.length)
302
+ break;
303
+ } else if (this.buffer[i] == test.charAt(pos) && i != this.partialPosition) {
304
+ pos++
305
+ lastMatch = i
306
+ }
307
+ }
308
+ if (!allow && lastMatch + 1 < this.partialPosition) {
309
+ this.$element.val("")
310
+ this.clearBuffer(0, len)
311
+ } else if (allow || lastMatch + 1 >= this.partialPosition) {
312
+ this.writeBuffer()
313
+ if (!allow) this.$element.val(this.$element.val().substring(0, lastMatch + 1))
314
+ }
315
+ return (this.partialPosition ? i : this.firstNonMaskPos)
316
+ }
317
+ }
318
+
319
+
320
+ /* INPUTMASK PLUGIN DEFINITION
321
+ * =========================== */
322
+
323
+ $.fn.inputmask = function (options) {
324
+ return this.each(function () {
325
+ var $this = $(this)
326
+ , data = $this.data('inputmask')
327
+ if (!data) $this.data('inputmask', (data = new Inputmask(this, options)))
328
+ })
329
+ }
330
+
331
+ $.fn.inputmask.defaults = {
332
+ mask: "",
333
+ placeholder: "_",
334
+ definitions: {
335
+ '9': "[0-9]",
336
+ 'a': "[A-Za-z]",
337
+ '?': "[A-Za-z0-9]",
338
+ '*': "."
339
+ }
340
+ }
341
+
342
+ $.fn.inputmask.Constructor = Inputmask
343
+
344
+
345
+ /* INPUTMASK DATA-API
346
+ * ================== */
347
+
348
+ $(document).on('focus.inputmask.data-api', '[data-mask]', function (e) {
349
+ var $this = $(this)
350
+ if ($this.data('inputmask')) return
351
+ e.preventDefault()
352
+ $this.inputmask($this.data())
353
+ })
354
+
355
+ }(window.jQuery);