PageSourceSearch

https://cricketmedia.com/wp-content/plugins/happy-elementor-addons/assets/js/happy-addons.min.js?ver=3.3.2

js cricketmedia.com collected 2026-10-03 21:38:42 UTC 35,014 bytes, 1,217 lines download raw bytes

1;(function ($) {
2	'use strict';
3
4	var $window = $(window)
5
6	$.fn.getHappySettings = function() {
7		return this.data('happy-settings');
8	};
9
10	function debounce(func, wait, immediate) {
11		var timeout;
12		return function() {
13			var context = this, args = arguments;
14			var later = function() {
15				timeout = null;
16				if (!immediate) func.apply(context, args);
17			};
18			var callNow = immediate && !timeout;
19			clearTimeout(timeout);
20			timeout = setTimeout(later, wait);
21			if (callNow) func.apply(context, args);
22		};
23	}
24
25	function initFilterNav($scope, filterFn) {
26		var $filterNav = $scope.find('.hajs-filter'),
27			defaultFilter = $filterNav.data('default-filter');
28
29		if ($filterNav.length) {
30			$filterNav.on('click.onFilterNav', 'button', function(event) {
31				event.stopPropagation();
32
33				var $current = $(this);
34				$current
35					.addClass('ha-filter__item--active')
36					.siblings()
37					.removeClass('ha-filter__item--active');
38				filterFn($current.data('filter'));
39			});
40
41			$filterNav.find('[data-filter="'+defaultFilter+'"]').click();
42		}
43	}
44
45	/**
46	 * Initialize magnific lighbox gallery
47	 *
48	 * @param {$element, selector, isEnabled, key} settings
49	 */
50	function initPopupGallery(settings) {
51		settings.$element.on('click', settings.selector, function(event) {
52			event.preventDefault();
53		});
54
55		if ( ! $.fn.magnificPopup ) {
56			return;
57		}
58
59		if ( ! settings.isEnabled ) {
60			$.magnificPopup.close();
61			return;
62		}
63
64		var windowWidth = $(window).width(),
65			mobileWidth = elementorFrontendConfig.breakpoints.md,
66			tabletWidth = elementorFrontendConfig.breakpoints.lg;
67
68		settings.$element.find(settings.selector).magnificPopup({
69			key: settings.key,
70			type: 'image',
71			image: {
72				titleSrc: function(item) {
73					return item.el.attr('title') ? item.el.attr('title') : item.el.find('img').attr('alt');
74				}
75			},
76			gallery: {
77				enabled: true,
78				preload: [1,2]
79			},
80			zoom: {
81				enabled: true,
82				duration: 300,
83				easing: 'ease-in-out',
84				opener: function(openerElement) {
85					return openerElement.is('img') ? openerElement : openerElement.find('img');
86				}
87			},
88			disableOn: function() {
89				if (settings.disableOnMobile && windowWidth < mobileWidth) {
90					return false;
91				}
92
93				if (settings.disableOnTablet && windowWidth >= mobileWidth && windowWidth < tabletWidth) {
94					return false;
95				}
96
97				return true;
98			}
99		});
100	}
101
102	var HandleImageCompare = function($scope) {
103		var $item = $scope.find('.hajs-image-comparison'),
104			settings = $item.getHappySettings(),
105			fieldMap = {
106				on_hover: 'move_slider_on_hover',
107				on_swipe: 'move_with_handle_only',
108				on_click: 'click_to_move'
109			};
110
111		settings[fieldMap[settings.move_handle || 'on_swipe']] = true;
112		delete settings.move_handle;
113
114		$item.imagesLoaded().done(function() {
115			$item.twentytwenty(settings);
116
117			var t = setTimeout(function() {
118				$window.trigger('resize.twentytwenty');
119				clearTimeout(t);
120			}, 400);
121		});
122	};
123
124	$window.on('elementor/frontend/init', function() {
125		var ModuleHandler = elementorModules.frontend.handlers.Base;
126
127		var SliderBase = ModuleHandler.extend({
128			bindEvents: function() {
129				this.removeArrows();
130				this.run();
131			},
132
133			removeArrows: function() {
134				var _this = this;
135
136				this.elements.$container.on('init', function() {
137					_this.elements.$container.siblings().hide();
138				});
139			},
140
141			getDefaultSettings: function() {
142				return {
143					autoplay    : true,
144					arrows      : false,
145					checkVisible: false,
146					container   : '.hajs-slick',
147					dots        : false,
148					infinite    : true,
149					rows        : 0,
150					slidesToShow: 1,
151					prevArrow   : $('<div />').append(this.findElement('.slick-prev').clone().show()).html(),
152					nextArrow   : $('<div />').append(this.findElement('.slick-next').clone().show()).html()
153				}
154			},
155
156			getDefaultElements: function () {
157				return {
158					$container: this.findElement(this.getSettings('container'))
159				};
160			},
161
162			onElementChange: debounce(function() {
163				this.elements.$container.slick('unslick');
164				this.run();
165			}, 200),
166
167			getSlickSettings: function() {
168				var settings = {
169					infinite: !! this.getElementSettings('loop'),
170					autoplay: !! this.getElementSettings('autoplay'),
171					autoplaySpeed: this.getElementSettings('autoplay_speed'),
172					speed: this.getElementSettings('animation_speed'),
173					centerMode: !! this.getElementSettings('center'),
174					vertical: !! this.getElementSettings('vertical'),
175					slidesToScroll: 1,
176				};
177
178				switch (this.getElementSettings('navigation')) {
179					case 'arrow':
180						settings.arrows = true;
181						break;
182					case 'dots':
183						settings.dots = true;
184						break;
185					case 'both':
186						settings.arrows = true;
187						settings.dots = true;
188						break;
189				}
190
191				settings.slidesToShow = parseInt( this.getElementSettings('slides_to_show') ) || 1;
192				settings.responsive = [
193					{
194						breakpoint: elementorFrontend.config.breakpoints.lg,
195						settings: {
196							slidesToShow: (parseInt(this.getElementSettings('slides_to_show_tablet')) || settings.slidesToShow),
197						}
198					},
199					{
200						breakpoint: elementorFrontend.config.breakpoints.md,
201						settings: {
202							slidesToShow: (parseInt(this.getElementSettings('slides_to_show_mobile')) || parseInt(this.getElementSettings('slides_to_show_tablet'))) || settings.slidesToShow,
203						}
204					}
205				];
206
207				return $.extend({}
207, this.getSettings(), settings);
208			},
209
210			run: function() {
211				this.elements.$container.slick(this.getSlickSettings());
212			}
213		});
214
215		var NumberHandler = function($scope) {
216			elementorFrontend.waypoint($scope, function () {
217				var $number = $scope.find('.ha-number-text');
218				$number.numerator($number.data('animation'));
219			});
220		};
221
222		var SkillHandler = function($scope) {
223			elementorFrontend.waypoint($scope, function () {
224				$scope.find('.ha-skill-level').each(function() {
225					var $current = $(this),
226						$lt = $current.find('.ha-skill-level-text'),
227						lv = $current.data('level');
228
229					$current.animate({
230						width: lv+'%'
231					}, 500);
232					$lt.numerator({
233						toValue: lv + '%',
234						duration: 1300,
235						onStep: function() {
236							$lt.append('%');
237						}
238					});
239				});
240			});
241		};
242
243		var ImageGrid = ModuleHandler.extend({
244			onInit: function () {
245				ModuleHandler.prototype.onInit.apply(this, arguments);
246				this.run();
247				this.runFilter();
248
249				$window.on('resize', debounce(this.run.bind(this), 100));
250			},
251
252			getLayoutMode: function() {
253				var layout = this.getElementSettings('layout');
254				return ( layout === 'even' ? 'masonry' : layout );
255			},
256
257			getDefaultSettings: function() {
258				return {
259					itemSelector: '.ha-image-grid__item',
260					percentPosition: true,
261					layoutMode: this.getLayoutMode(),
262				};
263			},
264
265			getDefaultElements: function() {
266				return {
267					$container: this.findElement('.hajs-isotope')
268				};
269			},
270
271			getLightBoxSettings: function() {
272				return {
273					key            : 'imagegrid',
274					$element       : this.$element,
275					selector       : '.ha-js-lightbox',
276					isEnabled      : !!this.getElementSettings('enable_popup'),
277					disableOnTablet: !!this.getElementSettings('disable_lightbox_on_tablet'),
278					disableOnMobile: !!this.getElementSettings('disable_lightbox_on_mobile')
279				};
280			},
281
282			runFilter: function() {
283				var self = this,
284					lbSettings = this.getLightBoxSettings();
285
286				initFilterNav(this.$element, function(filter) {
287					self.elements.$container.isotope({
288						filter: filter
289					});
290
291					if (filter !== '*') {
292						lbSettings.selector = filter;
293					}
294
295					initPopupGallery(lbSettings);
296				});
297			},
298
299			onElementChange: function(changedProp) {
300				if (['layout', 'image_height', 'columns', 'image_margin', 'enable_popup'].indexOf(changedProp) !== -1) {
301					this.run();
302				}
303			},
304
305			run: function() {
306				var self = this;
307
308				self.elements
309					.$container
310					.isotope(self.getDefaultSettings())
311					.imagesLoaded().progress(function() {
312						self.elements.$container.isotope('layout');
313					});
314
315				initPopupGallery(self.getLightBoxSettings());
316			}
317		});
318
319		var JustifiedGrid = ModuleHandler.extend({
320			onInit: function () {
321				ModuleHandler.prototype.onInit.apply(this, arguments);
322				this.run();
323				this.runFilter();
324
325				$window.on('resize', debounce(this.run.bind(this), 100));
326			},
327
328			getDefaultSettings: function() {
329				return {
330					rowHeight: +this.getElementSettings('row_height.size') || 150,
331					lastRow: this.getElementSettings('last_row'),
332					margins: +this.getElementSettings('margins.size'),
333					captions: !!this.getElementSettings('show_caption')
334				};
335			},
336
337			getDefaultElements: function() {
338				return {
339					$container: this.findElement('.hajs-justified-grid')
340				};
341			},
342
343			getLightBoxSettings: function() {
344				return {
345					key            : 'justifiedgallery',
346					$element       : this.$element,
347					selector       : '.ha-js-lightbox',
348					isEnabled      : !!this.getElementSettings('enable_popup'),
349					disableOnTablet: !!this.getElementSettings('disable_lightbox_on_tablet'),
350					disableOnMobile: !!this.getElementSettings('disable_lightbox_on_mobile')
351				};
352			},
353
354			runFilter: function() {
355				var self = this,
356					lbSettings = this.getLightBoxSettings(),
357					settings = {
358						lastRow: this.getElementSettings('last_row')
359					};
360
361				initFilterNav(self.$element, function(filter) {
362					if (filter !== '*') {
363						settings.lastRow = 'nojustify';
364						lbSettings.selector = filter
365					}
366
367					settings.filter = filter;
368					self.elements.$container.justifiedGallery(settings);
369
370					initPopupGallery(lbSettings);
371				});
372			},
373
374			onElementChange: function(changedProp) {
375				if (['row_height', 'last_row', 'margins', 'show_caption', 'enable_popup'].indexOf(changedProp) !== -1) {
376					this.run();
377				}
378			},
379
380			run: function() {
381				this.elements
382					.$container
383					.justifiedGallery(this.getDefaultSettings());
384
385				initPopupGallery(this.getLightBoxSettings());
386			}
387		});
388
389		// NewsTicker
390		var NewsTicker = ModuleHandler.extend({
391
392			onInit: function () {
393				ModuleHandler.prototype.onInit.apply(this, arguments);
394				this.wrapper = this.$element.find('.ha-news-ticker-wrapper');
395				this.run();
396			},
397			onElementChange: function (changed_prop) {
398				if( changed_prop === 'item_space' || changed_prop === 'title_typography_font_size' ){
399					this.run();
400				}
401			},
402			run: function () {
403				if( 0 == this.wrapper.length){
404					return;
405				}
406				var wrapper_height = this.wrapper.innerHeight(),
407					wrapper_width = this.wrapper.innerWidth(),
408					container = this.wrapper.find('.ha-news-ticker-container'),
409					single_item = container.find('.ha-news-ticker-item'),
410					scroll_direction = this.wrapper.data('scroll-direction'),
411					scroll = "scroll" + scroll_direction + parseInt(wrapper_height) + parseInt(wrapper_width),
412					duration = this.wrapper.data('duration'),
413					direction = 'normal',
414					all_title_width = 10;
415
416				var start = {'transform': 'translateX(0'+wrapper_width+'px)'},
417					end = {'transform': 'translateX(-101%)'};
418				if('right' === scroll_direction){
419					direction = 'reverse';
420				}
421				single_item.each(function(){
422					all_title_width += $(this).outerWidth(true);
423				});
424				container.css({'width':all_title_width,'display':'flex'});
425				$.keyframe.define([{
426					name: scroll,
427					'0%': start,
428					'100%':end,
429				}]);
430				container.playKeyframe({
431					name: scroll,
432					duration: duration.toString() + "ms",
433					timingFunction: 'linear',
434					delay: '0s',
435					iterationCount: 'infinite',
436					direction: direction,
437					fillMode: 'none',
438					complete: function(){
439					}
440				});
441			}
442		});
443
444		// Fun factor
445		var FunFactor = function ($scope) {
446			elementorFrontend.waypoint($scope, function () {
447				var $fun_factor = $scope.find('.ha-fun-factor__content-number');
448				$fun_factor.numerator($fun_factor.data('animation'));
449			});
450		};
451
452		var BarChart = function($scope) {
453			elementorFrontend.waypoint($scope, function () {
454				var $chart = $(this),
455					$container = $chart.find( '.ha-bar-chart-container' ),
456					$chart_canvas = $chart.find( '#ha-bar-chart' ),
457					settings      = $container.data( 'settings' );
458
459				if ( $container.length ) {
460					new Chart( $chart_canvas, settings );
461				}
462			} );
463		};
464
465		//twitter Feed
466		var TwitterFeed = function($scope) {
467			var button = $scope.find('.ha-twitter-load-more');
468			var twitter_wrap = $scope.find('.ha-tweet-items');
469			button.on("click", function(e) {
470				e.preventDefault();
471				var $self = $(this),
472					query_settings = $self.data("settings"),
473					total = $self.data("total"),
474					items = $scope.find('.ha-tweet-item').length;
475				$.ajax({
476					url: HappyLocalize.ajax_url,
477					type: 'POST',
478					data: {
479						action: "ha_twitter_feed_action",
480						security: HappyLocalize.nonce,
481						query_settings: query_settings,
482						loaded_item: items,
483					},
484					success: function(response) {
485						if(total > items){
486							$(response).appendTo(twitter_wrap);
487						}else{
488							$self.text('All Loaded').addClass('loaded');
489							setTimeout( function(){
490								$self.css({"display": "none"});
491							},800);
492						}
493					},
494					error: function(error) {}
495				});
496			});
497		};
498
499		//PostTab
500		var PostTab = ModuleHandler.extend({
501
502			onInit: function () {
503				ModuleHandler.prototype.onInit.apply(this, arguments);
504				this.wrapper = this.$element.find('.ha-post-tab');
505				this.run();
506			},
507			run: function () {
508				var filter_wrap = this.wrapper.find('.ha-post-tab-filter'),
509					filter = filter_wrap.find('li'),
510					event = this.wrapper.data('event'),
511					args = this.wrapper.data('query-args');
512
513				filter.on(event, debounce(function (e) {
514					e.preventDefault();
515
516					var $self = $(this),
517						term_id = $self.data("term"),
518						$wrapper = $self.closest(".ha-post-tab"),
519						content = $wrapper.find('.ha-post-tab-content'),
520						loading = content.find('.ha-post-tab-loading'),
521						tab_item = content.find('.ha-post-tab-item-wrapper'),
522						$content_exist = false;
523
524					if (0 === loading.length) {
525						filter.removeClass('active');
526						tab_item.removeClass('active');
527						$self.addClass('active');
528
529						tab_item.each(function () {
530							var $self = $(this),
531								$content_id = $self.data("term");
532							if (term_id === $content_id) {
533								$self.addClass('active');
534								$content_exist = true;
535							}
536						});
537
538						if (false === $content_exist) {
539							$.ajax({
540								url: HappyLocalize.ajax_url,
541								type: 'POST',
542								data: {
543									action: "ha_post_tab_action",
544									security: HappyLocalize.nonce,
545									post_tab_query: args,
546									term_id: term_id,
547								},
548								beforeSend: function () {
549									content.append('<span class="ha-post-tab-loading"><i class="eicon-spinner eicon-animation-spin"></i></span>');
550								},
551								success: function (response) {
552									content.find('.ha-post-tab-loading').remove();
553									content.append(response);
554								},
555								error: function (error) {
556								}
557							});
558
559						}
560					}
561
562				}, 200));
563			}
564		});
565
566		var DataTable = function($scope) {
567			var columnTH = $scope.find('.ha-table__head-column-cell');
568			var rowTR = $scope.find('.ha-table__body-row');
569
570			rowTR.each( function( i, tr) {
571				var th = $(tr).find('.ha-table__body-row-cell');
572				th.each( function( index, th ) {
573					$(th).prepend( '<div class="ha-table__head-column-cell">' + columnTH.eq(index).html() + '</div>' );
574				} );
575			} );
576		};
577
578		//Threesixty Rotation
579		var Threesixty_Rotation = function($scope) {
580			var ha_circlr = $scope.find('.ha-threesixty-rotation-inner');
581			var cls = ha_circlr.data('selector');
582			var autoplay = ha_circlr.data('autoplay');
583			var glass_on = $scope.find('.ha-threesixty-rotation-magnify');
584			var t360 = $scope.find('.ha-threesixty-rotation-360img');
585			var zoom = glass_on.data('zoom');
586
587			var playb = $scope.find('.ha-threesixty-rotation-play');
588
589			var crl = circlr(cls, {
590				play : true,
591			});
592
593			if( 'on' ===autoplay ){
594				var autoplay_btn = $scope.find('.ha-threesixty-rotation-autoplay');
595				autoplay_btn.on('click', function(el) {
596					el.preventDefault();
597					crl.play();
598					t360.remove();
599				});
600				setTimeout(function(){
601					autoplay_btn.trigger('click');
602					autoplay_btn.remove();
603				},1000);
604			}else {
605				playb.on('click', function(el) {
606					el.preventDefault();
607					var $self = $(this);
608					var $i = $self.find('i');
609					if($i.hasClass('hm-play-button')){
610						$i.removeClass('hm-play-button');
611						$i.addClass('hm-stop');
612						crl.play();
613					}else{
614						$i.removeClass('hm-stop');
615						$i.addClass('hm-play-button');
616						crl.stop();
617					}
618					t360.remove();
619				});
620			}
621
622			glass_on.on('click', function(el) {
623				var img_block = $scope.find('img');
624				img_block.each(function(){
625					var style = $(this).attr('style');
626					if( -1 !== style.indexOf("block") ){
627						HappySimplaMagnify($(this)[0],zoom);
628						glass_on.css('display','none');
629						t360.remove();
630					}
631				});
632			});
633
634			$(document).on('click', function (e) {
635				var t = $(e.target);
636				var magnifier = $scope.find('.ha-img-magnifier-glass');
637				var i = glass_on.find('i');
638				if( magnifier.length && t[0] !== i[0] ){
639					magnifier.remove();
640					glass_on.removeAttr('style');
641				}
642				if( t[0] === ha_circlr[0] ){
643					t360.remove();
644				}
645			});
646
647			ha_circlr.on('mouseup mousedown', function (e) {
648				t360.remove();
649			});
650
651		};
652
653		//Event Calendar
654		var Event_Calendar = function($scope) {
655			var calendarEl =  $scope.find('.ha-ec');
656			var popup = $scope.find('.ha-ec-popup-wrapper');
657			var popupClose = $scope.find(".ha-ec-popup-close");
658			var events = calendarEl.data('events');
659			var initialview = calendarEl.data('initialview');
660			var firstday = calendarEl.data('firstday');
661			var locale = calendarEl.data('locale');
662			var showPopup = calendarEl.data('show-popup');
663			var allday_text = calendarEl.data('allday-text');
664
665			if( 'undefined' == typeof events){
666				return;
667			}
668
669			var option = {
670				stickyHeaderDates: false,
671				locale: locale,
672				headerToolbar: {
673					left: "prev,next today",
674					center: "title",
675					right: "dayGridMonth,timeGridWeek,timeGridDay,listMonth"
676				},
677				initialView: initialview,
678				firstDay: firstday,
679				eventTimeFormat: { // like '7pm'
680					hour: 'numeric',
681					minute: '2-digit',
682					meridiem: 'short'
683				},
684				events: events,
685
686				height: 'auto',
687
688				eventClick: function (info) {
689					info.jsEvent.preventDefault(); // don't let the browser navigate
690
691					if( 'yes' != showPopup){
692						return;
693					}
694
695					function getTheDate(timeString) {
696						return new Date(timeString);
697					}
698
699					function timeFormat(date) {
700						var hours = date.getHours();
701						var minutes = date.getMinutes();
702						var ampm = hours >= 12 ? 'pm' : 'am';
703						hours = hours % 12;
704						hours = hours ? hours : 12; // the hour '0' should be '12'
705						minutes = minutes < 10 ? '0' + minutes : minutes;
706						var strTime = hours + ':' + minutes + '' + ampm;
707						return strTime;
708					}
709
710					var todayDateString = info.view.calendar.currentData.currentDate.toString(),
711						allDay = info.event.allDay,
712						title = info.event.title,
713						startDate = info.event.startStr,
714						endDate = info.event.endStr,
715						guest = info.event.extendedProps.guest,
716						location = info.event.extendedProps.location,
717						description = info.event.extendedProps.description,
718						detailsUrl = info.event.url,
719						imageUrl = info.event.extendedProps.image;
720
721					var titleWrap = popup.find('.ha-ec-event-title'),
722						timeWrap = popup.find('.ha-ec-event-time-wrap'),
723						guestWrap = popup.find('.ha-ec-event-guest-wrap'),
724						locationWrap = popup.find('.ha-ec-event-location-wrap'),
725						descWrap = popup.find('.ha-ec-popup-desc'),
726						detailsWrap = popup.find('.ha-ec-popup-readmore-link'),
727						imageWrap = popup.find('.ha-ec-popup-image');
728
729					// display none
730					imageWrap.css('display', 'none');
731					titleWrap.css('display', 'none');
732					timeWrap.css('display', 'none');
733					guestWrap.css('display', 'none');
734					locationWrap.css('display', 'none');
735					descWrap.css('display', 'none');
736					detailsWrap.css('display', 'none');
737
738					popup.addClass("ha-ec-popup-ready");
739
740					// image markup
741					if (imageUrl) {
742						imageWrap.removeAttr("style");
743						imageWrap.find('img').attr("src", imageUrl );
744						imageWrap.find('img').attr("alt", title );
745					}
746
747					// title markup
748					if (title) {
749						titleWrap.removeAttr("style");
750						titleWrap.html(title);
751					}
752
753					// guest markup
754					if (guest) {
755						guestWrap.removeAttr("style");
756						guestWrap.find('span.ha-ec-event-guest').html( guest );
757					}
758
759					// location markup
760					if (location) {
761						locationWrap.removeAttr("style");
762						locationWrap.find('span.ha-ec-event-location').html( location );
763					}
764
765					// description markup
766					if (description) {
767						descWrap.removeAttr("style");
768						descWrap.html(description);
769					}
770
771					// time markup
772					if (allDay !== true) {
773						timeWrap.removeAttr("style");
774						startDate = Date.parse(getTheDate(startDate));
775						endDate = Date.parse(getTheDate(endDate));
776						var startTimeText = timeFormat(getTheDate(startDate));
777						var endTimeText = 'Invalid Data';
778						if (startDate < endDate) {
779							endTimeText = timeFormat(getTheDate(endDate));
780						}
781						timeWrap.find('span.ha-ec-event-time').html(startTimeText + ' - ' + endTimeText);
782					}else{
783						timeWrap.removeAttr("style");
784						timeWrap.find('span.ha-ec-event-time').html(allday_text);
785					}
786
787					// read more markup
788					if (detailsUrl) {
789						detailsWrap.removeAttr("style");
790						detailsWrap.attr("href", detailsUrl);
791						if ("on" === info.event.extendedProps.external) {
792							detailsWrap.attr("target", "_blank");
793						}
794						if ("on" === info.event.extendedProps.nofollow) {
795							detailsWrap.attr("rel", "nofollow");
796						}
797					}
798				},
799				dateClick: function (arg) {
800					itemDate = arg.date.toUTCString();
801				}
802			}
803
804			var calendar = new FullCalendar.Calendar( calendarEl[0], option );
805				calendar.render();
806
807			$scope.find(".ha-ec-popup-wrapper").on("click", function (e) {
808				e.stopPropagation();
809
810				if(e.target === e.currentTarget || e.target == popupClose[0] || e.target == popupClose.find(".eicon-editor-close")[0]){
811					popup.addClass("ha-ec-popup-removing").removeClass("ha-ec-popup-ready");
812				}
813			});
814
815		};
816
817		//Image Accordion
818		var Image_Accordion = function($scope) {
819			if($scope.hasClass('ha-image-accordion-click')) {
820				var items = $scope.find('.ha-ia-item');
821				items.each(function (inx, btn){
822					$(this).on('click', function(e) {
823						// e.preventDefault();
824						if($(this).hasClass('active')) {
825							return;
826						}else {
827							items.removeClass('active');
828							$(this).addClass('active');
829						}
830					} );
831				});
832			}
833		};
834
835		//Content Switcher
836		var Content_Switcher = function($scope) {
837			var parent = $scope.find('.ha-content-switcher-wrapper'),
838				designType = parent.data('design-type');
839
840			if(designType == 'button') {
841				var buttons = parent.find('.ha-cs-button'),
842					contents = parent.find('.ha-cs-content-section');
843				buttons.each(function (inx, btn){
844					$(this).on('click', function(e) {
845						e.preventDefault();
846						if($(this).hasClass('active')) {
847							return;
848						}else {
849							buttons.removeClass('active');
850							$(this).addClass('active');
851
852							contents.removeClass('active');
853							var contentId = $(this).data('content-id');
854							parent.find('#'+contentId).addClass('active');
855						}
856					} );
857				});
858
859			}else{
860				var toggleSwitch = parent.find('.ha-cs-switch.ha-input-label'),
861					input = parent.find('input.ha-cs-toggle-switch'),
862					primarySwitcher = parent.find('.ha-cs-switch.primary'),
863					secondarySwitcher = parent.find('.ha-cs-switch.secondary'),
864					primaryContent = parent.find('.ha-cs-content-section.primary'),
865					secondaryContent = parent.find('.ha-cs-content-section.secondary');
866
867				toggleSwitch.on('click', function(e){
868
869					if(input.is(':checked')){
870						primarySwitcher.removeClass('active');
871						primaryContent.removeClass('active');
872						secondarySwitcher.addClass('active');
873						secondaryContent.addClass('active');
874					}else {
875						secondarySwitcher.removeClass('active');
876						secondaryContent.removeClass('active');
877						primarySwitcher.addClass('active');
878						primaryContent.addClass('active');
879					}
880				});
881
882			}
883
884		};
885
886		var MailChimp = elementorModules.frontend.handlers.Base.extend({
887
888			onInit: function () {
889				elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments);
890				this.elForm = this.$element.find('.ha-mailchimp-form');
891				this.elMessage = this.$element.find('.ha-mc-response-message');
892				this.successMessage = this.elForm.data('success-message');
893				this.run();
894			},
895			getReadySettings: function () {
896				var settings = {
897					formAlign: this.getElementSettings('form_alignment'),
898					formAlignTablet: this.getElementSettings('form_alignment_tablet') || this.getElementSettings('form_alignment'),
899					formAlignMobile: this.getElementSettings('form_alignment_mobile') || this.getElementSettings('form_alignment_tablet') || this.getElementSettings('form_alignment'),
900				};
901				return $.extend({}, settings);
902			},
903			onElementChange: function () {
904				this.run();
905			},
906			run: function () {
907				var settings = this.getReadySettings();
908				var elForm = this.elForm;
909				var elMessage = this.elMessage;
910				var successMessage = this.successMessage;
911
912				elForm.on('submit', function(e){
913					e.preventDefault();
914
915					var data = {
916						action: 'ha_mailchimp_ajax',
917						security: HappyLocalize.nonce,
918						subscriber_info: elForm.serialize(),
919						list_id: elForm.data('list-id'),
920						post_id: elForm.parent().data('post-id'),
921						widget_id: elForm.parent().data('widget-id'),
922					};
923
924					$.ajax({
925						type: 'post',
926						url: HappyLocalize.ajax_url,
927						data: data,
928						success: function(response) {
929							elForm.trigger('reset');
930
931							if(response.status){
932								elMessage.removeClass('error');
933								elMessage.addClass('success');
934								elMessage.text(successMessage);
935							}else {
936								elMessage.addClass('error');
937								elMessage.removeClass('success');
938								elMessage.text(response.msg);
939							}
940
941						},
942						error: function(error) {
943
944						}
945					});
946
947				});
948
949				var mobileWidth = elementorFrontendConfig.breakpoints.sm;
950				var tabletWidth = elementorFrontendConfig.breakpoints.md;
951
952				function responsiveClass(){
953
954					var windowWidth = $(window).width();
955
956					if (windowWidth > tabletWidth) {
957						elForm.removeClass('vertical');
958						elForm.removeClass('horizontal');
959						elForm.addClass(settings.formAlign);
960					}else if(windowWidth > mobileWidth && windowWidth <= tabletWidth) {
961						elForm.removeClass('vertical');
962						elForm.removeClass('horizontal');
963						elForm.addClass(settings.formAlignTablet);
964					}else if ( windowWidth <= mobileWidth ) {
965						elForm.removeClass('vertical');
966						elForm.removeClass('horizontal');
967						if ( elForm.hasClass('multiple_form_fields') ){
968							elForm.addClass('vertical');
969						}else {
970							elForm.addClass(settings.formAlignMobile);
971						}
972					}
973
974				};
975
976				responsiveClass();
977				$(window).on('load, resize', responsiveClass);
978
979			}
980		});
981
982
983
984		//Team Member
985		var Team_Member = function($scope) {
986			var btn = $scope.find('.ha-btn');
987			var lightBox = $scope.find('.ha-member-lightbox');
988			if( lightBox.length > 0 ){
989
990				var close = lightBox.find('.ha-member-lightbox-close');
991
992				btn.on('click', function(){
993					lightBox.addClass('ha-member-lightbox-show');
994				});
995
996				lightBox.on('click', function(e){
997					if( lightBox.hasClass('ha-member-lightbox-show') ) {
998						if( e.target == lightBox[0] ) {
999							lightBox.removeClass('ha-member-lightbox-show');
1000						}
1001						else if( e.target == close[0] ) {
1002							lightBox.removeClass('ha-member-lightbox-show');
1003						}
1004						else if( e.target == close.find('i.eicon-editor-close')[0] ) {
1005							lightBox.removeClass('ha-member-lightbox-show');
1006						}
1007					}
1008				});
1009			}
1010		};
1011
1012		//Creative Button
1013		var Creative_Button = function($scope) {
1014			var btn_wrap = $scope.find('.ha-creative-btn-wrap');
1015			var magnetic = btn_wrap.data('magnetic');
1016			var btn = btn_wrap.find('a.ha-creative-btn');
1017			if( 'yes' == magnetic ){
1018				btn_wrap.on('mousemove', function(e) {
1019					var x = e.pageX - ( btn_wrap.offset().left + ( btn_wrap.outerWidth() / 2 ) );
1020					var y = e.pageY - ( btn_wrap.offset().top + ( btn_wrap.outerHeight() / 2 ) );
1021					btn.css("transform", "translate(" + x * 0.3 + "px, " + y * 0.5 + "px)");
1022				});
1023				btn_wrap.on('mouseout', function(e){
1024					btn.css("transform", "translate(0px, 0px)");
1025				});
1026			}
1027			//For expandable button style only
1028			var expandable = $scope.find('.ha-eft--expandable');
1029			var text = expandable.find('.text');
1030			if ( expandable.length > 0 && text.length > 0 ) {
1031				text[0].addEventListener("transitionend", function () {
1032					if (text[0].style.width) {
1033						text[0].style.width = "auto";
1034					}
1035				});
1036				expandable[0].addEventListener("mouseenter", function (e) {
1037					e.currentTarget.classList.add('hover');
1038					text[0].style.width = "auto";
1039					var predicted_answer = text[0].offsetWidth;
1040					text[0].style.width = "0";
1041					window.getComputedStyle(text[0]).transform;
1042					text[0].style.width = "".concat(predicted_answer, "px");
1043
1044				});
1045				expandable[0].addEventListener("mouseleave", function (e) {
1046					e.currentTarget.classList.remove('hover');
1047					text[0].style.width = "".concat(text[0].offsetWidth, "px");
1048					window.getComputedStyle(text[0]).transform;
1049					text[0].style.width = "";
1050				});
1051			}
1052		};
1053
1054		//PDF View
1055		var PDF_View = function($scope) {
1056			// console.log($scope);
1057			var viewer_container = $scope.find('.pdf_viewer_container');
1058			
1059			var settings = viewer_container.data('pdf-settings');
1060			if(settings.pdfjs_expres == "yes" && settings.license) {
1061
1062			WebViewer({
1063				path: HappyLocalize.pdf_js_lib, // path to the PDF.js Express'lib' folder on your server
1064				// licenseKey: settings.license,
1065				licenseKey: settings.license,
1066				// initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/webviewer-demo.pdf',
1067				// initialDoc: 'http://www.africau.edu/images/default/sample.pdf',
1068				initialDoc: settings.pdf_url,
1069				// initialDoc: '/path/to/my/file.pdf',  // You can also u
1069se documents on your server
1070			  }, document.getElementById(settings.unique_id))
1071			  .then(instance => {
1072				// now you can access APIs through the WebViewer instance
1073				const { Core, UI } = instance;
1074				console.log(UI);
1075				// UI.openElements(['menuOverlay','downloadButton']);
1076				// UI.openElements(['menuOverlay','fullScreenButton']);
1077				instance.setFitMode(UI.FitMode.FitWidth);
1078
1079				// UI.disableElements([ 'leftPanel', 'leftPanelButton' ]);
1080				UI.enableElements([ 'textPopup', 'copyTextButton' ]);
1081				UI.enableElements([ 'textPopup', 'textHighlightToolButton' ]);
1082				// adding an event listener for when a document is loaded
1083				Core.documentViewer.addEventListener('documentLoaded', () => {
1084				  console.log('document loaded');
1085				});
1086			
1087				// adding an event listener for when the page number has changed
1088				Core.documentViewer.addEventListener('pageNumberUpdated', (pageNumber) => {
1089				  console.log(`Page number is: ${pageNumber}`);
1090				});
1091			  });
1092			}
1093		};
1094		
1095
1096		// Slider
1097		elementorFrontend.hooks.addAction(
1098			'frontend/element_ready/ha-slider.default',
1099			function ($scope) {
1100				elementorFrontend.elementsHandler.addHandler(SliderBase, {
1101					$element: $scope
1102				});
1103			}
1104		);
1105
1106		// Carousel
1107		elementorFrontend.hooks.addAction(
1108			'frontend/element_ready/ha-carousel.default',
1109			function ($scope) {
1110				elementorFrontend.elementsHandler.addHandler(SliderBase, {
1111					$element: $scope
1112				});
1113			}
1114		);
1115
1116		//Horizontal Timeline
1117		elementorFrontend.hooks.addAction(
1118			'frontend/element_ready/ha-horizontal-timeline.default',
1119			function ($scope) {
1120				elementorFrontend.elementsHandler.addHandler(SliderBase, {
1121					$element  : $scope,
1122					autoplay  : false,
1123					container : '.ha-horizontal-timeline-wrapper',
1124					navigation: 'arrow',
1125					arrows    : true,
1126				});
1127				var img_wrap = $scope.find(".ha-horizontal-timeline-image");
1128				var magnific_popup = img_wrap.data("mfp-src");
1129
1130				if( undefined !== magnific_popup ){
1131					img_wrap.magnificPopup({
1132						type: "image",
1133						gallery: {
1134							enabled: true
1135						}
1136					});
1137				}
1138			}
1139		);
1140
1141		elementorFrontend.hooks.addAction(
1142			'frontend/element_ready/ha-mailchimp.default',
1143			function ($scope) {
1144				elementorFrontend.elementsHandler.addHandler(MailChimp, {
1145					$element: $scope,
1146				});
1147			}
1148		);
1149
1150		$('body').on('click.onWrapperLink', '[data-ha-element-link]', function() {
1151			var $wrapper = $(this),
1152			    data     = $wrapper.data('ha-element-link'),
1153			    id       = $wrapper.data('id'),
1154			    anchor   = document.createElement('a'),
1155				anchorReal,
1156				timeout;
1157
1158			anchor.id            = 'happy-addons-wrapper-link-' + id;
1159			anchor.href          = data.url;
1160			anchor.target        = data.is_external ? '_blank' : '_self';
1161			anchor.rel           = data.nofollow ? 'nofollow noreferer' : '';
1162			anchor.style.display = 'none';
1163
1164			document.body.appendChild(anchor);
1165
1166			anchorReal = document.getElementById(anchor.id);
1167			anchorReal.click();
1168
1169			timeout = setTimeout(function() {
1170				document.body.removeChild(anchorReal);
1171				clearTimeout(timeout);
1172			});
1173		});
1174
1175		// Background overlay extension
1176		var BackgroundOverlay = function($scope) {
1177			$scope.hasClass('elementor-element-edit-mode') && $scope.addClass('ha-has-bg-overlay');
1178		}
1179
1180		var fnHanlders = {
1181			'ha-image-compare.default'      : HandleImageCompare,
1182			'ha-number.default'             : NumberHandler,
1183			'ha-skills.default'             : SkillHandler,
1184			'ha-fun-factor.default'         : FunFactor,
1185			'ha-bar-chart.default'          : BarChart,
1186			'ha-twitter-feed.default'       : TwitterFeed,
1187			'ha-threesixty-rotation.default': Threesixty_Rotation,
1188			'ha-data-table.default'         : DataTable,
1189			'widget'                        : BackgroundOverlay,
1190			'ha-event-calendar.default'		: Event_Calendar,
1191			'ha-image-accordion.default'	: Image_Accordion,
1192			'ha-content-switcher.default'	: Content_Switcher,
1193			'ha-member.default'		        : Team_Member,
1194			'ha-creative-button.default'	: Creative_Button,
1195			'ha-pdf-view.default'			: PDF_View,
1196		};
1197
1198		$.each( fnHanlders, function( widgetName, handlerFn ) {
1199			elementorFrontend.hooks.addAction( 'frontend/element_ready/' + widgetName, handlerFn );
1200		});
1201
1202		var classHandlers = {
1203			'ha-image-grid.default'       : ImageGrid,
1204			'ha-justified-gallery.default': JustifiedGrid,
1205			'ha-news-ticker.default'      : NewsTicker,
1206			'ha-post-tab.default'         : PostTab
1207		};
1208
1209		$.each( classHandlers, function( widgetName, handlerClass ) {
1210			elementorFrontend.hooks.addAction( 'frontend/element_ready/' + widgetName, function( $scope ) {
1211				elementorFrontend.elementsHandler.addHandler( handlerClass, { $element: $scope });
1212			});
1213		});
1214
1215	});
1216
1217} (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.