sn-jquery-ui-rails 6.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +2 -0
  5. data/Gemfile +3 -0
  6. data/History.md +168 -0
  7. data/License.txt +2 -0
  8. data/README.md +311 -0
  9. data/Rakefile +258 -0
  10. data/VERSIONS.md +39 -0
  11. data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  12. data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
  13. data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
  14. data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
  15. data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
  16. data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
  17. data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  18. data/app/assets/javascripts/jquery-ui/core.js +15 -0
  19. data/app/assets/javascripts/jquery-ui/data.js +41 -0
  20. data/app/assets/javascripts/jquery-ui/disable-selection.js +48 -0
  21. data/app/assets/javascripts/jquery-ui/effect.all.js +15 -0
  22. data/app/assets/javascripts/jquery-ui/effect.js +1637 -0
  23. data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +73 -0
  24. data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +113 -0
  25. data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +68 -0
  26. data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +72 -0
  27. data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +114 -0
  28. data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +50 -0
  29. data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +92 -0
  30. data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +60 -0
  31. data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +46 -0
  32. data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +67 -0
  33. data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +60 -0
  34. data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +77 -0
  35. data/app/assets/javascripts/jquery-ui/effects/effect-size.js +194 -0
  36. data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +79 -0
  37. data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +43 -0
  38. data/app/assets/javascripts/jquery-ui/escape-selector.js +23 -0
  39. data/app/assets/javascripts/jquery-ui/focusable.js +86 -0
  40. data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +80 -0
  41. data/app/assets/javascripts/jquery-ui/form.js +22 -0
  42. data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +37 -0
  43. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +39 -0
  44. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +39 -0
  45. data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +37 -0
  46. data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +37 -0
  47. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +38 -0
  48. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +37 -0
  49. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +37 -0
  50. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +37 -0
  51. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +45 -0
  52. data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +37 -0
  53. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +37 -0
  54. data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +37 -0
  55. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +37 -0
  56. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +37 -0
  57. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +37 -0
  58. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +37 -0
  59. data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +37 -0
  60. data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +45 -0
  61. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +36 -0
  62. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +73 -0
  63. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +37 -0
  64. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +45 -0
  65. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +37 -0
  66. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +37 -0
  67. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +39 -0
  68. data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +37 -0
  69. data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +37 -0
  70. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +37 -0
  71. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +37 -0
  72. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +36 -0
  73. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +37 -0
  74. data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +37 -0
  75. data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +45 -0
  76. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +37 -0
  77. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +37 -0
  78. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +37 -0
  79. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +48 -0
  80. data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +37 -0
  81. data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +37 -0
  82. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +37 -0
  83. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +38 -0
  84. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +45 -0
  85. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +45 -0
  86. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +45 -0
  87. data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +37 -0
  88. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +37 -0
  89. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +37 -0
  90. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +49 -0
  91. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +37 -0
  92. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +37 -0
  93. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +49 -0
  94. data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +50 -0
  95. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +37 -0
  96. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +45 -0
  97. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +44 -0
  98. data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +61 -0
  99. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +40 -0
  100. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +37 -0
  101. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +37 -0
  102. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +38 -0
  103. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +37 -0
  104. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +37 -0
  105. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +37 -0
  106. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +37 -0
  107. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +53 -0
  108. data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +37 -0
  109. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +37 -0
  110. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +37 -0
  111. data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +38 -0
  112. data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +37 -0
  113. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +37 -0
  114. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +37 -0
  115. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +37 -0
  116. data/app/assets/javascripts/jquery-ui/ie.js +17 -0
  117. data/app/assets/javascripts/jquery-ui/jquery-1-7.js +91 -0
  118. data/app/assets/javascripts/jquery-ui/keycode.js +47 -0
  119. data/app/assets/javascripts/jquery-ui/labels.js +65 -0
  120. data/app/assets/javascripts/jquery-ui/plugin.js +46 -0
  121. data/app/assets/javascripts/jquery-ui/position.js +500 -0
  122. data/app/assets/javascripts/jquery-ui/safe-active-element.js +42 -0
  123. data/app/assets/javascripts/jquery-ui/safe-blur.js +23 -0
  124. data/app/assets/javascripts/jquery-ui/scroll-parent.js +47 -0
  125. data/app/assets/javascripts/jquery-ui/tabbable.js +38 -0
  126. data/app/assets/javascripts/jquery-ui/unique-id.js +51 -0
  127. data/app/assets/javascripts/jquery-ui/version.js +17 -0
  128. data/app/assets/javascripts/jquery-ui/widget.js +735 -0
  129. data/app/assets/javascripts/jquery-ui/widgets/accordion.js +618 -0
  130. data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +689 -0
  131. data/app/assets/javascripts/jquery-ui/widgets/button.js +391 -0
  132. data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +291 -0
  133. data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +300 -0
  134. data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +2123 -0
  135. data/app/assets/javascripts/jquery-ui/widgets/dialog.js +954 -0
  136. data/app/assets/javascripts/jquery-ui/widgets/draggable.js +1259 -0
  137. data/app/assets/javascripts/jquery-ui/widgets/droppable.js +502 -0
  138. data/app/assets/javascripts/jquery-ui/widgets/menu.js +680 -0
  139. data/app/assets/javascripts/jquery-ui/widgets/mouse.js +230 -0
  140. data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +181 -0
  141. data/app/assets/javascripts/jquery-ui/widgets/resizable.js +1207 -0
  142. data/app/assets/javascripts/jquery-ui/widgets/selectable.js +314 -0
  143. data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +697 -0
  144. data/app/assets/javascripts/jquery-ui/widgets/slider.js +757 -0
  145. data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1561 -0
  146. data/app/assets/javascripts/jquery-ui/widgets/spinner.js +581 -0
  147. data/app/assets/javascripts/jquery-ui/widgets/tabs.js +931 -0
  148. data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +526 -0
  149. data/app/assets/javascripts/jquery-ui.js +56 -0
  150. data/app/assets/stylesheets/jquery-ui/accordion.css +26 -0
  151. data/app/assets/stylesheets/jquery-ui/all.css +14 -0
  152. data/app/assets/stylesheets/jquery-ui/autocomplete.css +19 -0
  153. data/app/assets/stylesheets/jquery-ui/base.css +32 -0
  154. data/app/assets/stylesheets/jquery-ui/button.css +85 -0
  155. data/app/assets/stylesheets/jquery-ui/checkboxradio.css +37 -0
  156. data/app/assets/stylesheets/jquery-ui/controlgroup.css +68 -0
  157. data/app/assets/stylesheets/jquery-ui/core.css +100 -0
  158. data/app/assets/stylesheets/jquery-ui/datepicker.css +188 -0
  159. data/app/assets/stylesheets/jquery-ui/dialog.css +104 -0
  160. data/app/assets/stylesheets/jquery-ui/draggable.css +15 -0
  161. data/app/assets/stylesheets/jquery-ui/menu.css +67 -0
  162. data/app/assets/stylesheets/jquery-ui/progressbar.css +31 -0
  163. data/app/assets/stylesheets/jquery-ui/resizable.css +81 -0
  164. data/app/assets/stylesheets/jquery-ui/selectable.css +20 -0
  165. data/app/assets/stylesheets/jquery-ui/selectmenu.css +53 -0
  166. data/app/assets/stylesheets/jquery-ui/slider.css +78 -0
  167. data/app/assets/stylesheets/jquery-ui/sortable.css +15 -0
  168. data/app/assets/stylesheets/jquery-ui/spinner.css +55 -0
  169. data/app/assets/stylesheets/jquery-ui/tabs.css +54 -0
  170. data/app/assets/stylesheets/jquery-ui/theme.css.erb +453 -0
  171. data/app/assets/stylesheets/jquery-ui/tooltip.css +22 -0
  172. data/app/assets/stylesheets/jquery-ui.css +1 -0
  173. data/lib/jquery/ui/rails/engine.rb +8 -0
  174. data/lib/jquery/ui/rails/version.rb +8 -0
  175. data/lib/jquery/ui/rails.rb +2 -0
  176. data/lib/jquery-ui-rails.rb +1 -0
  177. metadata +248 -0
