| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | /* ============================================================= | 
					
						
							| 
									
										
										
										
											2012-09-06 01:00:57 +08:00
										 |  |  |  * bootstrap-collapse.js v2.1.2 | 
					
						
							| 
									
										
										
										
											2012-01-25 03:08:03 +08:00
										 |  |  |  * http://twitter.github.com/bootstrap/javascript.html#collapse
 | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |  * ============================================================= | 
					
						
							| 
									
										
										
										
											2012-01-15 15:28:48 +08:00
										 |  |  |  * Copyright 2012 Twitter, Inc. | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  |  * you may not use this file except in compliance with the License. | 
					
						
							|  |  |  |  * You may obtain a copy of the License at | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  * See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  * limitations under the License. | 
					
						
							|  |  |  |  * ============================================================ */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-25 09:59:04 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  | !function ($) { | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |   "use strict"; // jshint ;_;
 | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |  /* COLLAPSE PUBLIC CLASS DEFINITION | 
					
						
							|  |  |  |   * ================================ */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   var Collapse = function (element, options) { | 
					
						
							|  |  |  |     this.$element = $(element) | 
					
						
							| 
									
										
										
										
											2011-12-21 10:02:47 +08:00
										 |  |  |     this.options = $.extend({}, $.fn.collapse.defaults, options) | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |     if (this.options.parent) { | 
					
						
							|  |  |  |       this.$parent = $(this.options.parent) | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 10:02:47 +08:00
										 |  |  |     this.options.toggle && this.toggle() | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Collapse.prototype = { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-01 14:42:22 +08:00
										 |  |  |     constructor: Collapse | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   , dimension: function () { | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |       var hasWidth = this.$element.hasClass('width') | 
					
						
							|  |  |  |       return hasWidth ? 'width' : 'height' | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   , show: function () { | 
					
						
							| 
									
										
										
										
											2012-03-21 13:43:27 +08:00
										 |  |  |       var dimension | 
					
						
							|  |  |  |         , scroll | 
					
						
							|  |  |  |         , actives | 
					
						
							| 
									
										
										
										
											2011-11-28 09:31:12 +08:00
										 |  |  |         , hasData | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-21 13:43:27 +08:00
										 |  |  |       if (this.transitioning) return | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       dimension = this.dimension() | 
					
						
							|  |  |  |       scroll = $.camelCase(['scroll', dimension].join('-')) | 
					
						
							|  |  |  |       actives = this.$parent && this.$parent.find('> .accordion-group > .in') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-28 09:31:12 +08:00
										 |  |  |       if (actives && actives.length) { | 
					
						
							|  |  |  |         hasData = actives.data('collapse') | 
					
						
							| 
									
										
										
										
											2012-04-16 07:15:32 +08:00
										 |  |  |         if (hasData && hasData.transitioning) return | 
					
						
							| 
									
										
										
										
											2011-11-28 09:31:12 +08:00
										 |  |  |         actives.collapse('hide') | 
					
						
							|  |  |  |         hasData || actives.data('collapse', null) | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       this.$element[dimension](0) | 
					
						
							| 
									
										
										
										
											2012-03-25 09:20:09 +08:00
										 |  |  |       this.transition('addClass', $.Event('show'), 'shown') | 
					
						
							| 
									
										
										
										
											2012-06-03 12:26:34 +08:00
										 |  |  |       $.support.transition && this.$element[dimension](this.$element[0][scroll]) | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   , hide: function () { | 
					
						
							| 
									
										
										
										
											2012-03-21 13:43:27 +08:00
										 |  |  |       var dimension | 
					
						
							|  |  |  |       if (this.transitioning) return | 
					
						
							|  |  |  |       dimension = this.dimension() | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |       this.reset(this.$element[dimension]()) | 
					
						
							| 
									
										
										
										
											2012-03-25 09:20:09 +08:00
										 |  |  |       this.transition('removeClass', $.Event('hide'), 'hidden') | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |       this.$element[dimension](0) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |   , reset: function (size) { | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |       var dimension = this.dimension() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       this.$element | 
					
						
							|  |  |  |         .removeClass('collapse') | 
					
						
							| 
									
										
										
										
											2012-01-30 13:14:07 +08:00
										 |  |  |         [dimension](size || 'auto') | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |         [0].offsetWidth | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |       this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') | 
					
						
							| 
									
										
										
										
											2012-03-13 04:37:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       return this | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |   , transition: function (method, startEvent, completeEvent) { | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |       var that = this | 
					
						
							|  |  |  |         , complete = function () { | 
					
						
							| 
									
										
										
										
											2012-04-25 09:06:41 +08:00
										 |  |  |             if (startEvent.type == 'show') that.reset() | 
					
						
							| 
									
										
										
										
											2012-03-21 13:43:27 +08:00
										 |  |  |             that.transitioning = 0 | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |             that.$element.trigger(completeEvent) | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-25 09:20:09 +08:00
										 |  |  |       this.$element.trigger(startEvent) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (startEvent.isDefaultPrevented()) return | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-21 13:43:27 +08:00
										 |  |  |       this.transitioning = 1 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-25 09:20:09 +08:00
										 |  |  |       this.$element[method]('in') | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       $.support.transition && this.$element.hasClass('collapse') ? | 
					
						
							|  |  |  |         this.$element.one($.support.transition.end, complete) : | 
					
						
							|  |  |  |         complete() | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   , toggle: function () { | 
					
						
							|  |  |  |       this[this.$element.hasClass('in') ? 'hide' : 'show']() | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |  /* COLLAPSIBLE PLUGIN DEFINITION | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |   * ============================== */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  |   $.fn.collapse = function (option) { | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |     return this.each(function () { | 
					
						
							|  |  |  |       var $this = $(this) | 
					
						
							|  |  |  |         , data = $this.data('collapse') | 
					
						
							|  |  |  |         , options = typeof option == 'object' && option | 
					
						
							|  |  |  |       if (!data) $this.data('collapse', (data = new Collapse(this, options))) | 
					
						
							|  |  |  |       if (typeof option == 'string') data[option]() | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   $.fn.collapse.defaults = { | 
					
						
							|  |  |  |     toggle: true | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 15:28:48 +08:00
										 |  |  |   $.fn.collapse.Constructor = Collapse | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  /* COLLAPSIBLE DATA-API | 
					
						
							|  |  |  |   * ==================== */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   $(function () { | 
					
						
							| 
									
										
										
										
											2012-06-03 08:28:38 +08:00
										 |  |  |     $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { | 
					
						
							| 
									
										
										
										
											2012-01-28 17:35:13 +08:00
										 |  |  |       var $this = $(this), href | 
					
						
							|  |  |  |         , target = $this.attr('data-target') | 
					
						
							|  |  |  |           || e.preventDefault() | 
					
						
							|  |  |  |           || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
 | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |         , option = $(target).data('collapse') ? 'toggle' : $this.data() | 
					
						
							| 
									
										
										
										
											2012-06-03 08:28:38 +08:00
										 |  |  |       $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') | 
					
						
							| 
									
										
										
										
											2011-11-26 09:23:14 +08:00
										 |  |  |       $(target).collapse(option) | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  | }(window.jQuery); |