1/* ======================================================================== 2 * Bootstrap: collapse.js v3.2.0 3 * http://getbootstrap.com/javascript/#collapse 4 * ======================================================================== 5 * Copyright 2011-2014 Twitter, Inc. 6 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 * ======================================================================== */ 8 9 10+function ($) { 11 'use strict'; 12 13 // COLLAPSE PUBLIC CLASS DEFINITION 14 // ================================ 15 16 var Collapse = function (element, options) { 17 this.$element = $(element) 18 this.options = $.extend({}, Collapse.DEFAULTS, options) 19 this.transitioning = null 20 21 if (this.options.parent) this.$parent = $(this.options.parent) 22 if (this.options.toggle) this.toggle() 23 } 24 25 Collapse.VERSION = '3.2.0' 26 27 Collapse.DEFAULTS = { 28 toggle: true 29 } 30 31 Collapse.prototype.dimension = function () { 32 var hasWidth = this.$element.hasClass('width') 33 return hasWidth ? 'width' : 'height' 34 } 35 36 Collapse.prototype.show = function () { 37 if (this.transitioning || this.$element.hasClass('in')) return 38 39 var startEvent = $.Event('show.bs.collapse') 40 this.$element.trigger(startEvent) 41 if (startEvent.isDefaultPrevented()) return 42 43 var actives = this.$parent && this.$parent.find('> .panel > .in') 44 45 if (actives && actives.length) { 46 var hasData = actives.data('bs.collapse') 47 if (hasData && hasData.transitioning) return 48 Plugin.call(actives, 'hide') 49 hasData || actives.data('bs.collapse', null) 50 } 51 52 var dimension = this.dimension() 53 54 this.$element 55 .removeClass('collapse') 56 .addClass('collapsing')[dimension](0) 57 58 this.transitioning = 1 59 60 var complete = function () { 61 this.$element 62 .removeClass('collapsing') 63 .addClass('collapse in')[dimension]('') 64 this.transitioning = 0 65 this.$element 66 .trigger('shown.bs.collapse') 67 } 68 69 if (!$.support.transition) return complete.call(this) 70 71 var scrollSize = $.camelCase(['scroll', dimension].join('-')) 72 73 this.$element 74 .one('bsTransitionEnd', $.proxy(complete, this)) 75 .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) 76 } 77 78 Collapse.prototype.hide = function () { 79 if (this.transitioning || !this.$element.hasClass('in')) return 80 81 var startEvent = $.Event('hide.bs.collapse') 82 this.$element.trigger(startEvent) 83 if (startEvent.isDefaultPrevented()) return 84 85 var dimension = this.dimension() 86 87 this.$element[dimension](this.$element[dimension]())[0].offsetHeight 88 89 this.$element 90 .addClass('collapsing') 91 .removeClass('collapse in') 92 93 this.transitioning = 1 94 95 var complete = function () { 96 this.transitioning = 0 97 this.$element 98 .trigger('hidden.bs.collapse') 99 .removeClass('collapsing') 100 .addClass('collapse') 101 } 102 103 if (!$.support.transition) return complete.call(this) 104 105 this.$element 106 [dimension](0) 107 .one('bsTransitionEnd', $.proxy(complete, this)) 108 .emulateTransitionEnd(350) 109 } 110 111 Collapse.prototype.toggle = function () { 112 this[this.$element.hasClass('in') ? 'hide' : 'show']() 113 } 114 115 116 // COLLAPSE PLUGIN DEFINITION 117 // ========================== 118 119 function Plugin(option) { 120 return this.each(function () { 121 var $this = $(this) 122 var data = $this.data('bs.collapse') 123 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) 124 125 if (!data && options.toggle && option == 'show') option = !option 126 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) 127 if (typeof option == 'string') data[option]() 128 }) 129 } 130 131 var old = $.fn.collapse 132 133 $.fn.collapse = Plugin 134 $.fn.collapse.Constructor = Collapse 135 136 137 // COLLAPSE NO CONFLICT 138 // ==================== 139 140 $.fn.collapse.noConflict = function () { 141 $.fn.collapse = old 142 return this 143 } 144 145 146 // COLLAPSE DATA-API 147 // ================= 148 149 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { 150 var href 151 var $this = $(this) 152 var target = $this.attr('data-target') 153 || e.preventDefault() 154 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 155 var $target = $(target) 156 var data = $target.data('bs.collapse') 157 var option = data ? 'toggle' : $this.data() 158 var parent = $this.attr('data-parent') 159 var $parent = parent && $(parent) 160 161 if (!data || !data.transitioning) { 162 if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 163 $this.toggleClass('collapsed', $target.hasClass('in')) 164 } 165 166 Plugin.call($target, option) 167 }) 168 169}(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.