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,618 @@
1
+ //= require jquery-ui/version
2
+ //= require jquery-ui/keycode
3
+ //= require jquery-ui/unique-id
4
+ //= require jquery-ui/widget
5
+
6
+ /*!
7
+ * jQuery UI Accordion 1.12.1
8
+ * http://jqueryui.com
9
+ *
10
+ * Copyright jQuery Foundation and other contributors
11
+ * Released under the MIT license.
12
+ * http://jquery.org/license
13
+ */
14
+
15
+ //>>label: Accordion
16
+ //>>group: Widgets
17
+ // jscs:disable maximumLineLength
18
+ //>>description: Displays collapsible content panels for presenting information in a limited amount of space.
19
+ // jscs:enable maximumLineLength
20
+ //>>docs: http://api.jqueryui.com/accordion/
21
+ //>>demos: http://jqueryui.com/accordion/
22
+ //>>css.structure: ../../themes/base/core.css
23
+ //>>css.structure: ../../themes/base/accordion.css
24
+ //>>css.theme: ../../themes/base/theme.css
25
+
26
+ ( function( factory ) {
27
+ if ( typeof define === "function" && define.amd ) {
28
+
29
+ // AMD. Register as an anonymous module.
30
+ define( [
31
+ "jquery",
32
+ "../version",
33
+ "../keycode",
34
+ "../unique-id",
35
+ "../widget"
36
+ ], factory );
37
+ } else {
38
+
39
+ // Browser globals
40
+ factory( jQuery );
41
+ }
42
+ }( function( $ ) {
43
+
44
+ return $.widget( "ui.accordion", {
45
+ version: "1.12.1",
46
+ options: {
47
+ active: 0,
48
+ animate: {},
49
+ classes: {
50
+ "ui-accordion-header": "ui-corner-top",
51
+ "ui-accordion-header-collapsed": "ui-corner-all",
52
+ "ui-accordion-content": "ui-corner-bottom"
53
+ },
54
+ collapsible: false,
55
+ event: "click",
56
+ header: "> li > :first-child, > :not(li):even",
57
+ heightStyle: "auto",
58
+ icons: {
59
+ activeHeader: "ui-icon-triangle-1-s",
60
+ header: "ui-icon-triangle-1-e"
61
+ },
62
+
63
+ // Callbacks
64
+ activate: null,
65
+ beforeActivate: null
66
+ },
67
+
68
+ hideProps: {
69
+ borderTopWidth: "hide",
70
+ borderBottomWidth: "hide",
71
+ paddingTop: "hide",
72
+ paddingBottom: "hide",
73
+ height: "hide"
74
+ },
75
+
76
+ showProps: {
77
+ borderTopWidth: "show",
78
+ borderBottomWidth: "show",
79
+ paddingTop: "show",
80
+ paddingBottom: "show",
81
+ height: "show"
82
+ },
83
+
84
+ _create: function() {
85
+ var options = this.options;
86
+
87
+ this.prevShow = this.prevHide = $();
88
+ this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
89
+ this.element.attr( "role", "tablist" );
90
+
91
+ // Don't allow collapsible: false and active: false / null
92
+ if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
93
+ options.active = 0;
94
+ }
95
+
96
+ this._processPanels();
97
+
98
+ // handle negative values
99
+ if ( options.active < 0 ) {
100
+ options.active += this.headers.length;
101
+ }
102
+ this._refresh();
103
+ },
104
+
105
+ _getCreateEventData: function() {
106
+ return {
107
+ header: this.active,
108
+ panel: !this.active.length ? $() : this.active.next()
109
+ };
110
+ },
111
+
112
+ _createIcons: function() {
113
+ var icon, children,
114
+ icons = this.options.icons;
115
+
116
+ if ( icons ) {
117
+ icon = $( "<span>" );
118
+ this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
119
+ icon.prependTo( this.headers );
120
+ children = this.active.children( ".ui-accordion-header-icon" );
121
+ this._removeClass( children, icons.header )
122
+ ._addClass( children, null, icons.activeHeader )
123
+ ._addClass( this.headers, "ui-accordion-icons" );
124
+ }
125
+ },
126
+
127
+ _destroyIcons: function() {
128
+ this._removeClass( this.headers, "ui-accordion-icons" );
129
+ this.headers.children( ".ui-accordion-header-icon" ).remove();
130
+ },
131
+
132
+ _destroy: function() {
133
+ var contents;
134
+
135
+ // Clean up main element
136
+ this.element.removeAttr( "role" );
137
+
138
+ // Clean up headers
139
+ this.headers
140
+ .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
141
+ .removeUniqueId();
142
+
143
+ this._destroyIcons();
144
+
145
+ // Clean up content panels
146
+ contents = this.headers.next()
147
+ .css( "display", "" )
148
+ .removeAttr( "role aria-hidden aria-labelledby" )
149
+ .removeUniqueId();
150
+
151
+ if ( this.options.heightStyle !== "content" ) {
152
+ contents.css( "height", "" );
153
+ }
154
+ },
155
+
156
+ _setOption: function( key, value ) {
157
+ if ( key === "active" ) {
158
+
159
+ // _activate() will handle invalid values and update this.options
160
+ this._activate( value );
161
+ return;
162
+ }
163
+
164
+ if ( key === "event" ) {
165
+ if ( this.options.event ) {
166
+ this._off( this.headers, this.options.event );
167
+ }
168
+ this._setupEvents( value );
169
+ }
170
+
171
+ this._super( key, value );
172
+
173
+ // Setting collapsible: false while collapsed; open first panel
174
+ if ( key === "collapsible" && !value && this.options.active === false ) {
175
+ this._activate( 0 );
176
+ }
177
+
178
+ if ( key === "icons" ) {
179
+ this._destroyIcons();
180
+ if ( value ) {
181
+ this._createIcons();
182
+ }
183
+ }
184
+ },
185
+
186
+ _setOptionDisabled: function( value ) {
187
+ this._super( value );
188
+
189
+ this.element.attr( "aria-disabled", value );
190
+
191
+ // Support: IE8 Only
192
+ // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
193
+ // so we need to add the disabled class to the headers and panels
194
+ this._toggleClass( null, "ui-state-disabled", !!value );
195
+ this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
196
+ !!value );
197
+ },
198
+
199
+ _keydown: function( event ) {
200
+ if ( event.altKey || event.ctrlKey ) {
201
+ return;
202
+ }
203
+
204
+ var keyCode = $.ui.keyCode,
205
+ length = this.headers.length,
206
+ currentIndex = this.headers.index( event.target ),
207
+ toFocus = false;
208
+
209
+ switch ( event.keyCode ) {
210
+ case keyCode.RIGHT:
211
+ case keyCode.DOWN:
212
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
213
+ break;
214
+ case keyCode.LEFT:
215
+ case keyCode.UP:
216
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
217
+ break;
218
+ case keyCode.SPACE:
219
+ case keyCode.ENTER:
220
+ this._eventHandler( event );
221
+ break;
222
+ case keyCode.HOME:
223
+ toFocus = this.headers[ 0 ];
224
+ break;
225
+ case keyCode.END:
226
+ toFocus = this.headers[ length - 1 ];
227
+ break;
228
+ }
229
+
230
+ if ( toFocus ) {
231
+ $( event.target ).attr( "tabIndex", -1 );
232
+ $( toFocus ).attr( "tabIndex", 0 );
233
+ $( toFocus ).trigger( "focus" );
234
+ event.preventDefault();
235
+ }
236
+ },
237
+
238
+ _panelKeyDown: function( event ) {
239
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
240
+ $( event.currentTarget ).prev().trigger( "focus" );
241
+ }
242
+ },
243
+
244
+ refresh: function() {
245
+ var options = this.options;
246
+ this._processPanels();
247
+
248
+ // Was collapsed or no panel
249
+ if ( ( options.active === false && options.collapsible === true ) ||
250
+ !this.headers.length ) {
251
+ options.active = false;
252
+ this.active = $();
253
+
254
+ // active false only when collapsible is true
255
+ } else if ( options.active === false ) {
256
+ this._activate( 0 );
257
+
258
+ // was active, but active panel is gone
259
+ } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
260
+
261
+ // all remaining panel are disabled
262
+ if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
263
+ options.active = false;
264
+ this.active = $();
265
+
266
+ // activate previous panel
267
+ } else {
268
+ this._activate( Math.max( 0, options.active - 1 ) );
269
+ }
270
+
271
+ // was active, active panel still exists
272
+ } else {
273
+
274
+ // make sure active index is correct
275
+ options.active = this.headers.index( this.active );
276
+ }
277
+
278
+ this._destroyIcons();
279
+
280
+ this._refresh();
281
+ },
282
+
283
+ _processPanels: function() {
284
+ var prevHeaders = this.headers,
285
+ prevPanels = this.panels;
286
+
287
+ this.headers = this.element.find( this.options.header );
288
+ this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
289
+ "ui-state-default" );
290
+
291
+ this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
292
+ this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
293
+
294
+ // Avoid memory leaks (#10056)
295
+ if ( prevPanels ) {
296
+ this._off( prevHeaders.not( this.headers ) );
297
+ this._off( prevPanels.not( this.panels ) );
298
+ }
299
+ },
300
+
301
+ _refresh: function() {
302
+ var maxHeight,
303
+ options = this.options,
304
+ heightStyle = options.heightStyle,
305
+ parent = this.element.parent();
306
+
307
+ this.active = this._findActive( options.active );
308
+ this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
309
+ ._removeClass( this.active, "ui-accordion-header-collapsed" );
310
+ this._addClass( this.active.next(), "ui-accordion-content-active" );
311
+ this.active.next().show();
312
+
313
+ this.headers
314
+ .attr( "role", "tab" )
315
+ .each( function() {
316
+ var header = $( this ),
317
+ headerId = header.uniqueId().attr( "id" ),
318
+ panel = header.next(),
319
+ panelId = panel.uniqueId().attr( "id" );
320
+ header.attr( "aria-controls", panelId );
321
+ panel.attr( "aria-labelledby", headerId );
322
+ } )
323
+ .next()
324
+ .attr( "role", "tabpanel" );
325
+
326
+ this.headers
327
+ .not( this.active )
328
+ .attr( {
329
+ "aria-selected": "false",
330
+ "aria-expanded": "false",
331
+ tabIndex: -1
332
+ } )
333
+ .next()
334
+ .attr( {
335
+ "aria-hidden": "true"
336
+ } )
337
+ .hide();
338
+
339
+ // Make sure at least one header is in the tab order
340
+ if ( !this.active.length ) {
341
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
342
+ } else {
343
+ this.active.attr( {
344
+ "aria-selected": "true",
345
+ "aria-expanded": "true",
346
+ tabIndex: 0
347
+ } )
348
+ .next()
349
+ .attr( {
350
+ "aria-hidden": "false"
351
+ } );
352
+ }
353
+
354
+ this._createIcons();
355
+
356
+ this._setupEvents( options.event );
357
+
358
+ if ( heightStyle === "fill" ) {
359
+ maxHeight = parent.height();
360
+ this.element.siblings( ":visible" ).each( function() {
361
+ var elem = $( this ),
362
+ position = elem.css( "position" );
363
+
364
+ if ( position === "absolute" || position === "fixed" ) {
365
+ return;
366
+ }
367
+ maxHeight -= elem.outerHeight( true );
368
+ } );
369
+
370
+ this.headers.each( function() {
371
+ maxHeight -= $( this ).outerHeight( true );
372
+ } );
373
+
374
+ this.headers.next()
375
+ .each( function() {
376
+ $( this ).height( Math.max( 0, maxHeight -
377
+ $( this ).innerHeight() + $( this ).height() ) );
378
+ } )
379
+ .css( "overflow", "auto" );
380
+ } else if ( heightStyle === "auto" ) {
381
+ maxHeight = 0;
382
+ this.headers.next()
383
+ .each( function() {
384
+ var isVisible = $( this ).is( ":visible" );
385
+ if ( !isVisible ) {
386
+ $( this ).show();
387
+ }
388
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
389
+ if ( !isVisible ) {
390
+ $( this ).hide();
391
+ }
392
+ } )
393
+ .height( maxHeight );
394
+ }
395
+ },
396
+
397
+ _activate: function( index ) {
398
+ var active = this._findActive( index )[ 0 ];
399
+
400
+ // Trying to activate the already active panel
401
+ if ( active === this.active[ 0 ] ) {
402
+ return;
403
+ }
404
+
405
+ // Trying to collapse, simulate a click on the currently active header
406
+ active = active || this.active[ 0 ];
407
+
408
+ this._eventHandler( {
409
+ target: active,
410
+ currentTarget: active,
411
+ preventDefault: $.noop
412
+ } );
413
+ },
414
+
415
+ _findActive: function( selector ) {
416
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
417
+ },
418
+
419
+ _setupEvents: function( event ) {
420
+ var events = {
421
+ keydown: "_keydown"
422
+ };
423
+ if ( event ) {
424
+ $.each( event.split( " " ), function( index, eventName ) {
425
+ events[ eventName ] = "_eventHandler";
426
+ } );
427
+ }
428
+
429
+ this._off( this.headers.add( this.headers.next() ) );
430
+ this._on( this.headers, events );
431
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
432
+ this._hoverable( this.headers );
433
+ this._focusable( this.headers );
434
+ },
435
+
436
+ _eventHandler: function( event ) {
437
+ var activeChildren, clickedChildren,
438
+ options = this.options,
439
+ active = this.active,
440
+ clicked = $( event.currentTarget ),
441
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
442
+ collapsing = clickedIsActive && options.collapsible,
443
+ toShow = collapsing ? $() : clicked.next(),
444
+ toHide = active.next(),
445
+ eventData = {
446
+ oldHeader: active,
447
+ oldPanel: toHide,
448
+ newHeader: collapsing ? $() : clicked,
449
+ newPanel: toShow
450
+ };
451
+
452
+ event.preventDefault();
453
+
454
+ if (
455
+
456
+ // click on active header, but not collapsible
457
+ ( clickedIsActive && !options.collapsible ) ||
458
+
459
+ // allow canceling activation
460
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
461
+ return;
462
+ }
463
+
464
+ options.active = collapsing ? false : this.headers.index( clicked );
465
+
466
+ // When the call to ._toggle() comes after the class changes
467
+ // it causes a very odd bug in IE 8 (see #6720)
468
+ this.active = clickedIsActive ? $() : clicked;
469
+ this._toggle( eventData );
470
+
471
+ // Switch classes
472
+ // corner classes on the previously active header stay after the animation
473
+ this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
474
+ if ( options.icons ) {
475
+ activeChildren = active.children( ".ui-accordion-header-icon" );
476
+ this._removeClass( activeChildren, null, options.icons.activeHeader )
477
+ ._addClass( activeChildren, null, options.icons.header );
478
+ }
479
+
480
+ if ( !clickedIsActive ) {
481
+ this._removeClass( clicked, "ui-accordion-header-collapsed" )
482
+ ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
483
+ if ( options.icons ) {
484
+ clickedChildren = clicked.children( ".ui-accordion-header-icon" );
485
+ this._removeClass( clickedChildren, null, options.icons.header )
486
+ ._addClass( clickedChildren, null, options.icons.activeHeader );
487
+ }
488
+
489
+ this._addClass( clicked.next(), "ui-accordion-content-active" );
490
+ }
491
+ },
492
+
493
+ _toggle: function( data ) {
494
+ var toShow = data.newPanel,
495
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
496
+
497
+ // Handle activating a panel during the animation for another activation
498
+ this.prevShow.add( this.prevHide ).stop( true, true );
499
+ this.prevShow = toShow;
500
+ this.prevHide = toHide;
501
+
502
+ if ( this.options.animate ) {
503
+ this._animate( toShow, toHide, data );
504
+ } else {
505
+ toHide.hide();
506
+ toShow.show();
507
+ this._toggleComplete( data );
508
+ }
509
+
510
+ toHide.attr( {
511
+ "aria-hidden": "true"
512
+ } );
513
+ toHide.prev().attr( {
514
+ "aria-selected": "false",
515
+ "aria-expanded": "false"
516
+ } );
517
+
518
+ // if we're switching panels, remove the old header from the tab order
519
+ // if we're opening from collapsed state, remove the previous header from the tab order
520
+ // if we're collapsing, then keep the collapsing header in the tab order
521
+ if ( toShow.length && toHide.length ) {
522
+ toHide.prev().attr( {
523
+ "tabIndex": -1,
524
+ "aria-expanded": "false"
525
+ } );
526
+ } else if ( toShow.length ) {
527
+ this.headers.filter( function() {
528
+ return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
529
+ } )
530
+ .attr( "tabIndex", -1 );
531
+ }
532
+
533
+ toShow
534
+ .attr( "aria-hidden", "false" )
535
+ .prev()
536
+ .attr( {
537
+ "aria-selected": "true",
538
+ "aria-expanded": "true",
539
+ tabIndex: 0
540
+ } );
541
+ },
542
+
543
+ _animate: function( toShow, toHide, data ) {
544
+ var total, easing, duration,
545
+ that = this,
546
+ adjust = 0,
547
+ boxSizing = toShow.css( "box-sizing" ),
548
+ down = toShow.length &&
549
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
550
+ animate = this.options.animate || {},
551
+ options = down && animate.down || animate,
552
+ complete = function() {
553
+ that._toggleComplete( data );
554
+ };
555
+
556
+ if ( typeof options === "number" ) {
557
+ duration = options;
558
+ }
559
+ if ( typeof options === "string" ) {
560
+ easing = options;
561
+ }
562
+
563
+ // fall back from options to animation in case of partial down settings
564
+ easing = easing || options.easing || animate.easing;
565
+ duration = duration || options.duration || animate.duration;
566
+
567
+ if ( !toHide.length ) {
568
+ return toShow.animate( this.showProps, duration, easing, complete );
569
+ }
570
+ if ( !toShow.length ) {
571
+ return toHide.animate( this.hideProps, duration, easing, complete );
572
+ }
573
+
574
+ total = toShow.show().outerHeight();
575
+ toHide.animate( this.hideProps, {
576
+ duration: duration,
577
+ easing: easing,
578
+ step: function( now, fx ) {
579
+ fx.now = Math.round( now );
580
+ }
581
+ } );
582
+ toShow
583
+ .hide()
584
+ .animate( this.showProps, {
585
+ duration: duration,
586
+ easing: easing,
587
+ complete: complete,
588
+ step: function( now, fx ) {
589
+ fx.now = Math.round( now );
590
+ if ( fx.prop !== "height" ) {
591
+ if ( boxSizing === "content-box" ) {
592
+ adjust += fx.now;
593
+ }
594
+ } else if ( that.options.heightStyle !== "content" ) {
595
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
596
+ adjust = 0;
597
+ }
598
+ }
599
+ } );
600
+ },
601
+
602
+ _toggleComplete: function( data ) {
603
+ var toHide = data.oldPanel,
604
+ prev = toHide.prev();
605
+
606
+ this._removeClass( toHide, "ui-accordion-content-active" );
607
+ this._removeClass( prev, "ui-accordion-header-active" )
608
+ ._addClass( prev, "ui-accordion-header-collapsed" );
609
+
610
+ // Work around for rendering bug in IE (#5421)
611
+ if ( toHide.length ) {
612
+ toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
613
+ }
614
+ this._trigger( "activate", null, data );
615
+ }
616
+ } );
617
+
618
+ } ) );