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 $targetContent.attr( 'style', '' ); 154 $targetContent.css({ 155 display: 'block', 156 opacity: 0, 157 }); 158 that.triggerEvent( 'gem.show.vc.tabs', opt); 159 if($target.parent().outerHeight() <= $targetContent.outerHeight()) { 160 $target.parent().outerHeight($targetContent.outerHeight()); 161 } 162 next(); 163 } ) 164 .queue( function ( next ) { 165 that.triggerEvent( 'show.vc.accordion', opt); 166 $targetContent.clearQueue().finish().animate({opacity : 1}, 500, function() { 167 $target.addClass( that.activeClass ); 168 ("object" == typeof opt && opt.hasOwnProperty("changeHash") && opt.changeHash || "undefined" == typeof opt) && that.changeLocationHash(); 169 that.triggerEvent( 'afterShow.vc.accordion', opt); 170 $targetContent.attr( 'style', '' ); 171 $target.parent().attr( 'style', '' ); 172 }); 173 next(); 174 } ); 175 } else { 176 $target 177 .queue( function ( next ) { 178 $targetContent.one( Accordion.transitionName, function () { 179 $target.removeClass( that.animatingClass ); 180 $targetContent.attr( 'style', '' ); 181 that.triggerEvent( 'afterShow.vc.accordion', opt); 182 that.triggerEvent( 'gem.show.vc.accordion', opt); 183 } ); 184 Accordion.emulateTransitionEnd( $targetContent, that.getAnimationDurationMilliseconds() + 100 ); 185 next(); 186 } ) 187 .queue( function ( next ) { 188 $targetContent.attr( 'style', '' ); 189 $targetContent.css( { 190 position: 'absolute', // Optional if #myDiv is already absolute 191 visibility: 'hidden', 192 display: 'block' 193 } ); 194 var height = $targetContent.height(); 195 $targetContent.data( 'vcHeight', height ); 196 $targetContent.attr( 'style', '' ); 197 next(); 198 } ) 199 .queue( function ( next ) { 200 $targetContent.height( 0 ); 201 $targetContent.css( { 202 'padding-top': 0, 203 'padding-bottom': 0 204 } ); 205 next(); 206 } ) 207 .queue( function ( next ) { 208 $target.addClass( that.animatingClass ); 209 $target.addClass( that.activeClass ); 210 ("object" == typeof opt && opt.hasOwnProperty("changeHash") && opt.changeHash || "undefined" == typeof opt) && that.changeLocationHash(); 211 that.triggerEvent( 'show.vc.accordion', opt); 212 next(); 213 } ) 214 .queue( function ( next ) { 215 var height = $targetContent.data( 'vcHeight' ); 216 $targetContent.animate( { 'height': height }, { 217 duration: that.getAnimationDurationMilliseconds(), 218 complete: function () { 219 if (!$targetContent.data('events')) { 220 $targetContent.attr( 'style', '' ); 221 } 222 } 223 } ); 224 $targetContent.css( { 225 'padding-top': '', 226 'padding-bottom': '' 227 } ); 228 next(); 229 } ); 230 } 231 } else { 232 $target.addClass( that.activeClass ); 233 that.triggerEvent( 'show.vc.accordion', opt); 234 } 235 }; 236 237 Accordion.prototype.hide = function (opt) { 238 var $target, that, $targetContent; 239 240 that = this; 241 $target = that.getTarget(); 242 $targetContent = that.getTargetContent(); 243 244 // if hidden no need to do anything 245 if ( ! that.isActive() ) { 246 return; 247 } 248 249 if ( that.isAnimated() ) { 250 that.triggerEvent( 'beforeHide.vc.accordion' ); 251 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')))) { 252 $target 253 .queue( function ( next ) { 254 $targetContent.attr( 'style', '' ); 255 if($target.parent().outerHeight() <= $targetContent.outerHeight()) { 256 $target.parent().outerHeight($targetContent.outerHeight()); 257 } 258 $targetContent.css({ 259 display: 'block', 260 opacity: 1, 261 position: 'absolute', 262 top: '-'+$targetContent.css('border-top-width'), 263 left: '-'+$targetContent.css('border-left-width'), 264 right: '-'+$targetContent.css('border-right-width'), 265 });
266 next(); 267 } ) 268 .queue( function ( next ) { 269 that.triggerEvent( 'hide.vc.accordion', opt); 270 $targetContent.clearQueue().finish().animate({opacity : 0}, 500, function() { 271 $target.removeClass( that.activeClass ); 272 $targetContent.attr( 'style', '' ); 273 $target.parent().attr( 'style', '' ); 274 }); 275 next(); 276 } ); 277 } else { 278 $target 279 .queue( function ( next ) { 280 $targetContent.one( Accordion.transitionName, function () { 281 $target.removeClass( that.animatingClass ); 282 $targetContent.attr( 'style', '' ); 283 that.triggerEvent( 'afterHide.vc.accordion', opt); 284 } ); 285 Accordion.emulateTransitionEnd( $targetContent, that.getAnimationDurationMilliseconds() + 100 ); 286 next(); 287 } ) 288 .queue( function ( next ) { 289 $target.addClass( that.animatingClass ); 290 $target.removeClass( that.activeClass ); 291 that.triggerEvent( 'hide.vc.accordion', opt); 292 next(); 293 } ) 294 .queue( function ( next ) { 295 var height = $targetContent.height(); 296 $targetContent.height( height ); 297 next(); 298 } ) 299 .queue( function ( next ) { 300 $targetContent.animate( { 'height': 0 }, that.getAnimationDurationMilliseconds() ); 301 $targetContent.css( { 302 'padding-top': 0, 303 'padding-bottom': 0 304 } ); 305 next(); 306 } ); 307 } 308 } else { 309 $target.removeClass( that.activeClass ); 310 that.triggerEvent( 'hide.vc.accordion', opt); 311 } 312 }; 313 314 Accordion.prototype.toggle = function (opt) { 315 var $this; 316 $this = this.$element, this.isActive() ? Plugin.call($this, "hide", opt) : Plugin.call($this, "show", opt) 317 } 318 319 Accordion.prototype.dropdown = function (opt) { 320 var $this; 321 $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) { 322 Plugin.call($this, "hide", opt), $(document).off(e) 323 })) 324 } 325 326 Accordion.prototype.collapse = function (opt) { 327 var $this, $triggers; 328 $this = this.$element, $triggers = this.getActiveTriggers().filter(function () { 329 return $this[0] !== this 330 }), $triggers.length && Plugin.call($triggers, "hide", opt), Plugin.call($this, "show", opt) 331 } 332 333 Accordion.prototype.collapseAll = function (opt) { 334 var $this, $triggers; 335 $this = this.$element, $triggers = this.getActiveTriggers().filter(function () { 336 return $this[0] !== this 337 }), $triggers.length && Plugin.call($triggers, "hide", opt), Plugin.call($this, "toggle", opt) 338 } 339 340 Accordion.prototype.showNext = function (opt) { 341 var $triggers, $activeTriggers, activeIndex; 342 if ($triggers = this.getTriggers(), $activeTriggers = this.getActiveTriggers(), $triggers.length) { 343 if ($activeTriggers.length) { 344 var lastActiveAccordion; 345 lastActiveAccordion = $activeTriggers.eq($activeTriggers.length - 1).vcAccordion().data("vc.accordion"), lastActiveAccordion && lastActiveAccordion.getIndex && (activeIndex = lastActiveAccordion.getIndex()) 346 } 347 activeIndex > -1 && activeIndex + 1 < $triggers.length ? Plugin.call($triggers.eq(activeIndex + 1), "controller", opt) : Plugin.call($triggers.eq(0), "controller", opt) 348 } 349 } 350 351 Accordion.prototype.showPrev = function (opt) { 352 var $triggers, $activeTriggers, activeIndex; 353 if ($triggers = this.getTriggers(), $activeTriggers = this.getActiveTriggers(), $triggers.length) { 354 if ($activeTriggers.length) { 355 var lastActiveAccordion; 356 lastActiveAccordion = $activeTriggers.eq($activeTriggers.length - 1).vcAccordion().data("vc.accordion"), lastActiveAccordion && lastActiveAccordion.getIndex && (activeIndex = lastActiveAccordion.getIndex()) 357 } 358 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) 359 } 360 } 361 362 Accordion.prototype.showAt = function (index, opt) { 363 var $triggers; 364 $triggers = this.getTriggers(), $triggers.length && index && index < $triggers.length && Plugin.call($triggers.eq(index), "controller", opt) 365 } 366 367 Accordion.prototype.scrollToActive = function (opt) { 368 if ("undefined" == typeof opt || "undefined" == typeof opt.scrollTo || opt.scrollTo) { 369 var that, $targetElement, offset, delay, speed;
370 that = this, offset = 1, delay = 300, speed = 300, $targetElement = $(this.getTarget()), $targetElement.length && this.$element.length && setTimeout(function () { 371 var posY = $targetElement.offset().top - $(window).scrollTop() - that.$element.outerHeight() * offset; 372 0 > posY && $("html, body").animate({ 373 scrollTop: $targetElement.offset().top - that.$element.outerHeight() * offset 374 }, speed) 375 }, delay) 376 } 377 }, old = $.fn.vcAccordion, $.fn.vcAccordion = Plugin, $.fn.vcAccordion.Constructor = Accordion, $.fn.vcAccordion.noConflict = function () { 378 return $.fn.vcAccordion = old, this 379 }, clickHandler = function (e) { 380 var $this; 381 $this = $(this), e.preventDefault(), Plugin.call($this, "controller") 382 }, hashNavigation = function () { 383 var hash, $targetElement, $accordion, offset, delay, speed; 384 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 () { 385 $("html, body").animate({ 386 scrollTop: $targetElement.offset().top - $(window).height() * offset 387 }, speed) 388 }, delay), $accordion.trigger("click")))) 389 }, $(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) { 390 Plugin.call($(e.target), "scrollToActive", opt) 391 }) 392}(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.