jqueryui-requirejs-rails 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/LICENSE +22 -0
  2. data/README.md +3 -0
  3. data/Rakefile +27 -0
  4. data/app/assets/javascripts/jqueryui/accordion.js +575 -0
  5. data/app/assets/javascripts/jqueryui/autocomplete.js +613 -0
  6. data/app/assets/javascripts/jqueryui/button.js +422 -0
  7. data/app/assets/javascripts/jqueryui/core.js +323 -0
  8. data/app/assets/javascripts/jqueryui/datepicker-af.js +26 -0
  9. data/app/assets/javascripts/jqueryui/datepicker-ar-DZ.js +26 -0
  10. data/app/assets/javascripts/jqueryui/datepicker-ar.js +26 -0
  11. data/app/assets/javascripts/jqueryui/datepicker-az.js +26 -0
  12. data/app/assets/javascripts/jqueryui/datepicker-be.js +26 -0
  13. data/app/assets/javascripts/jqueryui/datepicker-bg.js +27 -0
  14. data/app/assets/javascripts/jqueryui/datepicker-bs.js +26 -0
  15. data/app/assets/javascripts/jqueryui/datepicker-ca.js +26 -0
  16. data/app/assets/javascripts/jqueryui/datepicker-cs.js +26 -0
  17. data/app/assets/javascripts/jqueryui/datepicker-cy-GB.js +26 -0
  18. data/app/assets/javascripts/jqueryui/datepicker-da.js +26 -0
  19. data/app/assets/javascripts/jqueryui/datepicker-de.js +26 -0
  20. data/app/assets/javascripts/jqueryui/datepicker-el.js +26 -0
  21. data/app/assets/javascripts/jqueryui/datepicker-en-AU.js +26 -0
  22. data/app/assets/javascripts/jqueryui/datepicker-en-GB.js +26 -0
  23. data/app/assets/javascripts/jqueryui/datepicker-en-NZ.js +26 -0
  24. data/app/assets/javascripts/jqueryui/datepicker-eo.js +26 -0
  25. data/app/assets/javascripts/jqueryui/datepicker-es.js +26 -0
  26. data/app/assets/javascripts/jqueryui/datepicker-et.js +26 -0
  27. data/app/assets/javascripts/jqueryui/datepicker-eu.js +26 -0
  28. data/app/assets/javascripts/jqueryui/datepicker-fa.js +62 -0
  29. data/app/assets/javascripts/jqueryui/datepicker-fi.js +26 -0
  30. data/app/assets/javascripts/jqueryui/datepicker-fo.js +26 -0
  31. data/app/assets/javascripts/jqueryui/datepicker-fr-CA.js +26 -0
  32. data/app/assets/javascripts/jqueryui/datepicker-fr-CH.js +26 -0
  33. data/app/assets/javascripts/jqueryui/datepicker-fr.js +28 -0
  34. data/app/assets/javascripts/jqueryui/datepicker-gl.js +26 -0
  35. data/app/assets/javascripts/jqueryui/datepicker-he.js +26 -0
  36. data/app/assets/javascripts/jqueryui/datepicker-hi.js +26 -0
  37. data/app/assets/javascripts/jqueryui/datepicker-hr.js +26 -0
  38. data/app/assets/javascripts/jqueryui/datepicker-hu.js +26 -0
  39. data/app/assets/javascripts/jqueryui/datepicker-hy.js +26 -0
  40. data/app/assets/javascripts/jqueryui/datepicker-id.js +26 -0
  41. data/app/assets/javascripts/jqueryui/datepicker-is.js +26 -0
  42. data/app/assets/javascripts/jqueryui/datepicker-it.js +26 -0
  43. data/app/assets/javascripts/jqueryui/datepicker-ja.js +26 -0
  44. data/app/assets/javascripts/jqueryui/datepicker-ka.js +24 -0
  45. data/app/assets/javascripts/jqueryui/datepicker-kk.js +26 -0
  46. data/app/assets/javascripts/jqueryui/datepicker-km.js +26 -0
  47. data/app/assets/javascripts/jqueryui/datepicker-ko.js +26 -0
  48. data/app/assets/javascripts/jqueryui/datepicker-ky.js +27 -0
  49. data/app/assets/javascripts/jqueryui/datepicker-lb.js +26 -0
  50. data/app/assets/javascripts/jqueryui/datepicker-lt.js +26 -0
  51. data/app/assets/javascripts/jqueryui/datepicker-lv.js +26 -0
  52. data/app/assets/javascripts/jqueryui/datepicker-mk.js +26 -0
  53. data/app/assets/javascripts/jqueryui/datepicker-ml.js +26 -0
  54. data/app/assets/javascripts/jqueryui/datepicker-ms.js +26 -0
  55. data/app/assets/javascripts/jqueryui/datepicker-nb.js +25 -0
  56. data/app/assets/javascripts/jqueryui/datepicker-nl-BE.js +26 -0
  57. data/app/assets/javascripts/jqueryui/datepicker-nl.js +26 -0
  58. data/app/assets/javascripts/jqueryui/datepicker-nn.js +25 -0
  59. data/app/assets/javascripts/jqueryui/datepicker-no.js +26 -0
  60. data/app/assets/javascripts/jqueryui/datepicker-pl.js +26 -0
  61. data/app/assets/javascripts/jqueryui/datepicker-pt-BR.js +26 -0
  62. data/app/assets/javascripts/jqueryui/datepicker-pt.js +25 -0
  63. data/app/assets/javascripts/jqueryui/datepicker-rm.js +24 -0
  64. data/app/assets/javascripts/jqueryui/datepicker-ro.js +29 -0
  65. data/app/assets/javascripts/jqueryui/datepicker-ru.js +26 -0
  66. data/app/assets/javascripts/jqueryui/datepicker-sk.js +26 -0
  67. data/app/assets/javascripts/jqueryui/datepicker-sl.js +27 -0
  68. data/app/assets/javascripts/jqueryui/datepicker-sq.js +26 -0
  69. data/app/assets/javascripts/jqueryui/datepicker-sr-SR.js +26 -0
  70. data/app/assets/javascripts/jqueryui/datepicker-sr.js +26 -0
  71. data/app/assets/javascripts/jqueryui/datepicker-sv.js +26 -0
  72. data/app/assets/javascripts/jqueryui/datepicker-ta.js +26 -0
  73. data/app/assets/javascripts/jqueryui/datepicker-th.js +26 -0
  74. data/app/assets/javascripts/jqueryui/datepicker-tj.js +26 -0
  75. data/app/assets/javascripts/jqueryui/datepicker-tr.js +26 -0
  76. data/app/assets/javascripts/jqueryui/datepicker-uk.js +27 -0
  77. data/app/assets/javascripts/jqueryui/datepicker-vi.js +26 -0
  78. data/app/assets/javascripts/jqueryui/datepicker-zh-CN.js +26 -0
  79. data/app/assets/javascripts/jqueryui/datepicker-zh-HK.js +26 -0
  80. data/app/assets/javascripts/jqueryui/datepicker-zh-TW.js +26 -0
  81. data/app/assets/javascripts/jqueryui/datepicker.js +2053 -0
  82. data/app/assets/javascripts/jqueryui/dialog.js +811 -0
  83. data/app/assets/javascripts/jqueryui/draggable.js +936 -0
  84. data/app/assets/javascripts/jqueryui/droppable.js +375 -0
  85. data/app/assets/javascripts/jqueryui/effect-blind.js +85 -0
  86. data/app/assets/javascripts/jqueryui/effect-bounce.js +116 -0
  87. data/app/assets/javascripts/jqueryui/effect-clip.js +70 -0
  88. data/app/assets/javascripts/jqueryui/effect-drop.js +68 -0
  89. data/app/assets/javascripts/jqueryui/effect-explode.js +100 -0
  90. data/app/assets/javascripts/jqueryui/effect-fade.js +33 -0
  91. data/app/assets/javascripts/jqueryui/effect-fold.js +79 -0
  92. data/app/assets/javascripts/jqueryui/effect-highlight.js +53 -0
  93. data/app/assets/javascripts/jqueryui/effect-pulsate.js +66 -0
  94. data/app/assets/javascripts/jqueryui/effect-scale.js +321 -0
  95. data/app/assets/javascripts/jqueryui/effect-shake.js +77 -0
  96. data/app/assets/javascripts/jqueryui/effect-slide.js +67 -0
  97. data/app/assets/javascripts/jqueryui/effect-transfer.js +50 -0
  98. data/app/assets/javascripts/jqueryui/effect.js +1292 -0
  99. data/app/assets/javascripts/jqueryui/menu.js +624 -0
  100. data/app/assets/javascripts/jqueryui/mouse.js +172 -0
  101. data/app/assets/javascripts/jqueryui/position.js +500 -0
  102. data/app/assets/javascripts/jqueryui/progressbar.js +148 -0
  103. data/app/assets/javascripts/jqueryui/resizable.js +971 -0
  104. data/app/assets/javascripts/jqueryui/selectable.js +280 -0
  105. data/app/assets/javascripts/jqueryui/slider.js +675 -0
  106. data/app/assets/javascripts/jqueryui/sortable.js +1285 -0
  107. data/app/assets/javascripts/jqueryui/spinner.js +496 -0
  108. data/app/assets/javascripts/jqueryui/tabs.js +849 -0
  109. data/app/assets/javascripts/jqueryui/tooltip.js +405 -0
  110. data/app/assets/javascripts/jqueryui/widget.js +524 -0
  111. data/lib/jqueryui-requirejs-rails.rb +4 -0
  112. data/lib/jqueryui-requirejs-rails/engine.rb +4 -0
  113. data/lib/jqueryui-requirejs-rails/version.rb +3 -0
  114. metadata +196 -0
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2013 Cre8 New Media Limited
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ = JqueryuiRequirejsRails
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'JqueryuiRequirejsRails'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,575 @@
1
+ define(['jquery','./core','./widget'], function (jQuery) {
2
+ /*!
3
+ * jQuery UI Accordion 1.10.2
4
+ * http://jqueryui.com
5
+ *
6
+ * Copyright 2013 jQuery Foundation and other contributors
7
+ * Released under the MIT license.
8
+ * http://jquery.org/license
9
+ *
10
+ * http://api.jqueryui.com/accordion/
11
+ *
12
+ * Depends:
13
+ * jquery.ui.core.js
14
+ * jquery.ui.widget.js
15
+ */
16
+ (function( $, undefined ) {
17
+
18
+ var uid = 0,
19
+ hideProps = {},
20
+ showProps = {};
21
+
22
+ hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
23
+ hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
24
+ showProps.height = showProps.paddingTop = showProps.paddingBottom =
25
+ showProps.borderTopWidth = showProps.borderBottomWidth = "show";
26
+
27
+ $.widget( "ui.accordion", {
28
+ version: "1.10.2",
29
+ options: {
30
+ active: 0,
31
+ animate: {},
32
+ collapsible: false,
33
+ event: "click",
34
+ header: "> li > :first-child,> :not(li):even",
35
+ heightStyle: "auto",
36
+ icons: {
37
+ activeHeader: "ui-icon-triangle-1-s",
38
+ header: "ui-icon-triangle-1-e"
39
+ },
40
+
41
+ // callbacks
42
+ activate: null,
43
+ beforeActivate: null
44
+ },
45
+
46
+ _create: function() {
47
+ var options = this.options;
48
+ this.prevShow = this.prevHide = $();
49
+ this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
50
+ // ARIA
51
+ .attr( "role", "tablist" );
52
+
53
+ // don't allow collapsible: false and active: false / null
54
+ if ( !options.collapsible && (options.active === false || options.active == null) ) {
55
+ options.active = 0;
56
+ }
57
+
58
+ this._processPanels();
59
+ // handle negative values
60
+ if ( options.active < 0 ) {
61
+ options.active += this.headers.length;
62
+ }
63
+ this._refresh();
64
+ },
65
+
66
+ _getCreateEventData: function() {
67
+ return {
68
+ header: this.active,
69
+ panel: !this.active.length ? $() : this.active.next(),
70
+ content: !this.active.length ? $() : this.active.next()
71
+ };
72
+ },
73
+
74
+ _createIcons: function() {
75
+ var icons = this.options.icons;
76
+ if ( icons ) {
77
+ $( "<span>" )
78
+ .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
79
+ .prependTo( this.headers );
80
+ this.active.children( ".ui-accordion-header-icon" )
81
+ .removeClass( icons.header )
82
+ .addClass( icons.activeHeader );
83
+ this.headers.addClass( "ui-accordion-icons" );
84
+ }
85
+ },
86
+
87
+ _destroyIcons: function() {
88
+ this.headers
89
+ .removeClass( "ui-accordion-icons" )
90
+ .children( ".ui-accordion-header-icon" )
91
+ .remove();
92
+ },
93
+
94
+ _destroy: function() {
95
+ var contents;
96
+
97
+ // clean up main element
98
+ this.element
99
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
100
+ .removeAttr( "role" );
101
+
102
+ // clean up headers
103
+ this.headers
104
+ .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" )
105
+ .removeAttr( "role" )
106
+ .removeAttr( "aria-selected" )
107
+ .removeAttr( "aria-controls" )
108
+ .removeAttr( "tabIndex" )
109
+ .each(function() {
110
+ if ( /^ui-accordion/.test( this.id ) ) {
111
+ this.removeAttribute( "id" );
112
+ }
113
+ });
114
+ this._destroyIcons();
115
+
116
+ // clean up content panels
117
+ contents = this.headers.next()
118
+ .css( "display", "" )
119
+ .removeAttr( "role" )
120
+ .removeAttr( "aria-expanded" )
121
+ .removeAttr( "aria-hidden" )
122
+ .removeAttr( "aria-labelledby" )
123
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
124
+ .each(function() {
125
+ if ( /^ui-accordion/.test( this.id ) ) {
126
+ this.removeAttribute( "id" );
127
+ }
128
+ });
129
+ if ( this.options.heightStyle !== "content" ) {
130
+ contents.css( "height", "" );
131
+ }
132
+ },
133
+
134
+ _setOption: function( key, value ) {
135
+ if ( key === "active" ) {
136
+ // _activate() will handle invalid values and update this.options
137
+ this._activate( value );
138
+ return;
139
+ }
140
+
141
+ if ( key === "event" ) {
142
+ if ( this.options.event ) {
143
+ this._off( this.headers, this.options.event );
144
+ }
145
+ this._setupEvents( value );
146
+ }
147
+
148
+ this._super( key, value );
149
+
150
+ // setting collapsible: false while collapsed; open first panel
151
+ if ( key === "collapsible" && !value && this.options.active === false ) {
152
+ this._activate( 0 );
153
+ }
154
+
155
+ if ( key === "icons" ) {
156
+ this._destroyIcons();
157
+ if ( value ) {
158
+ this._createIcons();
159
+ }
160
+ }
161
+
162
+ // #5332 - opacity doesn't cascade to positioned elements in IE
163
+ // so we need to add the disabled class to the headers and panels
164
+ if ( key === "disabled" ) {
165
+ this.headers.add( this.headers.next() )
166
+ .toggleClass( "ui-state-disabled", !!value );
167
+ }
168
+ },
169
+
170
+ _keydown: function( event ) {
171
+ /*jshint maxcomplexity:15*/
172
+ if ( event.altKey || event.ctrlKey ) {
173
+ return;
174
+ }
175
+
176
+ var keyCode = $.ui.keyCode,
177
+ length = this.headers.length,
178
+ currentIndex = this.headers.index( event.target ),
179
+ toFocus = false;
180
+
181
+ switch ( event.keyCode ) {
182
+ case keyCode.RIGHT:
183
+ case keyCode.DOWN:
184
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
185
+ break;
186
+ case keyCode.LEFT:
187
+ case keyCode.UP:
188
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
189
+ break;
190
+ case keyCode.SPACE:
191
+ case keyCode.ENTER:
192
+ this._eventHandler( event );
193
+ break;
194
+ case keyCode.HOME:
195
+ toFocus = this.headers[ 0 ];
196
+ break;
197
+ case keyCode.END:
198
+ toFocus = this.headers[ length - 1 ];
199
+ break;
200
+ }
201
+
202
+ if ( toFocus ) {
203
+ $( event.target ).attr( "tabIndex", -1 );
204
+ $( toFocus ).attr( "tabIndex", 0 );
205
+ toFocus.focus();
206
+ event.preventDefault();
207
+ }
208
+ },
209
+
210
+ _panelKeyDown : function( event ) {
211
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
212
+ $( event.currentTarget ).prev().focus();
213
+ }
214
+ },
215
+
216
+ refresh: function() {
217
+ var options = this.options;
218
+ this._processPanels();
219
+
220
+ // was collapsed or no panel
221
+ if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
222
+ options.active = false;
223
+ this.active = $();
224
+ // active false only when collapsible is true
225
+ } if ( options.active === false ) {
226
+ this._activate( 0 );
227
+ // was active, but active panel is gone
228
+ } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
229
+ // all remaining panel are disabled
230
+ if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
231
+ options.active = false;
232
+ this.active = $();
233
+ // activate previous panel
234
+ } else {
235
+ this._activate( Math.max( 0, options.active - 1 ) );
236
+ }
237
+ // was active, active panel still exists
238
+ } else {
239
+ // make sure active index is correct
240
+ options.active = this.headers.index( this.active );
241
+ }
242
+
243
+ this._destroyIcons();
244
+
245
+ this._refresh();
246
+ },
247
+
248
+ _processPanels: function() {
249
+ this.headers = this.element.find( this.options.header )
250
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
251
+
252
+ this.headers.next()
253
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
254
+ .filter(":not(.ui-accordion-content-active)")
255
+ .hide();
256
+ },
257
+
258
+ _refresh: function() {
259
+ var maxHeight,
260
+ options = this.options,
261
+ heightStyle = options.heightStyle,
262
+ parent = this.element.parent(),
263
+ accordionId = this.accordionId = "ui-accordion-" +
264
+ (this.element.attr( "id" ) || ++uid);
265
+
266
+ this.active = this._findActive( options.active )
267
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
268
+ .removeClass( "ui-corner-all" );
269
+ this.active.next()
270
+ .addClass( "ui-accordion-content-active" )
271
+ .show();
272
+
273
+ this.headers
274
+ .attr( "role", "tab" )
275
+ .each(function( i ) {
276
+ var header = $( this ),
277
+ headerId = header.attr( "id" ),
278
+ panel = header.next(),
279
+ panelId = panel.attr( "id" );
280
+ if ( !headerId ) {
281
+ headerId = accordionId + "-header-" + i;
282
+ header.attr( "id", headerId );
283
+ }
284
+ if ( !panelId ) {
285
+ panelId = accordionId + "-panel-" + i;
286
+ panel.attr( "id", panelId );
287
+ }
288
+ header.attr( "aria-controls", panelId );
289
+ panel.attr( "aria-labelledby", headerId );
290
+ })
291
+ .next()
292
+ .attr( "role", "tabpanel" );
293
+
294
+ this.headers
295
+ .not( this.active )
296
+ .attr({
297
+ "aria-selected": "false",
298
+ tabIndex: -1
299
+ })
300
+ .next()
301
+ .attr({
302
+ "aria-expanded": "false",
303
+ "aria-hidden": "true"
304
+ })
305
+ .hide();
306
+
307
+ // make sure at least one header is in the tab order
308
+ if ( !this.active.length ) {
309
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
310
+ } else {
311
+ this.active.attr({
312
+ "aria-selected": "true",
313
+ tabIndex: 0
314
+ })
315
+ .next()
316
+ .attr({
317
+ "aria-expanded": "true",
318
+ "aria-hidden": "false"
319
+ });
320
+ }
321
+
322
+ this._createIcons();
323
+
324
+ this._setupEvents( options.event );
325
+
326
+ if ( heightStyle === "fill" ) {
327
+ maxHeight = parent.height();
328
+ this.element.siblings( ":visible" ).each(function() {
329
+ var elem = $( this ),
330
+ position = elem.css( "position" );
331
+
332
+ if ( position === "absolute" || position === "fixed" ) {
333
+ return;
334
+ }
335
+ maxHeight -= elem.outerHeight( true );
336
+ });
337
+
338
+ this.headers.each(function() {
339
+ maxHeight -= $( this ).outerHeight( true );
340
+ });
341
+
342
+ this.headers.next()
343
+ .each(function() {
344
+ $( this ).height( Math.max( 0, maxHeight -
345
+ $( this ).innerHeight() + $( this ).height() ) );
346
+ })
347
+ .css( "overflow", "auto" );
348
+ } else if ( heightStyle === "auto" ) {
349
+ maxHeight = 0;
350
+ this.headers.next()
351
+ .each(function() {
352
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
353
+ })
354
+ .height( maxHeight );
355
+ }
356
+ },
357
+
358
+ _activate: function( index ) {
359
+ var active = this._findActive( index )[ 0 ];
360
+
361
+ // trying to activate the already active panel
362
+ if ( active === this.active[ 0 ] ) {
363
+ return;
364
+ }
365
+
366
+ // trying to collapse, simulate a click on the currently active header
367
+ active = active || this.active[ 0 ];
368
+
369
+ this._eventHandler({
370
+ target: active,
371
+ currentTarget: active,
372
+ preventDefault: $.noop
373
+ });
374
+ },
375
+
376
+ _findActive: function( selector ) {
377
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
378
+ },
379
+
380
+ _setupEvents: function( event ) {
381
+ var events = {
382
+ keydown: "_keydown"
383
+ };
384
+ if ( event ) {
385
+ $.each( event.split(" "), function( index, eventName ) {
386
+ events[ eventName ] = "_eventHandler";
387
+ });
388
+ }
389
+
390
+ this._off( this.headers.add( this.headers.next() ) );
391
+ this._on( this.headers, events );
392
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" });
393
+ this._hoverable( this.headers );
394
+ this._focusable( this.headers );
395
+ },
396
+
397
+ _eventHandler: function( event ) {
398
+ var options = this.options,
399
+ active = this.active,
400
+ clicked = $( event.currentTarget ),
401
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
402
+ collapsing = clickedIsActive && options.collapsible,
403
+ toShow = collapsing ? $() : clicked.next(),
404
+ toHide = active.next(),
405
+ eventData = {
406
+ oldHeader: active,
407
+ oldPanel: toHide,
408
+ newHeader: collapsing ? $() : clicked,
409
+ newPanel: toShow
410
+ };
411
+
412
+ event.preventDefault();
413
+
414
+ if (
415
+ // click on active header, but not collapsible
416
+ ( clickedIsActive && !options.collapsible ) ||
417
+ // allow canceling activation
418
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
419
+ return;
420
+ }
421
+
422
+ options.active = collapsing ? false : this.headers.index( clicked );
423
+
424
+ // when the call to ._toggle() comes after the class changes
425
+ // it causes a very odd bug in IE 8 (see #6720)
426
+ this.active = clickedIsActive ? $() : clicked;
427
+ this._toggle( eventData );
428
+
429
+ // switch classes
430
+ // corner classes on the previously active header stay after the animation
431
+ active.removeClass( "ui-accordion-header-active ui-state-active" );
432
+ if ( options.icons ) {
433
+ active.children( ".ui-accordion-header-icon" )
434
+ .removeClass( options.icons.activeHeader )
435
+ .addClass( options.icons.header );
436
+ }
437
+
438
+ if ( !clickedIsActive ) {
439
+ clicked
440
+ .removeClass( "ui-corner-all" )
441
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
442
+ if ( options.icons ) {
443
+ clicked.children( ".ui-accordion-header-icon" )
444
+ .removeClass( options.icons.header )
445
+ .addClass( options.icons.activeHeader );
446
+ }
447
+
448
+ clicked
449
+ .next()
450
+ .addClass( "ui-accordion-content-active" );
451
+ }
452
+ },
453
+
454
+ _toggle: function( data ) {
455
+ var toShow = data.newPanel,
456
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
457
+
458
+ // handle activating a panel during the animation for another activation
459
+ this.prevShow.add( this.prevHide ).stop( true, true );
460
+ this.prevShow = toShow;
461
+ this.prevHide = toHide;
462
+
463
+ if ( this.options.animate ) {
464
+ this._animate( toShow, toHide, data );
465
+ } else {
466
+ toHide.hide();
467
+ toShow.show();
468
+ this._toggleComplete( data );
469
+ }
470
+
471
+ toHide.attr({
472
+ "aria-expanded": "false",
473
+ "aria-hidden": "true"
474
+ });
475
+ toHide.prev().attr( "aria-selected", "false" );
476
+ // if we're switching panels, remove the old header from the tab order
477
+ // if we're opening from collapsed state, remove the previous header from the tab order
478
+ // if we're collapsing, then keep the collapsing header in the tab order
479
+ if ( toShow.length && toHide.length ) {
480
+ toHide.prev().attr( "tabIndex", -1 );
481
+ } else if ( toShow.length ) {
482
+ this.headers.filter(function() {
483
+ return $( this ).attr( "tabIndex" ) === 0;
484
+ })
485
+ .attr( "tabIndex", -1 );
486
+ }
487
+
488
+ toShow
489
+ .attr({
490
+ "aria-expanded": "true",
491
+ "aria-hidden": "false"
492
+ })
493
+ .prev()
494
+ .attr({
495
+ "aria-selected": "true",
496
+ tabIndex: 0
497
+ });
498
+ },
499
+
500
+ _animate: function( toShow, toHide, data ) {
501
+ var total, easing, duration,
502
+ that = this,
503
+ adjust = 0,
504
+ down = toShow.length &&
505
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
506
+ animate = this.options.animate || {},
507
+ options = down && animate.down || animate,
508
+ complete = function() {
509
+ that._toggleComplete( data );
510
+ };
511
+
512
+ if ( typeof options === "number" ) {
513
+ duration = options;
514
+ }
515
+ if ( typeof options === "string" ) {
516
+ easing = options;
517
+ }
518
+ // fall back from options to animation in case of partial down settings
519
+ easing = easing || options.easing || animate.easing;
520
+ duration = duration || options.duration || animate.duration;
521
+
522
+ if ( !toHide.length ) {
523
+ return toShow.animate( showProps, duration, easing, complete );
524
+ }
525
+ if ( !toShow.length ) {
526
+ return toHide.animate( hideProps, duration, easing, complete );
527
+ }
528
+
529
+ total = toShow.show().outerHeight();
530
+ toHide.animate( hideProps, {
531
+ duration: duration,
532
+ easing: easing,
533
+ step: function( now, fx ) {
534
+ fx.now = Math.round( now );
535
+ }
536
+ });
537
+ toShow
538
+ .hide()
539
+ .animate( showProps, {
540
+ duration: duration,
541
+ easing: easing,
542
+ complete: complete,
543
+ step: function( now, fx ) {
544
+ fx.now = Math.round( now );
545
+ if ( fx.prop !== "height" ) {
546
+ adjust += fx.now;
547
+ } else if ( that.options.heightStyle !== "content" ) {
548
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
549
+ adjust = 0;
550
+ }
551
+ }
552
+ });
553
+ },
554
+
555
+ _toggleComplete: function( data ) {
556
+ var toHide = data.oldPanel;
557
+
558
+ toHide
559
+ .removeClass( "ui-accordion-content-active" )
560
+ .prev()
561
+ .removeClass( "ui-corner-top" )
562
+ .addClass( "ui-corner-all" );
563
+
564
+ // Work around for rendering bug in IE (#5421)
565
+ if ( toHide.length ) {
566
+ toHide.parent()[0].className = toHide.parent()[0].className;
567
+ }
568
+
569
+ this._trigger( "activate", null, data );
570
+ }
571
+ });
572
+
573
+ })( jQuery );
574
+
575
+ });