@@ -0,0 +1,230 @@
1
+ //= require jquery-ui/ie
2
+ //= require jquery-ui/version
3
+ //= require jquery-ui/widget
4
+
5
+ /*!
6
+ * jQuery UI Mouse 1.12.1
7
+ * http://jqueryui.com
8
+ *
9
+ * Copyright jQuery Foundation and other contributors
10
+ * Released under the MIT license.
11
+ * http://jquery.org/license
12
+ */
13
+
14
+ //>>label: Mouse
15
+ //>>group: Widgets
16
+ //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
17
+ //>>docs: http://api.jqueryui.com/mouse/
18
+
19
+ ( function( factory ) {
20
+ if ( typeof define === "function" && define.amd ) {
21
+
22
+ // AMD. Register as an anonymous module.
23
+ define( [
24
+ "jquery",
25
+ "../ie",
26
+ "../version",
27
+ "../widget"
28
+ ], factory );
29
+ } else {
30
+
31
+ // Browser globals
32
+ factory( jQuery );
33
+ }
34
+ }( function( $ ) {
35
+
36
+ var mouseHandled = false;
37
+ $( document ).on( "mouseup", function() {
38
+ mouseHandled = false;
39
+ } );
40
+
41
+ return $.widget( "ui.mouse", {
42
+ version: "1.12.1",
43
+ options: {
44
+ cancel: "input, textarea, button, select, option",
45
+ distance: 1,
46
+ delay: 0
47
+ },
48
+ _mouseInit: function() {
49
+ var that = this;
50
+
51
+ this.element
52
+ .on( "mousedown." + this.widgetName, function( event ) {
53
+ return that._mouseDown( event );
54
+ } )
55
+ .on( "click." + this.widgetName, function( event ) {
56
+ if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
57
+ $.removeData( event.target, that.widgetName + ".preventClickEvent" );
58
+ event.stopImmediatePropagation();
59
+ return false;
60
+ }
61
+ } );
62
+
63
+ this.started = false;
64
+ },
65
+
66
+ // TODO: make sure destroying one instance of mouse doesn't mess with
67
+ // other instances of mouse
68
+ _mouseDestroy: function() {
69
+ this.element.off( "." + this.widgetName );
70
+ if ( this._mouseMoveDelegate ) {
71
+ this.document
72
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
73
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
74
+ }
75
+ },
76
+
77
+ _mouseDown: function( event ) {
78
+
79
+ // don't let more than one widget handle mouseStart
80
+ if ( mouseHandled ) {
81
+ return;
82
+ }
83
+
84
+ this._mouseMoved = false;
85
+
86
+ // We may have missed mouseup (out of window)
87
+ ( this._mouseStarted && this._mouseUp( event ) );
88
+
89
+ this._mouseDownEvent = event;
90
+
91
+ var that = this,
92
+ btnIsLeft = ( event.which === 1 ),
93
+
94
+ // event.target.nodeName works around a bug in IE 8 with
95
+ // disabled inputs (#7620)
96
+ elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
97
+ $( event.target ).closest( this.options.cancel ).length : false );
98
+ if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
99
+ return true;
100
+ }
101
+
102
+ this.mouseDelayMet = !this.options.delay;
103
+ if ( !this.mouseDelayMet ) {
104
+ this._mouseDelayTimer = setTimeout( function() {
105
+ that.mouseDelayMet = true;
106
+ }, this.options.delay );
107
+ }
108
+
109
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
110
+ this._mouseStarted = ( this._mouseStart( event ) !== false );
111
+ if ( !this._mouseStarted ) {
112
+ event.preventDefault();
113
+ return true;
114
+ }
115
+ }
116
+
117
+ // Click event may never have fired (Gecko & Opera)
118
+ if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
119
+ $.removeData( event.target, this.widgetName + ".preventClickEvent" );
120
+ }
121
+
122
+ // These delegates are required to keep context
123
+ this._mouseMoveDelegate = function( event ) {
124
+ return that._mouseMove( event );
125
+ };
126
+ this._mouseUpDelegate = function( event ) {
127
+ return that._mouseUp( event );
128
+ };
129
+
130
+ this.document
131
+ .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
132
+ .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
133
+
134
+ event.preventDefault();
135
+
136
+ mouseHandled = true;
137
+ return true;
138
+ },
139
+
140
+ _mouseMove: function( event ) {
141
+
142
+ // Only check for mouseups outside the document if you've moved inside the document
143
+ // at least once. This prevents the firing of mouseup in the case of IE<9, which will
144
+ // fire a mousemove event if content is placed under the cursor. See #7778
145
+ // Support: IE <9
146
+ if ( this._mouseMoved ) {
147
+
148
+ // IE mouseup check - mouseup happened when mouse was out of window
149
+ if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
150
+ !event.button ) {
151
+ return this._mouseUp( event );
152
+
153
+ // Iframe mouseup check - mouseup occurred in another document
154
+ } else if ( !event.which ) {
155
+
156
+ // Support: Safari <=8 - 9
157
+ // Safari sets which to 0 if you press any of the following keys
158
+ // during a drag (#14461)
159
+ if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
160
+ event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
161
+ this.ignoreMissingWhich = true;
162
+ } else if ( !this.ignoreMissingWhich ) {
163
+ return this._mouseUp( event );
164
+ }
165
+ }
166
+ }
167
+
168
+ if ( event.which || event.button ) {
169
+ this._mouseMoved = true;
170
+ }
171
+
172
+ if ( this._mouseStarted ) {
173
+ this._mouseDrag( event );
174
+ return event.preventDefault();
175
+ }
176
+
177
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
178
+ this._mouseStarted =
179
+ ( this._mouseStart( this._mouseDownEvent, event ) !== false );
180
+ ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
181
+ }
182
+
183
+ return !this._mouseStarted;
184
+ },
185
+
186
+ _mouseUp: function( event ) {
187
+ this.document
188
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
189
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
190
+
191
+ if ( this._mouseStarted ) {
192
+ this._mouseStarted = false;
193
+
194
+ if ( event.target === this._mouseDownEvent.target ) {
195
+ $.data( event.target, this.widgetName + ".preventClickEvent", true );
196
+ }
197
+
198
+ this._mouseStop( event );
199
+ }
200
+
201
+ if ( this._mouseDelayTimer ) {
202
+ clearTimeout( this._mouseDelayTimer );
203
+ delete this._mouseDelayTimer;
204
+ }
205
+
206
+ this.ignoreMissingWhich = false;
207
+ mouseHandled = false;
208
+ event.preventDefault();
209
+ },
210
+
211
+ _mouseDistanceMet: function( event ) {
212
+ return ( Math.max(
213
+ Math.abs( this._mouseDownEvent.pageX - event.pageX ),
214
+ Math.abs( this._mouseDownEvent.pageY - event.pageY )
215
+ ) >= this.options.distance
216
+ );
217
+ },
218
+
219
+ _mouseDelayMet: function( /* event */ ) {
220
+ return this.mouseDelayMet;
221
+ },
222
+
223
+ // These are placeholder methods, to be overriden by extending plugin
224
+ _mouseStart: function( /* event */ ) {},
225
+ _mouseDrag: function( /* event */ ) {},
226
+ _mouseStop: function( /* event */ ) {},
227
+ _mouseCapture: function( /* event */ ) { return true; }
228
+ } );
229
+
230
+ } ) );
@@ -0,0 +1,181 @@
1
+ //= require jquery-ui/version
2
+ //= require jquery-ui/widget
3
+
4
+ /*!
5
+ * jQuery UI Progressbar 1.12.1
6
+ * http://jqueryui.com
7
+ *
8
+ * Copyright jQuery Foundation and other contributors
9
+ * Released under the MIT license.
10
+ * http://jquery.org/license
11
+ */
12
+
13
+ //>>label: Progressbar
14
+ //>>group: Widgets
15
+ // jscs:disable maximumLineLength
16
+ //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
17
+ // jscs:enable maximumLineLength
18
+ //>>docs: http://api.jqueryui.com/progressbar/
19
+ //>>demos: http://jqueryui.com/progressbar/
20
+ //>>css.structure: ../../themes/base/core.css
21
+ //>>css.structure: ../../themes/base/progressbar.css
22
+ //>>css.theme: ../../themes/base/theme.css
23
+
24
+ ( function( factory ) {
25
+ if ( typeof define === "function" && define.amd ) {
26
+
27
+ // AMD. Register as an anonymous module.
28
+ define( [
29
+ "jquery",
30
+ "../version",
31
+ "../widget"
32
+ ], factory );
33
+ } else {
34
+
35
+ // Browser globals
36
+ factory( jQuery );
37
+ }
38
+ }( function( $ ) {
39
+
40
+ return $.widget( "ui.progressbar", {
41
+ version: "1.12.1",
42
+ options: {
43
+ classes: {
44
+ "ui-progressbar": "ui-corner-all",
45
+ "ui-progressbar-value": "ui-corner-left",
46
+ "ui-progressbar-complete": "ui-corner-right"
47
+ },
48
+ max: 100,
49
+ value: 0,
50
+
51
+ change: null,
52
+ complete: null
53
+ },
54
+
55
+ min: 0,
56
+
57
+ _create: function() {
58
+
59
+ // Constrain initial value
60
+ this.oldValue = this.options.value = this._constrainedValue();
61
+
62
+ this.element.attr( {
63
+
64
+ // Only set static values; aria-valuenow and aria-valuemax are
65
+ // set inside _refreshValue()
66
+ role: "progressbar",
67
+ "aria-valuemin": this.min
68
+ } );
69
+ this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
70
+
71
+ this.valueDiv = $( "<div>" ).appendTo( this.element );
72
+ this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
73
+ this._refreshValue();
74
+ },
75
+
76
+ _destroy: function() {
77
+ this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
78
+
79
+ this.valueDiv.remove();
80
+ },
81
+
82
+ value: function( newValue ) {
83
+ if ( newValue === undefined ) {
84
+ return this.options.value;
85
+ }
86
+
87
+ this.options.value = this._constrainedValue( newValue );
88
+ this._refreshValue();
89
+ },
90
+
91
+ _constrainedValue: function( newValue ) {
92
+ if ( newValue === undefined ) {
93
+ newValue = this.options.value;
94
+ }
95
+
96
+ this.indeterminate = newValue === false;
97
+
98
+ // Sanitize value
99
+ if ( typeof newValue !== "number" ) {
100
+ newValue = 0;
101
+ }
102
+
103
+ return this.indeterminate ? false :
104
+ Math.min( this.options.max, Math.max( this.min, newValue ) );
105
+ },
106
+
107
+ _setOptions: function( options ) {
108
+
109
+ // Ensure "value" option is set after other values (like max)
110
+ var value = options.value;
111
+ delete options.value;
112
+
113
+ this._super( options );
114
+
115
+ this.options.value = this._constrainedValue( value );
116
+ this._refreshValue();
117
+ },
118
+
119
+ _setOption: function( key, value ) {
120
+ if ( key === "max" ) {
121
+
122
+ // Don't allow a max less than min
123
+ value = Math.max( this.min, value );
124
+ }
125
+ this._super( key, value );
126
+ },
127
+
128
+ _setOptionDisabled: function( value ) {
129
+ this._super( value );
130
+
131
+ this.element.attr( "aria-disabled", value );
132
+ this._toggleClass( null, "ui-state-disabled", !!value );
133
+ },
134
+
135
+ _percentage: function() {
136
+ return this.indeterminate ?
137
+ 100 :
138
+ 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
139
+ },
140
+
141
+ _refreshValue: function() {
142
+ var value = this.options.value,
143
+ percentage = this._percentage();
144
+
145
+ this.valueDiv
146
+ .toggle( this.indeterminate || value > this.min )
147
+ .width( percentage.toFixed( 0 ) + "%" );
148
+
149
+ this
150
+ ._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
151
+ value === this.options.max )
152
+ ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
153
+
154
+ if ( this.indeterminate ) {
155
+ this.element.removeAttr( "aria-valuenow" );
156
+ if ( !this.overlayDiv ) {
157
+ this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
158
+ this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
159
+ }
160
+ } else {
161
+ this.element.attr( {
162
+ "aria-valuemax": this.options.max,
163
+ "aria-valuenow": value
164
+ } );
165
+ if ( this.overlayDiv ) {
166
+ this.overlayDiv.remove();
167
+ this.overlayDiv = null;
168
+ }
169
+ }
170
+
171
+ if ( this.oldValue !== value ) {
172
+ this.oldValue = value;
173
+ this._trigger( "change" );
174
+ }
175
+ if ( value === this.options.max ) {
176
+ this._trigger( "complete" );
177
+ }
178
+ }
179
+ } );
180
+
181
+ } ) );