1/** 2 * @package Helix3 Framework 3 * @author JoomShaper https://www.joomshaper.com 4 * @copyright (c) 2010 - 2026 JoomShaper 5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later 6 */ 7(function ($) { 8 // collapse 9 var Collapse = function (element, options) { 10 this.$element = $(element); 11 this.options = $.extend({}, $.fn.collapse.defaults, options); 12 13 if (this.options.parent) { 14 this.$parent = $(this.options.parent); 15 } 16 17 this.options.toggle && this.toggle(); 18 }; 19 20 Collapse.prototype = { 21 constructor: Collapse, 22 23 dimension: function () { 24 var hasWidth = this.$element.hasClass("width"); 25 return hasWidth ? "width" : "height"; 26 }, 27 28 show: function () { 29 var dimension, scroll, actives, hasData; 30 31 if (this.transitioning || this.$element.hasClass("in")) return; 32 33 dimension = this.dimension(); 34 scroll = $.camelCase(["scroll", dimension].join("-")); 35 actives = this.$parent && this.$parent.find("> .accordion-group > .in"); 36 37 if (actives && actives.length) { 38 hasData = actives.data("collapse"); 39 if (hasData && hasData.transitioning) return; 40 actives.collapse("hide"); 41 hasData || actives.data("collapse", null); 42 } 43 44 this.$element[dimension](0); 45 this.transition("addClass", $.Event("show"), "shown"); 46 $.support.transition && 47 this.$element[dimension](this.$element[0][scroll]); 48 }, 49 50 hide: function () { 51 var dimension; 52 if (this.transitioning || !this.$element.hasClass("in")) return; 53 dimension = this.dimension(); 54 this.reset(this.$element[dimension]()); 55 this.transition("removeClass", $.Event("hide"), "hidden"); 56 this.$element[dimension](0); 57 }, 58 59 reset: function (size) { 60 var dimension = this.dimension(); 61 62 this.$element.removeClass("collapse")[dimension](size || "auto")[0] 63 .offsetWidth; 64 65 this.$element[size !== null ? "addClass" : "removeClass"]("collapse"); 66 67 return this; 68 }, 69 70 transition: function (method, startEvent, completeEvent) { 71 var that = this, 72 complete = function () { 73 if (startEvent.type == "show") that.reset(); 74 that.transitioning = 0; 75 that.$element.trigger(completeEvent); 76 }; 77 78 this.$element.trigger(startEvent); 79 80 if (startEvent.isDefaultPrevented()) return; 81 82 this.transitioning = 1; 83 84 this.$element[method]("in"); 85 86 $.support.transition && this.$element.hasClass("collapse") 87 ? this.$element.one($.support.transition.end, complete) 88 : complete(); 89 }, 90 91 toggle: function () { 92 this[this.$element.hasClass("in") ? "hide" : "show"](); 93 }, 94 }; 95 96 var old = $.fn.collapse; 97 98 $.fn.collapse = function (option) { 99 return this.each(function () { 100 var $this = $(this), 101 data = $this.data("collapse"), 102 options = $.extend( 103 {}, 104 $.fn.collapse.defaults, 105 $this.data(), 106 typeof option == "object" && option, 107 ); 108 if (!data) $this.data("collapse", (data = new Collapse(this, options))); 109 if (typeof option == "string") data[option](); 110 }); 111 }; 112 113 $.fn.collapse.defaults = { 114 toggle: true, 115 }; 116 117 $.fn.collapse.Constructor = Collapse; 118 119 $.fn.collapse.noConflict = function () { 120 $.fn.collapse = old; 121 return this; 122 }; 123 124 $(document).on( 125 "click.collapse.data-api", 126 "[data-toggle=collapse]", 127 function (e) { 128 var $this = $(this), 129 href, 130 target = 131 $this.attr("data-target") || 132 e.preventDefault() || 133 ((href = $this.attr("href")) && href.replace(/.*(?=#[^\s]+$)/, "")), //strip for ie7 134 option = $(target).data("collapse") ? "toggle" : $this.data(); 135 $this[$(target).hasClass("in") ? "addClass" : "removeClass"]("collapsed"); 136 $(target).collapse(option); 137 }, 138 ); 139})(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.