jquery-ui-middleman 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) 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 +115 -0
  7. data/License.txt +2 -0
  8. data/README.md +226 -0
  9. data/Rakefile +221 -0
  10. data/VERSIONS.md +27 -0
  11. data/app/assets/images/jquery-ui/animated-overlay.gif +0 -0
  12. data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  13. data/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  14. data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  15. data/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  16. data/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  17. data/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  18. data/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  19. data/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  20. data/app/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  21. data/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  22. data/app/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  23. data/app/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  24. data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  25. data/app/assets/javascripts/jquery.ui.accordion.js +575 -0
  26. data/app/assets/javascripts/jquery.ui.all.js +34 -0
  27. data/app/assets/javascripts/jquery.ui.autocomplete.js +615 -0
  28. data/app/assets/javascripts/jquery.ui.button.js +422 -0
  29. data/app/assets/javascripts/jquery.ui.core.js +320 -0
  30. data/app/assets/javascripts/jquery.ui.datepicker-af.js +23 -0
  31. data/app/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +23 -0
  32. data/app/assets/javascripts/jquery.ui.datepicker-ar.js +23 -0
  33. data/app/assets/javascripts/jquery.ui.datepicker-az.js +23 -0
  34. data/app/assets/javascripts/jquery.ui.datepicker-be.js +23 -0
  35. data/app/assets/javascripts/jquery.ui.datepicker-bg.js +24 -0
  36. data/app/assets/javascripts/jquery.ui.datepicker-bs.js +23 -0
  37. data/app/assets/javascripts/jquery.ui.datepicker-ca.js +23 -0
  38. data/app/assets/javascripts/jquery.ui.datepicker-cs.js +23 -0
  39. data/app/assets/javascripts/jquery.ui.datepicker-cy-GB.js +23 -0
  40. data/app/assets/javascripts/jquery.ui.datepicker-da.js +23 -0
  41. data/app/assets/javascripts/jquery.ui.datepicker-de.js +23 -0
  42. data/app/assets/javascripts/jquery.ui.datepicker-el.js +23 -0
  43. data/app/assets/javascripts/jquery.ui.datepicker-en-AU.js +23 -0
  44. data/app/assets/javascripts/jquery.ui.datepicker-en-GB.js +23 -0
  45. data/app/assets/javascripts/jquery.ui.datepicker-en-NZ.js +23 -0
  46. data/app/assets/javascripts/jquery.ui.datepicker-eo.js +23 -0
  47. data/app/assets/javascripts/jquery.ui.datepicker-es.js +23 -0
  48. data/app/assets/javascripts/jquery.ui.datepicker-et.js +23 -0
  49. data/app/assets/javascripts/jquery.ui.datepicker-eu.js +23 -0
  50. data/app/assets/javascripts/jquery.ui.datepicker-fa.js +59 -0
  51. data/app/assets/javascripts/jquery.ui.datepicker-fi.js +23 -0
  52. data/app/assets/javascripts/jquery.ui.datepicker-fo.js +23 -0
  53. data/app/assets/javascripts/jquery.ui.datepicker-fr-CA.js +23 -0
  54. data/app/assets/javascripts/jquery.ui.datepicker-fr-CH.js +23 -0
  55. data/app/assets/javascripts/jquery.ui.datepicker-fr.js +25 -0
  56. data/app/assets/javascripts/jquery.ui.datepicker-gl.js +23 -0
  57. data/app/assets/javascripts/jquery.ui.datepicker-he.js +23 -0
  58. data/app/assets/javascripts/jquery.ui.datepicker-hi.js +23 -0
  59. data/app/assets/javascripts/jquery.ui.datepicker-hr.js +23 -0
  60. data/app/assets/javascripts/jquery.ui.datepicker-hu.js +23 -0
  61. data/app/assets/javascripts/jquery.ui.datepicker-hy.js +23 -0
  62. data/app/assets/javascripts/jquery.ui.datepicker-id.js +23 -0
  63. data/app/assets/javascripts/jquery.ui.datepicker-is.js +23 -0
  64. data/app/assets/javascripts/jquery.ui.datepicker-it.js +23 -0
  65. data/app/assets/javascripts/jquery.ui.datepicker-ja.js +23 -0
  66. data/app/assets/javascripts/jquery.ui.datepicker-ka.js +21 -0
  67. data/app/assets/javascripts/jquery.ui.datepicker-kk.js +23 -0
  68. data/app/assets/javascripts/jquery.ui.datepicker-km.js +23 -0
  69. data/app/assets/javascripts/jquery.ui.datepicker-ko.js +23 -0
  70. data/app/assets/javascripts/jquery.ui.datepicker-ky.js +24 -0
  71. data/app/assets/javascripts/jquery.ui.datepicker-lb.js +23 -0
  72. data/app/assets/javascripts/jquery.ui.datepicker-lt.js +23 -0
  73. data/app/assets/javascripts/jquery.ui.datepicker-lv.js +23 -0
  74. data/app/assets/javascripts/jquery.ui.datepicker-mk.js +23 -0
  75. data/app/assets/javascripts/jquery.ui.datepicker-ml.js +23 -0
  76. data/app/assets/javascripts/jquery.ui.datepicker-ms.js +23 -0
  77. data/app/assets/javascripts/jquery.ui.datepicker-nb.js +22 -0
  78. data/app/assets/javascripts/jquery.ui.datepicker-nl-BE.js +23 -0
  79. data/app/assets/javascripts/jquery.ui.datepicker-nl.js +23 -0
  80. data/app/assets/javascripts/jquery.ui.datepicker-nn.js +22 -0
  81. data/app/assets/javascripts/jquery.ui.datepicker-no.js +23 -0
  82. data/app/assets/javascripts/jquery.ui.datepicker-pl.js +23 -0
  83. data/app/assets/javascripts/jquery.ui.datepicker-pt-BR.js +23 -0
  84. data/app/assets/javascripts/jquery.ui.datepicker-pt.js +22 -0
  85. data/app/assets/javascripts/jquery.ui.datepicker-rm.js +21 -0
  86. data/app/assets/javascripts/jquery.ui.datepicker-ro.js +26 -0
  87. data/app/assets/javascripts/jquery.ui.datepicker-ru.js +23 -0
  88. data/app/assets/javascripts/jquery.ui.datepicker-sk.js +23 -0
  89. data/app/assets/javascripts/jquery.ui.datepicker-sl.js +24 -0
  90. data/app/assets/javascripts/jquery.ui.datepicker-sq.js +23 -0
  91. data/app/assets/javascripts/jquery.ui.datepicker-sr-SR.js +23 -0
  92. data/app/assets/javascripts/jquery.ui.datepicker-sr.js +23 -0
  93. data/app/assets/javascripts/jquery.ui.datepicker-sv.js +23 -0
  94. data/app/assets/javascripts/jquery.ui.datepicker-ta.js +23 -0
  95. data/app/assets/javascripts/jquery.ui.datepicker-th.js +23 -0
  96. data/app/assets/javascripts/jquery.ui.datepicker-tj.js +23 -0
  97. data/app/assets/javascripts/jquery.ui.datepicker-tr.js +23 -0
  98. data/app/assets/javascripts/jquery.ui.datepicker-uk.js +24 -0
  99. data/app/assets/javascripts/jquery.ui.datepicker-vi.js +23 -0
  100. data/app/assets/javascripts/jquery.ui.datepicker-zh-CN.js +23 -0
  101. data/app/assets/javascripts/jquery.ui.datepicker-zh-HK.js +23 -0
  102. data/app/assets/javascripts/jquery.ui.datepicker-zh-TW.js +23 -0
  103. data/app/assets/javascripts/jquery.ui.datepicker.js +2040 -0
  104. data/app/assets/javascripts/jquery.ui.dialog.js +815 -0
  105. data/app/assets/javascripts/jquery.ui.draggable.js +962 -0
  106. data/app/assets/javascripts/jquery.ui.droppable.js +377 -0
  107. data/app/assets/javascripts/jquery.ui.effect-blind.js +84 -0
  108. data/app/assets/javascripts/jquery.ui.effect-bounce.js +115 -0
  109. data/app/assets/javascripts/jquery.ui.effect-clip.js +69 -0
  110. data/app/assets/javascripts/jquery.ui.effect-drop.js +67 -0
  111. data/app/assets/javascripts/jquery.ui.effect-explode.js +99 -0
  112. data/app/assets/javascripts/jquery.ui.effect-fade.js +32 -0
  113. data/app/assets/javascripts/jquery.ui.effect-fold.js +78 -0
  114. data/app/assets/javascripts/jquery.ui.effect-highlight.js +52 -0
  115. data/app/assets/javascripts/jquery.ui.effect-pulsate.js +65 -0
  116. data/app/assets/javascripts/jquery.ui.effect-scale.js +320 -0
  117. data/app/assets/javascripts/jquery.ui.effect-shake.js +76 -0
  118. data/app/assets/javascripts/jquery.ui.effect-slide.js +66 -0
  119. data/app/assets/javascripts/jquery.ui.effect-transfer.js +49 -0
  120. data/app/assets/javascripts/jquery.ui.effect.all.js +14 -0
  121. data/app/assets/javascripts/jquery.ui.effect.js +1289 -0
  122. data/app/assets/javascripts/jquery.ui.menu.js +625 -0
  123. data/app/assets/javascripts/jquery.ui.mouse.js +172 -0
  124. data/app/assets/javascripts/jquery.ui.position.js +497 -0
  125. data/app/assets/javascripts/jquery.ui.progressbar.js +148 -0
  126. data/app/assets/javascripts/jquery.ui.resizable.js +972 -0
  127. data/app/assets/javascripts/jquery.ui.selectable.js +281 -0
  128. data/app/assets/javascripts/jquery.ui.slider.js +676 -0
  129. data/app/assets/javascripts/jquery.ui.sortable.js +1289 -0
  130. data/app/assets/javascripts/jquery.ui.spinner.js +497 -0
  131. data/app/assets/javascripts/jquery.ui.tabs.js +849 -0
  132. data/app/assets/javascripts/jquery.ui.tooltip.js +406 -0
  133. data/app/assets/javascripts/jquery.ui.widget.js +521 -0
  134. data/app/assets/stylesheets/jquery.ui.accordion.css.erb +42 -0
  135. data/app/assets/stylesheets/jquery.ui.all.css.erb +14 -0
  136. data/app/assets/stylesheets/jquery.ui.autocomplete.css.erb +21 -0
  137. data/app/assets/stylesheets/jquery.ui.base.css.erb +27 -0
  138. data/app/assets/stylesheets/jquery.ui.button.css.erb +118 -0
  139. data/app/assets/stylesheets/jquery.ui.core.css.erb +93 -0
  140. data/app/assets/stylesheets/jquery.ui.datepicker.css.erb +182 -0
  141. data/app/assets/stylesheets/jquery.ui.dialog.css.erb +75 -0
  142. data/app/assets/stylesheets/jquery.ui.menu.css.erb +83 -0
  143. data/app/assets/stylesheets/jquery.ui.progressbar.css.erb +32 -0
  144. data/app/assets/stylesheets/jquery.ui.resizable.css.erb +82 -0
  145. data/app/assets/stylesheets/jquery.ui.selectable.css.erb +19 -0
  146. data/app/assets/stylesheets/jquery.ui.slider.css.erb +77 -0
  147. data/app/assets/stylesheets/jquery.ui.spinner.css.erb +70 -0
  148. data/app/assets/stylesheets/jquery.ui.tabs.css.erb +56 -0
  149. data/app/assets/stylesheets/jquery.ui.theme.css.erb +409 -0
  150. data/app/assets/stylesheets/jquery.ui.tooltip.css.erb +23 -0
  151. data/lib/jquery-ui-middleman.rb +1 -0
  152. data/lib/jquery/ui/version.rb +6 -0
  153. metadata +209 -0
