1+ function ($) { 2 "use strict"; 3 4 function Plugin(action, options) { 5 var args; 6 return args = Array.prototype.slice.call(arguments, 1), this.each(function () { 7 var $this, data; 8 $this = $(this), data = $this.data("vc.accordion"), data || (data = new Accordion($this, $.extend(!0, {}, options)), $this.data("vc.accordion", data)), "string" == typeof action && data[action].apply(data, args) 9 }) 10 } 11 var Accordion, clickHandler, old, hashNavigation; 12 Accordion = function ($element, options) { 13 this.$element = $element, this.activeClass = "vc_active", this.animatingClass = "vc_animating", this.useCacheFlag = void 0, this.$target = void 0, this.$targetContent = void 0, this.selector = void 0, this.$container = void 0, this.animationDuration = void 0, this.index = 0 14 } 15 16 Accordion.transitionEvent = function () { 17 var transition, transitions, el; 18 el = document.createElement("vcFakeElement"), transitions = { 19 transition: "transitionend", 20 MSTransition: "msTransitionEnd", 21 MozTransition: "transitionend", 22 WebkitTransition: "webkitTransitionEnd" 23 }; 24 for (transition in transitions) 25 if ("undefined" != typeof el.style[transition]) return transitions[transition] 26 } 27 28 Accordion.emulateTransitionEnd = function ($el, duration) { 29 var callback, called; 30 called = !1, duration || (duration = 250), $el.one(Accordion.transitionName, function () { 31 called = !0 32 }), callback = function () { 33 called || $el.trigger(Accordion.transitionName) 34 }, setTimeout(callback, duration) 35 } 36 37 Accordion.DEFAULT_TYPE = "collapse", Accordion.transitionName = Accordion.transitionEvent(), Accordion.prototype.controller = function (options) { 38 var $this; 39 $this = this.$element; 40 var action = options; 41 "string" != typeof action && (action = $this.data("vcAction") || this.getContainer().data("vcAction")), "undefined" == typeof action && (action = Accordion.DEFAULT_TYPE), "string" == typeof action && Plugin.call($this, action, options) 42 } 43 44 Accordion.prototype.isCacheUsed = function () { 45 var useCache, that; 46 return that = this, useCache = function () { 47 return !1 !== that.$element.data("vcUseCache") 48 }, "undefined" == typeof this.useCacheFlag && (this.useCacheFlag = useCache()), this.useCacheFlag 49 } 50 51 Accordion.prototype.getSelector = function () { 52 var findSelector, $this; 53 return $this = this.$element, findSelector = function () { 54 var selector; 55 return selector = $this.data("vcTarget"), selector || (selector = $this.attr("href")), selector 56 }, this.isCacheUsed() ? ("undefined" == typeof this.selector && (this.selector = findSelector()), this.selector) : findSelector() 57 } 58 59 Accordion.prototype.findContainer = function () { 60 var $container; 61 return $container = this.$element.closest(this.$element.data("vcContainer")), $container.length || ($container = $("body")), $container 62 } 63 64 Accordion.prototype.getContainer = function () { 65 return this.isCacheUsed() ? ("undefined" == typeof this.$container && (this.$container = this.findContainer()), this.$container) : this.findContainer() 66 } 67 68 Accordion.prototype.getTarget = function () { 69 var selector, that, getTarget; 70 return that = this, selector = that.getSelector(), getTarget = function () { 71 var element; 72 return element = that.getContainer().find(selector), element.length || (element = that.getContainer().filter(selector)), element 73 }, this.isCacheUsed() ? ("undefined" == typeof this.$target && (this.$target = getTarget()), this.$target) : getTarget() 74 } 75 76 Accordion.prototype.getTargetContent = function () { 77 var $target, $targetContent; 78 return $target = this.getTarget(), this.isCacheUsed() ? ("undefined" == typeof this.$targetContent && ($targetContent = $target, $target.data("vcContent") && ($targetContent = $target.find($target.data("vcContent")), $targetContent.length || ($targetContent = $target)), this.$targetContent = $targetContent), this.$targetContent) : $target.data("vcContent") && ($targetContent = $target.find($target.data("vcContent")), $targetContent.length) ? $targetContent : $target 79 } 80 81 Accordion.prototype.getTriggers = function () { 82 var i; 83 return i = 0, this.getContainer().find("[data-vc-accordion]").each(function () { 84 var accordion, $this; 85 $this = $(this), accordion = $this.data("vc.accordion"), "undefined" == typeof accordion && ($this.vcAccordion(), accordion = $this.data("vc.accordion")), accordion && accordion.setIndex && accordion.setIndex(i++) 86 }) 87 } 88 89 Accordion.prototype.setIndex = function (index) { 90 this.index = index 91 } 92 93 Accordion.prototype.getIndex = function () { 94 return this.index 95 } 96 97 Accordion.prototype.triggerEvent = function (event, opt) { 98 var $event; 99 "string" == typeof event && ($event = $.Event(event), this.$element.trigger($event, opt)) 100 } 101 102 Accordion.prototype.getActiveTriggers = function () { 103 var $triggers; 104 return $triggers = this.getTriggers().filter(function () { 105 var $this, accordion; 106 return $this = $(this), accordion = $this.data("vc.accordion"), accordion.getTarget().hasClass(accordion.activeClass) 107 }) 108 } 109 110 Accordion.prototype.changeLocationHash = function () { 111 var id, $target; 112 $target = this.getTarget(), $target.length && (id = $target.attr("id")), id && (history.pushState ? history.pushState(null, null, "#" + id) : location.hash = "#" + id) 113 } 114 115 Accordion.prototype.isActive = function () { 116 return this.getTarget().hasClass(this.activeClass) 117 } 118 119 Accordion.prototype.getAnimationDuration = function () { 120 var findAnimationDuration, that; 121 return that = this, findAnimationDuration = function () { 122 var $targetContent, duration; 123 return "undefined" == typeof Accordion.transitionName ? "0s" : ($targetContent = that.getTargetContent(), duration = $targetContent.css("transition-duration"), duration = duration.split(",")[0]) 124 }, this.isCacheUsed() ? ("undefined" == typeof this.animationDuration && (this.animationDuration = findAnimationDuration()), this.animationDuration) : findAnimationDuration() 125 } 126 127 Accordion.prototype.getAnimationDurationMilliseconds = function () { 128 var duration; 129 return duration = this.getAnimationDuration(), "ms" === duration.substr(-2) ? parseInt(duration) : "s" === duration.substr(-1) ? Math.round(1e3 * parseFloat(duration)) : void 0 130 } 131 132 Accordion.prototype.isAnimated = function () { 133 return parseFloat(this.getAnimationDuration()) > 0 134 } 135 136 Accordion.prototype.show = function (opt) { 137 var $target, that, $targetContent; 138 139 that = this; 140 $target = that.getTarget(); 141 $targetContent = that.getTargetContent(); 142 143 // if showed no need to do anything 144 if ( that.isActive() ) { 145 return; 146 } 147 148 if ( that.isAnimated() ) { 149 that.triggerEvent( 'beforeShow.vc.accordion' ); 150 if(that.$container && ((that.$container.find('.vc_tta-tabs-container').length && that.$container.find('.vc_tta-tabs-container').is(':visible')) || (that.$container.find('.vc_pagination').length && that.$container.find('.vc_pagination').is(':visible')))
150) { 151 $target.clearQueue().finish() 152 .queue( function ( next ) { 153 $target.addClass( that.activeClass ); 154 $targetContent.attr( 'style', '' ); 155 $targetContent.css({ 156 display: 'block', 157 opacity: 0, 158 }); 159 that.triggerEvent( 'ct.show.vc.tabs', opt); 160 if($target.parent().outerHeight() <= $targetContent.outerHeight()) { 161 $target.parent().outerHeight($targetContent.outerHeight()); 162 } 163 next(); 164 } ) 165 .queue( function ( next ) { 166 that.triggerEvent( 'show.vc.accordion', opt); 167 $targetContent.clearQueue().finish().animate({opacity : 1}, 500, function() { 168 $target.addClass( that.activeClass ); 169 ("object" == typeof opt && opt.hasOwnProperty("changeHash") && opt.changeHash || "undefined" == typeof opt) && that.changeLocationHash(); 170 that.triggerEvent( 'afterShow.vc.accordion', opt); 171 $targetContent.attr( 'style', '' ); 172 $target.parent().attr( 'style', '' ); 173 }); 174 next(); 175 } ); 176 } else { 177 $target 178 .queue( function ( next ) { 179 $targetContent.one( Accordion.transitionName, function () { 180 $target.removeClass( that.animatingClass ); 181 $targetContent.attr( 'style', '' ); 182 that.triggerEvent( 'afterShow.vc.accordion', opt); 183 that.triggerEvent( 'ct.show.vc.accordion', opt); 184 } ); 185 Accordion.emulateTransitionEnd( $targetContent, that.getAnimationDurationMilliseconds() + 100 ); 186 next(); 187 } ) 188 .queue( function ( next ) { 189 $targetContent.attr( 'style', '' ); 190 $targetContent.css( { 191 position: 'absolute', // Optional if #myDiv is already absolute 192 visibility: 'hidden', 193 display: 'block' 194 } ); 195 var height = $targetContent.height(); 196 $targetContent.data( 'vcHeight', height ); 197 $targetContent.attr( 'style', '' ); 198 next(); 199 } ) 200 .queue( function ( next ) { 201 $targetContent.height( 0 ); 202 $targetContent.css( { 203 'padding-top': 0, 204 'padding-bottom': 0 205 } ); 206 next(); 207 } ) 208 .queue( function ( next ) { 209 $target.addClass( that.animatingClass ); 210 $target.addClass( that.activeClass ); 211 ("object" == typeof opt && opt.hasOwnProperty("changeHash") && opt.changeHash || "undefined" == typeof opt) && that.changeLocationHash(); 212 that.triggerEvent( 'show.vc.accordion', opt); 213 next(); 214 } ) 215 .queue( function ( next ) { 216 var height = $targetContent.data( 'vcHeight' ); 217 $targetContent.animate( { 'height': height }, { 218 duration: that.getAnimationDurationMilliseconds(), 219 complete: function () { 220 if (!$targetContent.data('events')) { 221 $targetContent.attr( 'style', '' ); 222 } 223 } 224 } ); 225 $targetContent.css( { 226 'padding-top': '', 227 'padding-bottom': '' 228 } ); 229 next(); 230 } ); 231 } 232 } else { 233 $target.addClass( that.activeClass ); 234 that.triggerEvent( 'show.vc.accordion', opt); 235 } 236 }; 237 238 Accordion.prototype.hide = function (opt) { 239 var $target, that, $targetContent; 240 241 that = this; 242 $target = that.getTarget(); 243 $targetContent = that.getTargetContent(); 244 245 // if hidden no need to do anything 246 if ( ! that.isActive() ) { 247 return; 248 } 249 250 if ( that.isAnimated() ) { 251 that.triggerEvent( 'beforeHide.vc.accordion' ); 252 if(that.$container && ((that.$container.find('.vc_tta-tabs-container').length && that.$container.find('.vc_tta-tabs-container').is(':visible')) || (that.$container.find('.vc_pagination').length && that.$container.find('.vc_pagination').is(':visible')))) { 253 $target 254 .queue( function ( next ) { 255 $targetContent.attr( 'style', '' ); 256 if($target.parent().outerHeight() <= $targetContent.outerHeight()) { 257 $target.parent().outerHeight($targetContent.outerHeight()); 258 } 259 $targetContent.css({ 260 display: 'block', 261 opacity: 1, 262 position: 'absolute', 263 top: '-'+$targetContent.css('border-top-width'), 264 left: '-'+$targetContent.css('border-left-width'), 265 right: '-'+$targetContent.css('border-right-width'), 266 }); 267 next(); 268 } ) 269 .queue( function ( next ) { 270 that.triggerEvent( 'hide.vc.accordion', opt); 271 $targetContent.clearQueue().finish().animate({opacity : 0}, 500, function() { 272 $target.removeClass( that.activeClass ); 273 $targetContent.attr( 'style', '' ); 274 $target.parent().attr( 'style', '' ); 275 }); 276 next(); 277 } ); 278 } else { 279 $target 280 .queue( function ( next ) { 281 $targetContent.one( Accordion.transitionName, function () { 282 $target.removeClass( that.animatingClass ); 283 $targetContent.attr( 'style', '' ); 284 that.triggerEvent( 'afterHide.vc.accordion', opt); 285 } ); 286 Accordion.emulateTransitionEnd( $targetContent, that.getAnimationDurationMilliseconds() + 100 ); 287 next(); 288 } ) 289 .queue( function ( next ) { 290 $target.addClass( that.animatingClass ); 291 $target.removeClass( that.activeClass ); 292 that.triggerEvent( 'hide.vc.accordion', opt); 293 next(); 294 } ) 295 .queue( function ( next ) { 296 var height = $targetContent.height(); 297 $targetContent.height( height ); 298 next(); 299 } ) 300 .queue( function ( next ) { 301 $targetContent.animate( { 'height': 0 }, that.getAnimationDurationMilliseconds() ); 302 $targetContent.css( { 303 'padding-top': 0, 304 'padding-bottom': 0 305 } ); 306 next(); 307 } ); 308 } 309 } else { 310 $target.removeClass( that.activeClass ); 311 that.triggerEvent( 'hide.vc.accordion', opt); 312 } 313 }; 314 315 Accordion.prototype.toggle = function (opt) { 316 var $this;
317 $this = this.$element, this.isActive() ? Plugin.call($this, "hide", opt) : Plugin.call($this, "show", opt) 318 } 319 320 Accordion.prototype.dropdown = function (opt) { 321 var $this; 322 $this = this.$element, this.isActive() ? Plugin.call($this, "hide", opt) : (Plugin.call($this, "show", opt), $(document).on("click.vc.accordion.data-api.dropdown", function (e) { 323 Plugin.call($this, "hide", opt), $(document).off(e) 324 })) 325 } 326 327 Accordion.prototype.collapse = function (opt) { 328 var $this, $triggers; 329 $this = this.$element, $triggers = this.getActiveTriggers().filter(function () { 330 return $this[0] !== this 331 }), $triggers.length && Plugin.call($triggers, "hide", opt), Plugin.call($this, "show", opt) 332 } 333 334 Accordion.prototype.collapseAll = function (opt) { 335 var $this, $triggers; 336 $this = this.$element, $triggers = this.getActiveTriggers().filter(function () { 337 return $this[0] !== this 338 }), $triggers.length && Plugin.call($triggers, "hide", opt), Plugin.call($this, "toggle", opt) 339 } 340 341 Accordion.prototype.showNext = function (opt) { 342 var $triggers, $activeTriggers, activeIndex; 343 if ($triggers = this.getTriggers(), $activeTriggers = this.getActiveTriggers(), $triggers.length) { 344 if ($activeTriggers.length) { 345 var lastActiveAccordion; 346 lastActiveAccordion = $activeTriggers.eq($activeTriggers.length - 1).vcAccordion().data("vc.accordion"), lastActiveAccordion && lastActiveAccordion.getIndex && (activeIndex = lastActiveAccordion.getIndex()) 347 } 348 activeIndex > -1 && activeIndex + 1 < $triggers.length ? Plugin.call($triggers.eq(activeIndex + 1), "controller", opt) : Plugin.call($triggers.eq(0), "controller", opt) 349 } 350 } 351 352 Accordion.prototype.showPrev = function (opt) { 353 var $triggers, $activeTriggers, activeIndex; 354 if ($triggers = this.getTriggers(), $activeTriggers = this.getActiveTriggers(), $triggers.length) { 355 if ($activeTriggers.length) { 356 var lastActiveAccordion; 357 lastActiveAccordion = $activeTriggers.eq($activeTriggers.length - 1).vcAccordion().data("vc.accordion"), lastActiveAccordion && lastActiveAccordion.getIndex && (activeIndex = lastActiveAccordion.getIndex()) 358 } 359 activeIndex > -1 ? activeIndex - 1 >= 0 ? Plugin.call($triggers.eq(activeIndex - 1), "controller", opt) : Plugin.call($triggers.eq($triggers.length - 1), "controller", opt) : Plugin.call($triggers.eq(0), "controller", opt) 360 } 361 } 362 363 Accordion.prototype.showAt = function (index, opt) { 364 var $triggers; 365 $triggers = this.getTriggers(), $triggers.length && index && index < $triggers.length && Plugin.call($triggers.eq(index), "controller", opt) 366 } 367 368 Accordion.prototype.scrollToActive = function (opt) { 369 if ("undefined" == typeof opt || "undefined" == typeof opt.scrollTo || opt.scrollTo) { 370 var that, $targetElement, offset, delay, speed; 371 that = this, offset = 1, delay = 300, speed = 300, $targetElement = $(this.getTarget()), $targetElement.length && this.$element.length && setTimeout(function () { 372 var posY = $targetElement.offset().top - $(window).scrollTop() - that.$element.outerHeight() * offset; 373 0 > posY && $("html, body").animate({ 374 scrollTop: $targetElement.offset().top - that.$element.outerHeight() * offset 375 }, speed) 376 }, delay) 377 } 378 }, old = $.fn.vcAccordion, $.fn.vcAccordion = Plugin, $.fn.vcAccordion.Constructor = Accordion, $.fn.vcAccordion.noConflict = function () { 379 return $.fn.vcAccordion = old, this 380 }, clickHandler = function (e) { 381 var $this; 382 $this = $(this), e.preventDefault(), Plugin.call($this, "controller") 383 }, hashNavigation = function () { 384 var hash, $targetElement, $accordion, offset, delay, speed; 385 offset = .2, delay = 300, speed = 0, hash = window.location.hash, hash && ($targetElement = $(hash), $targetElement.length && ($accordion = $targetElement.find('[data-vc-accordion][href="' + hash + '"],[data-vc-accordion][data-vc-target="' + hash + '"]'), $accordion.length && (setTimeout(function () { 386 $("html, body").animate({ 387 scrollTop: $targetElement.offset().top - $(window).height() * offset 388 }, speed) 389 }, delay), $accordion.trigger("click")))) 390 }, $(window).on("hashchange.vc.accordion", hashNavigation), $(document).on("click.vc.accordion.data-api", "[data-vc-accordion]", clickHandler), $(document).on("ready.vc.accordion", hashNavigation), $(document).on("afterShow.vc.accordion", function (e, opt) { 391 Plugin.call($(e.target), "scrollToActive", opt) 392 }) 393}(window.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.