h2ocube_rails_assets 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -0
- data/Vendorfile +196 -0
- data/h2ocube_rails_assets.gemspec +3 -4
- data/lib/h2ocube_rails_assets.rb +8 -6
- data/test/jquery_test.rb +1 -1
- data/test/turbolinks_test.rb +1 -3
- data/vendor/assets/images/jquery.fancybox/fancybox_loading.gif +0 -0
- data/vendor/assets/images/jquery.fancybox/fancybox_loading@2x.gif +0 -0
- data/vendor/assets/images/jquery.fancybox/fancybox_sprite@2x.png +0 -0
- data/vendor/assets/javascripts/backbone.js +4 -1571
- data/vendor/assets/javascripts/bootstrap.js +6 -2276
- data/vendor/assets/javascripts/highcharts.js +272 -15281
- data/vendor/assets/javascripts/jasny-bootstrap.js +7 -3060
- data/vendor/assets/javascripts/jquery/1.10.js +6 -9807
- data/vendor/assets/javascripts/jquery/1.8.js +2 -9472
- data/vendor/assets/javascripts/jquery/1.9.js +5 -9597
- data/vendor/assets/javascripts/jquery/2.0.js +5 -8841
- data/vendor/assets/javascripts/jquery.cookie.js +26 -23
- data/vendor/assets/javascripts/jquery.fancybox.js +46 -1983
- data/vendor/assets/javascripts/jquery.fileupload.js +1329 -4
- data/vendor/assets/javascripts/jquery.iframe-transport.js +24 -4
- data/vendor/assets/javascripts/jquery.js +1 -1
- data/vendor/assets/javascripts/jquery.lazyload.js +3 -216
- data/vendor/assets/javascripts/jquery.mobile.js +7 -11092
- data/vendor/assets/javascripts/jquery.pnotify.js +29 -903
- data/vendor/assets/javascripts/jquery.timeago.coffee +2 -4
- data/vendor/assets/javascripts/jquery.turbolinks.coffee +40 -51
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.accordion.js +4 -572
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.autocomplete.js +4 -610
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.button.js +4 -419
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.core.js +4 -320
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.datepicker.js +5 -2050
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.dialog.js +4 -808
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.draggable.js +4 -933
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.droppable.js +4 -372
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-blind.js +4 -82
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-bounce.js +4 -113
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-clip.js +4 -67
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-drop.js +4 -65
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-explode.js +4 -97
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-fade.js +4 -30
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-fold.js +4 -76
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-highlight.js +4 -50
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-pulsate.js +4 -63
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-scale.js +4 -318
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-shake.js +4 -74
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-slide.js +4 -64
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-transfer.js +4 -47
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect.js +4 -1289
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.menu.js +4 -621
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.mouse.js +4 -169
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.position.js +4 -497
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.progressbar.js +4 -145
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.resizable.js +4 -968
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.selectable.js +4 -277
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.slider.js +4 -672
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.sortable.js +4 -1282
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.spinner.js +4 -493
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.tabs.js +4 -846
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.tooltip.js +4 -402
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.widget.js +4 -521
- data/vendor/assets/javascripts/jquery.validate.js +2 -1207
- data/vendor/assets/javascripts/lazyload.js +4 -391
- data/vendor/assets/javascripts/sammy.js +5 -2117
- data/vendor/assets/javascripts/underscore.js +4 -1224
- data/vendor/assets/javascripts/zepto.js +1 -1564
- data/vendor/assets/stylesheets/bootstrap.responsive.css +2 -1102
- data/vendor/assets/stylesheets/bootstrap.scss +2 -6151
- data/vendor/assets/stylesheets/jasny-bootstrap.responsive.css +2 -1263
- data/vendor/assets/stylesheets/jasny-bootstrap.scss +2 -7591
- data/vendor/assets/stylesheets/jquery.fancybox.scss +27 -2
- data/vendor/assets/stylesheets/jquery.mobile.scss +2 -3356
- data/vendor/assets/stylesheets/jquery.ui.scss +2 -1184
- metadata +43 -19
- data/vendor/assets/images/jquery.mobile/ajax-loader.gif +0 -0
- data/vendor/assets/images/jquery.mobile/icons-18-black.png +0 -0
- data/vendor/assets/images/jquery.mobile/icons-18-white.png +0 -0
- data/vendor/assets/images/jquery.mobile/icons-36-black.png +0 -0
- data/vendor/assets/images/jquery.mobile/icons-36-white.png +0 -0
- data/vendor/assets/javascripts/_jquery.fileupload.js +0 -1164
- data/vendor/assets/javascripts/zepto/fx_methods.js +0 -71
@@ -1,493 +1,4 @@
|
|
1
|
-
/*!
|
2
|
-
|
3
|
-
|
4
|
-
*
|
5
|
-
* Copyright 2013 jQuery Foundation and other contributors
|
6
|
-
* Released under the MIT license.
|
7
|
-
* http://jquery.org/license
|
8
|
-
*
|
9
|
-
* http://api.jqueryui.com/spinner/
|
10
|
-
*
|
11
|
-
* Depends:
|
12
|
-
* jquery.ui.core.js
|
13
|
-
* jquery.ui.widget.js
|
14
|
-
* jquery.ui.button.js
|
15
|
-
*/
|
16
|
-
(function( $ ) {
|
17
|
-
|
18
|
-
function modifier( fn ) {
|
19
|
-
return function() {
|
20
|
-
var previous = this.element.val();
|
21
|
-
fn.apply( this, arguments );
|
22
|
-
this._refresh();
|
23
|
-
if ( previous !== this.element.val() ) {
|
24
|
-
this._trigger( "change" );
|
25
|
-
}
|
26
|
-
};
|
27
|
-
}
|
28
|
-
|
29
|
-
$.widget( "ui.spinner", {
|
30
|
-
version: "1.10.2",
|
31
|
-
defaultElement: "<input>",
|
32
|
-
widgetEventPrefix: "spin",
|
33
|
-
options: {
|
34
|
-
culture: null,
|
35
|
-
icons: {
|
36
|
-
down: "ui-icon-triangle-1-s",
|
37
|
-
up: "ui-icon-triangle-1-n"
|
38
|
-
},
|
39
|
-
incremental: true,
|
40
|
-
max: null,
|
41
|
-
min: null,
|
42
|
-
numberFormat: null,
|
43
|
-
page: 10,
|
44
|
-
step: 1,
|
45
|
-
|
46
|
-
change: null,
|
47
|
-
spin: null,
|
48
|
-
start: null,
|
49
|
-
stop: null
|
50
|
-
},
|
51
|
-
|
52
|
-
_create: function() {
|
53
|
-
// handle string values that need to be parsed
|
54
|
-
this._setOption( "max", this.options.max );
|
55
|
-
this._setOption( "min", this.options.min );
|
56
|
-
this._setOption( "step", this.options.step );
|
57
|
-
|
58
|
-
// format the value, but don't constrain
|
59
|
-
this._value( this.element.val(), true );
|
60
|
-
|
61
|
-
this._draw();
|
62
|
-
this._on( this._events );
|
63
|
-
this._refresh();
|
64
|
-
|
65
|
-
// turning off autocomplete prevents the browser from remembering the
|
66
|
-
// value when navigating through history, so we re-enable autocomplete
|
67
|
-
// if the page is unloaded before the widget is destroyed. #7790
|
68
|
-
this._on( this.window, {
|
69
|
-
beforeunload: function() {
|
70
|
-
this.element.removeAttr( "autocomplete" );
|
71
|
-
}
|
72
|
-
});
|
73
|
-
},
|
74
|
-
|
75
|
-
_getCreateOptions: function() {
|
76
|
-
var options = {},
|
77
|
-
element = this.element;
|
78
|
-
|
79
|
-
$.each( [ "min", "max", "step" ], function( i, option ) {
|
80
|
-
var value = element.attr( option );
|
81
|
-
if ( value !== undefined && value.length ) {
|
82
|
-
options[ option ] = value;
|
83
|
-
}
|
84
|
-
});
|
85
|
-
|
86
|
-
return options;
|
87
|
-
},
|
88
|
-
|
89
|
-
_events: {
|
90
|
-
keydown: function( event ) {
|
91
|
-
if ( this._start( event ) && this._keydown( event ) ) {
|
92
|
-
event.preventDefault();
|
93
|
-
}
|
94
|
-
},
|
95
|
-
keyup: "_stop",
|
96
|
-
focus: function() {
|
97
|
-
this.previous = this.element.val();
|
98
|
-
},
|
99
|
-
blur: function( event ) {
|
100
|
-
if ( this.cancelBlur ) {
|
101
|
-
delete this.cancelBlur;
|
102
|
-
return;
|
103
|
-
}
|
104
|
-
|
105
|
-
this._stop();
|
106
|
-
this._refresh();
|
107
|
-
if ( this.previous !== this.element.val() ) {
|
108
|
-
this._trigger( "change", event );
|
109
|
-
}
|
110
|
-
},
|
111
|
-
mousewheel: function( event, delta ) {
|
112
|
-
if ( !delta ) {
|
113
|
-
return;
|
114
|
-
}
|
115
|
-
if ( !this.spinning && !this._start( event ) ) {
|
116
|
-
return false;
|
117
|
-
}
|
118
|
-
|
119
|
-
this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
|
120
|
-
clearTimeout( this.mousewheelTimer );
|
121
|
-
this.mousewheelTimer = this._delay(function() {
|
122
|
-
if ( this.spinning ) {
|
123
|
-
this._stop( event );
|
124
|
-
}
|
125
|
-
}, 100 );
|
126
|
-
event.preventDefault();
|
127
|
-
},
|
128
|
-
"mousedown .ui-spinner-button": function( event ) {
|
129
|
-
var previous;
|
130
|
-
|
131
|
-
// We never want the buttons to have focus; whenever the user is
|
132
|
-
// interacting with the spinner, the focus should be on the input.
|
133
|
-
// If the input is focused then this.previous is properly set from
|
134
|
-
// when the input first received focus. If the input is not focused
|
135
|
-
// then we need to set this.previous based on the value before spinning.
|
136
|
-
previous = this.element[0] === this.document[0].activeElement ?
|
137
|
-
this.previous : this.element.val();
|
138
|
-
function checkFocus() {
|
139
|
-
var isActive = this.element[0] === this.document[0].activeElement;
|
140
|
-
if ( !isActive ) {
|
141
|
-
this.element.focus();
|
142
|
-
this.previous = previous;
|
143
|
-
// support: IE
|
144
|
-
// IE sets focus asynchronously, so we need to check if focus
|
145
|
-
// moved off of the input because the user clicked on the button.
|
146
|
-
this._delay(function() {
|
147
|
-
this.previous = previous;
|
148
|
-
});
|
149
|
-
}
|
150
|
-
}
|
151
|
-
|
152
|
-
// ensure focus is on (or stays on) the text field
|
153
|
-
event.preventDefault();
|
154
|
-
checkFocus.call( this );
|
155
|
-
|
156
|
-
// support: IE
|
157
|
-
// IE doesn't prevent moving focus even with event.preventDefault()
|
158
|
-
// so we set a flag to know when we should ignore the blur event
|
159
|
-
// and check (again) if focus moved off of the input.
|
160
|
-
this.cancelBlur = true;
|
161
|
-
this._delay(function() {
|
162
|
-
delete this.cancelBlur;
|
163
|
-
checkFocus.call( this );
|
164
|
-
});
|
165
|
-
|
166
|
-
if ( this._start( event ) === false ) {
|
167
|
-
return;
|
168
|
-
}
|
169
|
-
|
170
|
-
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
|
171
|
-
},
|
172
|
-
"mouseup .ui-spinner-button": "_stop",
|
173
|
-
"mouseenter .ui-spinner-button": function( event ) {
|
174
|
-
// button will add ui-state-active if mouse was down while mouseleave and kept down
|
175
|
-
if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
|
176
|
-
return;
|
177
|
-
}
|
178
|
-
|
179
|
-
if ( this._start( event ) === false ) {
|
180
|
-
return false;
|
181
|
-
}
|
182
|
-
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
|
183
|
-
},
|
184
|
-
// TODO: do we really want to consider this a stop?
|
185
|
-
// shouldn't we just stop the repeater and wait until mouseup before
|
186
|
-
// we trigger the stop event?
|
187
|
-
"mouseleave .ui-spinner-button": "_stop"
|
188
|
-
},
|
189
|
-
|
190
|
-
_draw: function() {
|
191
|
-
var uiSpinner = this.uiSpinner = this.element
|
192
|
-
.addClass( "ui-spinner-input" )
|
193
|
-
.attr( "autocomplete", "off" )
|
194
|
-
.wrap( this._uiSpinnerHtml() )
|
195
|
-
.parent()
|
196
|
-
// add buttons
|
197
|
-
.append( this._buttonHtml() );
|
198
|
-
|
199
|
-
this.element.attr( "role", "spinbutton" );
|
200
|
-
|
201
|
-
// button bindings
|
202
|
-
this.buttons = uiSpinner.find( ".ui-spinner-button" )
|
203
|
-
.attr( "tabIndex", -1 )
|
204
|
-
.button()
|
205
|
-
.removeClass( "ui-corner-all" );
|
206
|
-
|
207
|
-
// IE 6 doesn't understand height: 50% for the buttons
|
208
|
-
// unless the wrapper has an explicit height
|
209
|
-
if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
|
210
|
-
uiSpinner.height() > 0 ) {
|
211
|
-
uiSpinner.height( uiSpinner.height() );
|
212
|
-
}
|
213
|
-
|
214
|
-
// disable spinner if element was already disabled
|
215
|
-
if ( this.options.disabled ) {
|
216
|
-
this.disable();
|
217
|
-
}
|
218
|
-
},
|
219
|
-
|
220
|
-
_keydown: function( event ) {
|
221
|
-
var options = this.options,
|
222
|
-
keyCode = $.ui.keyCode;
|
223
|
-
|
224
|
-
switch ( event.keyCode ) {
|
225
|
-
case keyCode.UP:
|
226
|
-
this._repeat( null, 1, event );
|
227
|
-
return true;
|
228
|
-
case keyCode.DOWN:
|
229
|
-
this._repeat( null, -1, event );
|
230
|
-
return true;
|
231
|
-
case keyCode.PAGE_UP:
|
232
|
-
this._repeat( null, options.page, event );
|
233
|
-
return true;
|
234
|
-
case keyCode.PAGE_DOWN:
|
235
|
-
this._repeat( null, -options.page, event );
|
236
|
-
return true;
|
237
|
-
}
|
238
|
-
|
239
|
-
return false;
|
240
|
-
},
|
241
|
-
|
242
|
-
_uiSpinnerHtml: function() {
|
243
|
-
return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
|
244
|
-
},
|
245
|
-
|
246
|
-
_buttonHtml: function() {
|
247
|
-
return "" +
|
248
|
-
"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
|
249
|
-
"<span class='ui-icon " + this.options.icons.up + "'>▲</span>" +
|
250
|
-
"</a>" +
|
251
|
-
"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
|
252
|
-
"<span class='ui-icon " + this.options.icons.down + "'>▼</span>" +
|
253
|
-
"</a>";
|
254
|
-
},
|
255
|
-
|
256
|
-
_start: function( event ) {
|
257
|
-
if ( !this.spinning && this._trigger( "start", event ) === false ) {
|
258
|
-
return false;
|
259
|
-
}
|
260
|
-
|
261
|
-
if ( !this.counter ) {
|
262
|
-
this.counter = 1;
|
263
|
-
}
|
264
|
-
this.spinning = true;
|
265
|
-
return true;
|
266
|
-
},
|
267
|
-
|
268
|
-
_repeat: function( i, steps, event ) {
|
269
|
-
i = i || 500;
|
270
|
-
|
271
|
-
clearTimeout( this.timer );
|
272
|
-
this.timer = this._delay(function() {
|
273
|
-
this._repeat( 40, steps, event );
|
274
|
-
}, i );
|
275
|
-
|
276
|
-
this._spin( steps * this.options.step, event );
|
277
|
-
},
|
278
|
-
|
279
|
-
_spin: function( step, event ) {
|
280
|
-
var value = this.value() || 0;
|
281
|
-
|
282
|
-
if ( !this.counter ) {
|
283
|
-
this.counter = 1;
|
284
|
-
}
|
285
|
-
|
286
|
-
value = this._adjustValue( value + step * this._increment( this.counter ) );
|
287
|
-
|
288
|
-
if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
|
289
|
-
this._value( value );
|
290
|
-
this.counter++;
|
291
|
-
}
|
292
|
-
},
|
293
|
-
|
294
|
-
_increment: function( i ) {
|
295
|
-
var incremental = this.options.incremental;
|
296
|
-
|
297
|
-
if ( incremental ) {
|
298
|
-
return $.isFunction( incremental ) ?
|
299
|
-
incremental( i ) :
|
300
|
-
Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
|
301
|
-
}
|
302
|
-
|
303
|
-
return 1;
|
304
|
-
},
|
305
|
-
|
306
|
-
_precision: function() {
|
307
|
-
var precision = this._precisionOf( this.options.step );
|
308
|
-
if ( this.options.min !== null ) {
|
309
|
-
precision = Math.max( precision, this._precisionOf( this.options.min ) );
|
310
|
-
}
|
311
|
-
return precision;
|
312
|
-
},
|
313
|
-
|
314
|
-
_precisionOf: function( num ) {
|
315
|
-
var str = num.toString(),
|
316
|
-
decimal = str.indexOf( "." );
|
317
|
-
return decimal === -1 ? 0 : str.length - decimal - 1;
|
318
|
-
},
|
319
|
-
|
320
|
-
_adjustValue: function( value ) {
|
321
|
-
var base, aboveMin,
|
322
|
-
options = this.options;
|
323
|
-
|
324
|
-
// make sure we're at a valid step
|
325
|
-
// - find out where we are relative to the base (min or 0)
|
326
|
-
base = options.min !== null ? options.min : 0;
|
327
|
-
aboveMin = value - base;
|
328
|
-
// - round to the nearest step
|
329
|
-
aboveMin = Math.round(aboveMin / options.step) * options.step;
|
330
|
-
// - rounding is based on 0, so adjust back to our base
|
331
|
-
value = base + aboveMin;
|
332
|
-
|
333
|
-
// fix precision from bad JS floating point math
|
334
|
-
value = parseFloat( value.toFixed( this._precision() ) );
|
335
|
-
|
336
|
-
// clamp the value
|
337
|
-
if ( options.max !== null && value > options.max) {
|
338
|
-
return options.max;
|
339
|
-
}
|
340
|
-
if ( options.min !== null && value < options.min ) {
|
341
|
-
return options.min;
|
342
|
-
}
|
343
|
-
|
344
|
-
return value;
|
345
|
-
},
|
346
|
-
|
347
|
-
_stop: function( event ) {
|
348
|
-
if ( !this.spinning ) {
|
349
|
-
return;
|
350
|
-
}
|
351
|
-
|
352
|
-
clearTimeout( this.timer );
|
353
|
-
clearTimeout( this.mousewheelTimer );
|
354
|
-
this.counter = 0;
|
355
|
-
this.spinning = false;
|
356
|
-
this._trigger( "stop", event );
|
357
|
-
},
|
358
|
-
|
359
|
-
_setOption: function( key, value ) {
|
360
|
-
if ( key === "culture" || key === "numberFormat" ) {
|
361
|
-
var prevValue = this._parse( this.element.val() );
|
362
|
-
this.options[ key ] = value;
|
363
|
-
this.element.val( this._format( prevValue ) );
|
364
|
-
return;
|
365
|
-
}
|
366
|
-
|
367
|
-
if ( key === "max" || key === "min" || key === "step" ) {
|
368
|
-
if ( typeof value === "string" ) {
|
369
|
-
value = this._parse( value );
|
370
|
-
}
|
371
|
-
}
|
372
|
-
if ( key === "icons" ) {
|
373
|
-
this.buttons.first().find( ".ui-icon" )
|
374
|
-
.removeClass( this.options.icons.up )
|
375
|
-
.addClass( value.up );
|
376
|
-
this.buttons.last().find( ".ui-icon" )
|
377
|
-
.removeClass( this.options.icons.down )
|
378
|
-
.addClass( value.down );
|
379
|
-
}
|
380
|
-
|
381
|
-
this._super( key, value );
|
382
|
-
|
383
|
-
if ( key === "disabled" ) {
|
384
|
-
if ( value ) {
|
385
|
-
this.element.prop( "disabled", true );
|
386
|
-
this.buttons.button( "disable" );
|
387
|
-
} else {
|
388
|
-
this.element.prop( "disabled", false );
|
389
|
-
this.buttons.button( "enable" );
|
390
|
-
}
|
391
|
-
}
|
392
|
-
},
|
393
|
-
|
394
|
-
_setOptions: modifier(function( options ) {
|
395
|
-
this._super( options );
|
396
|
-
this._value( this.element.val() );
|
397
|
-
}),
|
398
|
-
|
399
|
-
_parse: function( val ) {
|
400
|
-
if ( typeof val === "string" && val !== "" ) {
|
401
|
-
val = window.Globalize && this.options.numberFormat ?
|
402
|
-
Globalize.parseFloat( val, 10, this.options.culture ) : +val;
|
403
|
-
}
|
404
|
-
return val === "" || isNaN( val ) ? null : val;
|
405
|
-
},
|
406
|
-
|
407
|
-
_format: function( value ) {
|
408
|
-
if ( value === "" ) {
|
409
|
-
return "";
|
410
|
-
}
|
411
|
-
return window.Globalize && this.options.numberFormat ?
|
412
|
-
Globalize.format( value, this.options.numberFormat, this.options.culture ) :
|
413
|
-
value;
|
414
|
-
},
|
415
|
-
|
416
|
-
_refresh: function() {
|
417
|
-
this.element.attr({
|
418
|
-
"aria-valuemin": this.options.min,
|
419
|
-
"aria-valuemax": this.options.max,
|
420
|
-
// TODO: what should we do with values that can't be parsed?
|
421
|
-
"aria-valuenow": this._parse( this.element.val() )
|
422
|
-
});
|
423
|
-
},
|
424
|
-
|
425
|
-
// update the value without triggering change
|
426
|
-
_value: function( value, allowAny ) {
|
427
|
-
var parsed;
|
428
|
-
if ( value !== "" ) {
|
429
|
-
parsed = this._parse( value );
|
430
|
-
if ( parsed !== null ) {
|
431
|
-
if ( !allowAny ) {
|
432
|
-
parsed = this._adjustValue( parsed );
|
433
|
-
}
|
434
|
-
value = this._format( parsed );
|
435
|
-
}
|
436
|
-
}
|
437
|
-
this.element.val( value );
|
438
|
-
this._refresh();
|
439
|
-
},
|
440
|
-
|
441
|
-
_destroy: function() {
|
442
|
-
this.element
|
443
|
-
.removeClass( "ui-spinner-input" )
|
444
|
-
.prop( "disabled", false )
|
445
|
-
.removeAttr( "autocomplete" )
|
446
|
-
.removeAttr( "role" )
|
447
|
-
.removeAttr( "aria-valuemin" )
|
448
|
-
.removeAttr( "aria-valuemax" )
|
449
|
-
.removeAttr( "aria-valuenow" );
|
450
|
-
this.uiSpinner.replaceWith( this.element );
|
451
|
-
},
|
452
|
-
|
453
|
-
stepUp: modifier(function( steps ) {
|
454
|
-
this._stepUp( steps );
|
455
|
-
}),
|
456
|
-
_stepUp: function( steps ) {
|
457
|
-
if ( this._start() ) {
|
458
|
-
this._spin( (steps || 1) * this.options.step );
|
459
|
-
this._stop();
|
460
|
-
}
|
461
|
-
},
|
462
|
-
|
463
|
-
stepDown: modifier(function( steps ) {
|
464
|
-
this._stepDown( steps );
|
465
|
-
}),
|
466
|
-
_stepDown: function( steps ) {
|
467
|
-
if ( this._start() ) {
|
468
|
-
this._spin( (steps || 1) * -this.options.step );
|
469
|
-
this._stop();
|
470
|
-
}
|
471
|
-
},
|
472
|
-
|
473
|
-
pageUp: modifier(function( pages ) {
|
474
|
-
this._stepUp( (pages || 1) * this.options.page );
|
475
|
-
}),
|
476
|
-
|
477
|
-
pageDown: modifier(function( pages ) {
|
478
|
-
this._stepDown( (pages || 1) * this.options.page );
|
479
|
-
}),
|
480
|
-
|
481
|
-
value: function( newVal ) {
|
482
|
-
if ( !arguments.length ) {
|
483
|
-
return this._parse( this.element.val() );
|
484
|
-
}
|
485
|
-
modifier( this._value ).call( this, newVal );
|
486
|
-
},
|
487
|
-
|
488
|
-
widget: function() {
|
489
|
-
return this.uiSpinner;
|
490
|
-
}
|
491
|
-
});
|
492
|
-
|
493
|
-
}( jQuery ) );
|
1
|
+
/*! jQuery UI - v1.10.3 - 2013-05-03
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
|
4
|
+
(function(t){function e(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.widget("ui.spinner",{version:"1.10.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e={},i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);void 0!==n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var t=this.element[0]===this.document[0].activeElement;t||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var t=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=t.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*t.height())&&t.height()>0&&t.height(t.height()),this.options.disabled&&this.disable()},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>▲</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>▼</span>"+"</a>"},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){if("culture"===t||"numberFormat"===t){var i=this._parse(this.element.val());return this.options[t]=e,this.element.val(this._format(i)),void 0}("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(e.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(e.down)),this._super(t,e),"disabled"===t&&(e?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:e(function(t){this._super(t),this._value(this.element.val())}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:e(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:e(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:e(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:e(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(e(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})})(jQuery);
|