@@ -0,0 +1,27 @@
1
+ # Bundled Versions
2
+
3
+ | Gem | jQuery UI |
4
+ |--------|-----------|
5
+ | 4.1.0 | 1.10.3 |
6
+ | 4.0.5 | 1.10.3 |
7
+ | 4.0.4 | 1.10.3 |
8
+ | 4.0.3 | 1.10.3 |
9
+ | 4.0.2 | 1.10.0 |
10
+ | 4.0.1 | 1.10.0 |
11
+ | 4.0.0 | 1.10.0 |
12
+ | 3.0.1 | 1.9.2 |
13
+ | 3.0.0 | 1.9.2 |
14
+ | 2.0.2 | 1.8.24 |
15
+ | 2.0.1 | 1.8.23 |
16
+ | 2.0.0 | 1.8.23 |
17
+ | 1.1.1 | 1.8.23 |
18
+ | 1.1.0 | 1.8.22 |
19
+ | 1.0.0 | 1.8.21 |
20
+ | 0.5.0 | 1.8.21 |
21
+ | 0.4.1 | 1.8.20 |
22
+ | 0.4.0 | 1.8.20 |
23
+ | 0.3.0 | 1.8.19 |
24
+ | 0.2.2 | 1.8.18 |
25
+ | 0.2.1 | 1.8.18 |
26
+ | 0.2.0 | 1.8.17 |
27
+ | 0.1.0 | 1.8.16 |
@@ -0,0 +1,575 @@
1
+ //= require jquery.ui.core
2
+ //= require jquery.ui.widget
3
+
4
+ /*!
5
+ * jQuery UI Accordion 1.10.3
6
+ * http://jqueryui.com
7
+ *
8
+ * Copyright 2013 jQuery Foundation and other contributors
9
+ * Released under the MIT license.
10
+ * http://jquery.org/license
11
+ *
12
+ * http://api.jqueryui.com/accordion/
13
+ *
14
+ * Depends:
15
+ * jquery.ui.core.js
16
+ * jquery.ui.widget.js
17
+ */
18
+ (function( $, undefined ) {
19
+
20
+ var uid = 0,
21
+ hideProps = {},
22
+ showProps = {};
23
+
24
+ hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
25
+ hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
26
+ showProps.height = showProps.paddingTop = showProps.paddingBottom =
27
+ showProps.borderTopWidth = showProps.borderBottomWidth = "show";
28
+
29
+ $.widget( "ui.accordion", {
30
+ version: "1.10.3",
31
+ options: {
32
+ active: 0,
33
+ animate: {},
34
+ collapsible: false,
35
+ event: "click",
36
+ header: "> li > :first-child,> :not(li):even",
37
+ heightStyle: "auto",
38
+ icons: {
39
+ activeHeader: "ui-icon-triangle-1-s",
40
+ header: "ui-icon-triangle-1-e"
41
+ },
42
+
43
+ // callbacks
44
+ activate: null,
45
+ beforeActivate: null
46
+ },
47
+
48
+ _create: function() {
49
+ var options = this.options;
50
+ this.prevShow = this.prevHide = $();
51
+ this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
52
+ // ARIA
53
+ .attr( "role", "tablist" );
54
+
55
+ // don't allow collapsible: false and active: false / null
56
+ if ( !options.collapsible && (options.active === false || options.active == null) ) {
57
+ options.active = 0;
58
+ }
59
+
60
+ this._processPanels();
61
+ // handle negative values
62
+ if ( options.active < 0 ) {
63
+ options.active += this.headers.length;
64
+ }
65
+ this._refresh();
66
+ },
67
+
68
+ _getCreateEventData: function() {
69
+ return {
70
+ header: this.active,
71
+ panel: !this.active.length ? $() : this.active.next(),
72
+ content: !this.active.length ? $() : this.active.next()
73
+ };
74
+ },
75
+
76
+ _createIcons: function() {
77
+ var icons = this.options.icons;
78
+ if ( icons ) {
79
+ $( "<span>" )
80
+ .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
81
+ .prependTo( this.headers );
82
+ this.active.children( ".ui-accordion-header-icon" )
83
+ .removeClass( icons.header )
84
+ .addClass( icons.activeHeader );
85
+ this.headers.addClass( "ui-accordion-icons" );
86
+ }
87
+ },
88
+
89
+ _destroyIcons: function() {
90
+ this.headers
91
+ .removeClass( "ui-accordion-icons" )
92
+ .children( ".ui-accordion-header-icon" )
93
+ .remove();
94
+ },
95
+
96
+ _destroy: function() {
97
+ var contents;
98
+
99
+ // clean up main element
100
+ this.element
101
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
102
+ .removeAttr( "role" );
103
+
104
+ // clean up headers
105
+ this.headers
106
+ .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
107
+ .removeAttr( "role" )
108
+ .removeAttr( "aria-selected" )
109
+ .removeAttr( "aria-controls" )
110
+ .removeAttr( "tabIndex" )
111
+ .each(function() {
112
+ if ( /^ui-accordion/.test( this.id ) ) {
113
+ this.removeAttribute( "id" );
114
+ }
115
+ });
116
+ this._destroyIcons();
117
+
118
+ // clean up content panels
119
+ contents = this.headers.next()
120
+ .css( "display", "" )
121
+ .removeAttr( "role" )
122
+ .removeAttr( "aria-expanded" )
123
+ .removeAttr( "aria-hidden" )
124
+ .removeAttr( "aria-labelledby" )
125
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
126
+ .each(function() {
127
+ if ( /^ui-accordion/.test( this.id ) ) {
128
+ this.removeAttribute( "id" );
129
+ }
130
+ });
131
+ if ( this.options.heightStyle !== "content" ) {
132
+ contents.css( "height", "" );
133
+ }
134
+ },
135
+
136
+ _setOption: function( key, value ) {
137
+ if ( key === "active" ) {
138
+ // _activate() will handle invalid values and update this.options
139
+ this._activate( value );
140
+ return;
141
+ }
142
+
143
+ if ( key === "event" ) {
144
+ if ( this.options.event ) {
145
+ this._off( this.headers, this.options.event );
146
+ }
147
+ this._setupEvents( value );
148
+ }
149
+
150
+ this._super( key, value );
151
+
152
+ // setting collapsible: false while collapsed; open first panel
153
+ if ( key === "collapsible" && !value && this.options.active === false ) {
154
+ this._activate( 0 );
155
+ }
156
+
157
+ if ( key === "icons" ) {
158
+ this._destroyIcons();
159
+ if ( value ) {
160
+ this._createIcons();
161
+ }
162
+ }
163
+
164
+ // #5332 - opacity doesn't cascade to positioned elements in IE
165
+ // so we need to add the disabled class to the headers and panels
166
+ if ( key === "disabled" ) {
167
+ this.headers.add( this.headers.next() )
168
+ .toggleClass( "ui-state-disabled", !!value );
169
+ }
170
+ },
171
+
172
+ _keydown: function( event ) {
173
+ /*jshint maxcomplexity:15*/
174
+ if ( event.altKey || event.ctrlKey ) {
175
+ return;
176
+ }
177
+
178
+ var keyCode = $.ui.keyCode,
179
+ length = this.headers.length,
180
+ currentIndex = this.headers.index( event.target ),
181
+ toFocus = false;
182
+
183
+ switch ( event.keyCode ) {
184
+ case keyCode.RIGHT:
185
+ case keyCode.DOWN:
186
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
187
+ break;
188
+ case keyCode.LEFT:
189
+ case keyCode.UP:
190
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
191
+ break;
192
+ case keyCode.SPACE:
193
+ case keyCode.ENTER:
194
+ this._eventHandler( event );
195
+ break;
196
+ case keyCode.HOME:
197
+ toFocus = this.headers[ 0 ];
198
+ break;
199
+ case keyCode.END:
200
+ toFocus = this.headers[ length - 1 ];
201
+ break;
202
+ }
203
+
204
+ if ( toFocus ) {
205
+ $( event.target ).attr( "tabIndex", -1 );
206
+ $( toFocus ).attr( "tabIndex", 0 );
207
+ toFocus.focus();
208
+ event.preventDefault();
209
+ }
210
+ },
211
+
212
+ _panelKeyDown : function( event ) {
213
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
214
+ $( event.currentTarget ).prev().focus();
215
+ }
216
+ },
217
+
218
+ refresh: function() {
219
+ var options = this.options;
220
+ this._processPanels();
221
+
222
+ // was collapsed or no panel
223
+ if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
224
+ options.active = false;
225
+ this.active = $();
226
+ // active false only when collapsible is true
227
+ } else if ( options.active === false ) {
228
+ this._activate( 0 );
229
+ // was active, but active panel is gone
230
+ } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
231
+ // all remaining panel are disabled
232
+ if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
233
+ options.active = false;
234
+ this.active = $();
235
+ // activate previous panel
236
+ } else {
237
+ this._activate( Math.max( 0, options.active - 1 ) );
238
+ }
239
+ // was active, active panel still exists
240
+ } else {
241
+ // make sure active index is correct
242
+ options.active = this.headers.index( this.active );
243
+ }
244
+
245
+ this._destroyIcons();
246
+
247
+ this._refresh();
248
+ },
249
+
250
+ _processPanels: function() {
251
+ this.headers = this.element.find( this.options.header )
252
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
253
+
254
+ this.headers.next()
255
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
256
+ .filter(":not(.ui-accordion-content-active)")
257
+ .hide();
258
+ },
259
+
260
+ _refresh: function() {
261
+ var maxHeight,
262
+ options = this.options,
263
+ heightStyle = options.heightStyle,
264
+ parent = this.element.parent(),
265
+ accordionId = this.accordionId = "ui-accordion-" +
266
+ (this.element.attr( "id" ) || ++uid);
267
+
268
+ this.active = this._findActive( options.active )
269
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
270
+ .removeClass( "ui-corner-all" );
271
+ this.active.next()
272
+ .addClass( "ui-accordion-content-active" )
273
+ .show();
274
+
275
+ this.headers
276
+ .attr( "role", "tab" )
277
+ .each(function( i ) {
278
+ var header = $( this ),
279
+ headerId = header.attr( "id" ),
280
+ panel = header.next(),
281
+ panelId = panel.attr( "id" );
282
+ if ( !headerId ) {
283
+ headerId = accordionId + "-header-" + i;
284
+ header.attr( "id", headerId );
285
+ }
286
+ if ( !panelId ) {
287
+ panelId = accordionId + "-panel-" + i;
288
+ panel.attr( "id", panelId );
289
+ }
290
+ header.attr( "aria-controls", panelId );
291
+ panel.attr( "aria-labelledby", headerId );
292
+ })
293
+ .next()
294
+ .attr( "role", "tabpanel" );
295
+
296
+ this.headers
297
+ .not( this.active )
298
+ .attr({
299
+ "aria-selected": "false",
300
+ tabIndex: -1
301
+ })
302
+ .next()
303
+ .attr({
304
+ "aria-expanded": "false",
305
+ "aria-hidden": "true"
306
+ })
307
+ .hide();
308
+
309
+ // make sure at least one header is in the tab order
310
+ if ( !this.active.length ) {
311
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
312
+ } else {
313
+ this.active.attr({
314
+ "aria-selected": "true",
315
+ tabIndex: 0
316
+ })
317
+ .next()
318
+ .attr({
319
+ "aria-expanded": "true",
320
+ "aria-hidden": "false"
321
+ });
322
+ }
323
+
324
+ this._createIcons();
325
+
326
+ this._setupEvents( options.event );
327
+
328
+ if ( heightStyle === "fill" ) {
329
+ maxHeight = parent.height();
330
+ this.element.siblings( ":visible" ).each(function() {
331
+ var elem = $( this ),
332
+ position = elem.css( "position" );
333
+
334
+ if ( position === "absolute" || position === "fixed" ) {
335
+ return;
336
+ }
337
+ maxHeight -= elem.outerHeight( true );
338
+ });
339
+
340
+ this.headers.each(function() {
341
+ maxHeight -= $( this ).outerHeight( true );
342
+ });
343
+
344
+ this.headers.next()
345
+ .each(function() {
346
+ $( this ).height( Math.max( 0, maxHeight -
347
+ $( this ).innerHeight() + $( this ).height() ) );
348
+ })
349
+ .css( "overflow", "auto" );
350
+ } else if ( heightStyle === "auto" ) {
351
+ maxHeight = 0;
352
+ this.headers.next()
353
+ .each(function() {
354
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
355
+ })
356
+ .height( maxHeight );
357
+ }
358
+ },
359
+
360
+ _activate: function( index ) {
361
+ var active = this._findActive( index )[ 0 ];
362
+
363
+ // trying to activate the already active panel
364
+ if ( active === this.active[ 0 ] ) {
365
+ return;
366
+ }
367
+
368
+ // trying to collapse, simulate a click on the currently active header
369
+ active = active || this.active[ 0 ];
370
+
371
+ this._eventHandler({
372
+ target: active,
373
+ currentTarget: active,
374
+ preventDefault: $.noop
375
+ });
376
+ },
377
+
378
+ _findActive: function( selector ) {
379
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
380
+ },
381
+
382
+ _setupEvents: function( event ) {
383
+ var events = {
384
+ keydown: "_keydown"
385
+ };
386
+ if ( event ) {
387
+ $.each( event.split(" "), function( index, eventName ) {
388
+ events[ eventName ] = "_eventHandler";
389
+ });
390
+ }
391
+
392
+ this._off( this.headers.add( this.headers.next() ) );
393
+ this._on( this.headers, events );
394
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" });
395
+ this._hoverable( this.headers );
396
+ this._focusable( this.headers );
397
+ },
398
+
399
+ _eventHandler: function( event ) {
400
+ var options = this.options,
401
+ active = this.active,
402
+ clicked = $( event.currentTarget ),
403
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
404
+ collapsing = clickedIsActive && options.collapsible,
405
+ toShow = collapsing ? $() : clicked.next(),
406
+ toHide = active.next(),
407
+ eventData = {
408
+ oldHeader: active,
409
+ oldPanel: toHide,
410
+ newHeader: collapsing ? $() : clicked,
411
+ newPanel: toShow
412
+ };
413
+
414
+ event.preventDefault();
415
+
416
+ if (
417
+ // click on active header, but not collapsible
418
+ ( clickedIsActive && !options.collapsible ) ||
419
+ // allow canceling activation
420
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
421
+ return;
422
+ }
423
+
424
+ options.active = collapsing ? false : this.headers.index( clicked );
425
+
426
+ // when the call to ._toggle() comes after the class changes
427
+ // it causes a very odd bug in IE 8 (see #6720)
428
+ this.active = clickedIsActive ? $() : clicked;
429
+ this._toggle( eventData );
430
+
431
+ // switch classes
432
+ // corner classes on the previously active header stay after the animation
433
+ active.removeClass( "ui-accordion-header-active ui-state-active" );
434
+ if ( options.icons ) {
435
+ active.children( ".ui-accordion-header-icon" )
436
+ .removeClass( options.icons.activeHeader )
437
+ .addClass( options.icons.header );
438
+ }
439
+
440
+ if ( !clickedIsActive ) {
441
+ clicked
442
+ .removeClass( "ui-corner-all" )
443
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
444
+ if ( options.icons ) {
445
+ clicked.children( ".ui-accordion-header-icon" )
446
+ .removeClass( options.icons.header )
447
+ .addClass( options.icons.activeHeader );
448
+ }
449
+
450
+ clicked
451
+ .next()
452
+ .addClass( "ui-accordion-content-active" );
453
+ }
454
+ },
455
+
456
+ _toggle: function( data ) {
457
+ var toShow = data.newPanel,
458
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
459
+
460
+ // handle activating a panel during the animation for another activation
461
+ this.prevShow.add( this.prevHide ).stop( true, true );
462
+ this.prevShow = toShow;
463
+ this.prevHide = toHide;
464
+
465
+ if ( this.options.animate ) {
466
+ this._animate( toShow, toHide, data );
467
+ } else {
468
+ toHide.hide();
469
+ toShow.show();
470
+ this._toggleComplete( data );
471
+ }
472
+
473
+ toHide.attr({
474
+ "aria-expanded": "false",
475
+ "aria-hidden": "true"
476
+ });
477
+ toHide.prev().attr( "aria-selected", "false" );
478
+ // if we're switching panels, remove the old header from the tab order
479
+ // if we're opening from collapsed state, remove the previous header from the tab order
480
+ // if we're collapsing, then keep the collapsing header in the tab order
481
+ if ( toShow.length && toHide.length ) {
482
+ toHide.prev().attr( "tabIndex", -1 );
483
+ } else if ( toShow.length ) {
484
+ this.headers.filter(function() {
485
+ return $( this ).attr( "tabIndex" ) === 0;
486
+ })
487
+ .attr( "tabIndex", -1 );
488
+ }
489
+
490
+ toShow
491
+ .attr({
492
+ "aria-expanded": "true",
493
+ "aria-hidden": "false"
494
+ })
495
+ .prev()
496
+ .attr({
497
+ "aria-selected": "true",
498
+ tabIndex: 0
499
+ });
500
+ },
501
+
502
+ _animate: function( toShow, toHide, data ) {
503
+ var total, easing, duration,
504
+ that = this,
505
+ adjust = 0,
506
+ down = toShow.length &&
507
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
508
+ animate = this.options.animate || {},
509
+ options = down && animate.down || animate,
510
+ complete = function() {
511
+ that._toggleComplete( data );
512
+ };
513
+
514
+ if ( typeof options === "number" ) {
515
+ duration = options;
516
+ }
517
+ if ( typeof options === "string" ) {
518
+ easing = options;
519
+ }
520
+ // fall back from options to animation in case of partial down settings
521
+ easing = easing || options.easing || animate.easing;
522
+ duration = duration || options.duration || animate.duration;
523
+
524
+ if ( !toHide.length ) {
525
+ return toShow.animate( showProps, duration, easing, complete );
526
+ }
527
+ if ( !toShow.length ) {
528
+ return toHide.animate( hideProps, duration, easing, complete );
529
+ }
530
+
531
+ total = toShow.show().outerHeight();
532
+ toHide.animate( hideProps, {
533
+ duration: duration,
534
+ easing: easing,
535
+ step: function( now, fx ) {
536
+ fx.now = Math.round( now );
537
+ }
538
+ });
539
+ toShow
540
+ .hide()
541
+ .animate( showProps, {
542
+ duration: duration,
543
+ easing: easing,
544
+ complete: complete,
545
+ step: function( now, fx ) {
546
+ fx.now = Math.round( now );
547
+ if ( fx.prop !== "height" ) {
548
+ adjust += fx.now;
549
+ } else if ( that.options.heightStyle !== "content" ) {
550
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
551
+ adjust = 0;
552
+ }
553
+ }
554
+ });
555
+ },
556
+
557
+ _toggleComplete: function( data ) {
558
+ var toHide = data.oldPanel;
559
+
560
+ toHide
561
+ .removeClass( "ui-accordion-content-active" )
562
+ .prev()
563
+ .removeClass( "ui-corner-top" )
564
+ .addClass( "ui-corner-all" );
565
+
566
+ // Work around for rendering bug in IE (#5421)
567
+ if ( toHide.length ) {
568
+ toHide.parent()[0].className = toHide.parent()[0].className;
569
+ }
570
+
571
+ this._trigger( "activate", null, data );
572
+ }
573
+ });
574
+
575
+ })( jQuery );