"use strict"; ; (function ($) { 'use strict'; var $window = $(window); $.fn.gethappysettings = function () { return this.data('happy-settings'); }; function debounce(func, wait, immediate) { var timeout; return function () { var context = this, args = arguments; var later = function later() { timeout = null; if (!immediate) func.apply(context, args); }; var callnow = immediate && !timeout; cleartimeout(timeout); timeout = settimeout(later, wait); if (callnow) func.apply(context, args); }; } function initfilternav($scope, filterfn) { var $filternav = $scope.find('.hajs-filter'), defaultfilter = $filternav.data('default-filter'); if ($filternav.length) { $filternav.on('click.onfilternav', 'button', function (event) { event.stoppropagation(); var $current = $(this); $current.addclass('ha-filter__item--active').siblings().removeclass('ha-filter__item--active'); filterfn($current.data('filter')); }); $filternav.find('[data-filter="' + defaultfilter + '"]').click(); } } /** * initialize magnific lighbox gallery * * @param {$element, selector, isenabled, key} settings */ function initpopupgallery(settings) { settings.$element.on('click', settings.selector, function (event) { event.preventdefault(); }); if (!$.fn.magnificpopup) { return; } if (!settings.isenabled) { $.magnificpopup.close(); return; } var windowwidth = $(window).width(), mobilewidth = elementorfrontendconfig.breakpoints.md, tabletwidth = elementorfrontendconfig.breakpoints.lg; settings.$element.find(settings.selector).magnificpopup({ key: settings.key, type: 'image', image: { titlesrc: function titlesrc(item) { return item.el.attr('title') ? item.el.attr('title') : item.el.find('img').attr('alt'); } }, gallery: { enabled: true, preload: [1, 2] }, zoom: { enabled: true, duration: 300, easing: 'ease-in-out', opener: function opener(openerelement) { return openerelement.is('img') ? openerelement : openerelement.find('img'); } }, disableon: function disableon() { if (settings.disableonmobile && windowwidth < mobilewidth) { return false; } if (settings.disableontablet && windowwidth >= mobilewidth && windowwidth < tabletwidth) { return false; } return true; } }); } var handleimagecompare = function handleimagecompare($scope) { var $item = $scope.find('.hajs-image-comparison'), settings = $item.gethappysettings(), fieldmap = { on_hover: 'move_slider_on_hover', on_swipe: 'move_with_handle_only', on_click: 'click_to_move' }; settings[fieldmap[settings.move_handle || 'on_swipe']] = true; delete settings.move_handle; $item.imagesloaded().done(function () { $item.twentytwenty(settings); var t = settimeout(function () { $window.trigger('resize.twentytwenty'); cleartimeout(t); }, 400); }); }; $window.on('elementor/frontend/init', function () { var modulehandler = elementormodules.frontend.handlers.base; var sliderbase = modulehandler.extend({ bindevents: function bindevents() { this.removearrows(); this.run(); }, removearrows: function removearrows() { var _this = this; this.elements.$container.on('init', function () { _this.elements.$container.siblings().hide(); }); }, getdefaultsettings: function getdefaultsettings() { return { autoplay: true, arrows: false, checkvisible: false, container: '.hajs-slick', dots: false, infinite: true, rows: 0, slidestoshow: 1, prevarrow: $('
').append(this.findelement('.slick-prev').clone().show()).html(), nextarrow: $('
').append(this.findelement('.slick-next').clone().show()).html() }; }, getdefaultelements: function getdefaultelements() { return { $container: this.findelement(this.getsettings('container')) }; }, onelementchange: debounce(function () { this.elements.$container.slick('unslick'); this.run(); }, 200), getslicksettings: function getslicksettings() { var settings = { infinite: !!this.getelementsettings('loop'), autoplay: !!this.getelementsettings('autoplay'), autoplayspeed: this.getelementsettings('autoplay_speed'), speed: this.getelementsettings('animation_speed'), centermode: !!this.getelementsettings('center'), vertical: !!this.getelementsettings('vertical'), slidestoscroll: 1 }; switch (this.getelementsettings('navigation')) { case 'arrow': settings.arrows = true; break; case 'dots': settings.dots = true; break; case 'both': settings.arrows = true; settings.dots = true; break; } settings.slidestoshow = parseint(this.getelementsettings('slides_to_show')) || 1; settings.responsive = [{ breakpoint: elementorfrontend.config.breakpoints.lg, settings: { slidestoshow: parseint(this.getelementsettings('slides_to_show_tablet')) || settings.slidestoshow } }, { breakpoint: elementorfrontend.config.breakpoints.md, settings: { slidestoshow: parseint(this.getelementsettings('slides_to_show_mobile')) || parseint(this.getelementsettings('slides_to_show_tablet')) || settings.slidestoshow } }]; return $.extend({}, this.getsettings(), settings); }, run: function run() { this.elements.$container.slick(this.getslicksettings()); } }); var numberhandler = function numberhandler($scope) { elementorfrontend.waypoint($scope, function () { var $number = $scope.find('.ha-number-text'); $number.numerator($number.data('animation')); }); }; var skillhandler = function skillhandler($scope) { elementorfrontend.waypoint($scope, function () { $scope.find('.ha-skill-level').each(function () { var $current = $(this), $lt = $current.find('.ha-skill-level-text'), lv = $current.data('level'); $current.animate({ width: lv + '%' }, 500); $lt.numerator({ tovalue: lv + '%', duration: 1300, onstep: function onstep() { $lt.append('%'); } }); }); }); }; var imagegrid = modulehandler.extend({ oninit: function oninit() { modulehandler.prototype.oninit.apply(this, arguments); this.run(); this.runfilter(); $window.on('resize', debounce(this.run.bind(this), 100)); }, getlayoutmode: function getlayoutmode() { var layout = this.getelementsettings('layout'); return layout === 'even' ? 'masonry' : layout; }, getdefaultsettings: function getdefaultsettings() { return { itemselector: '.ha-image-grid__item', percentposition: true, layoutmode: this.getlayoutmode() }; }, getdefaultelements: function getdefaultelements() { return { $container: this.findelement('.hajs-isotope') }; }, getlightboxsettings: function getlightboxsettings() { return { key: 'imagegrid', $element: this.$element, selector: '.ha-js-lightbox', isenabled: !!this.getelementsettings('enable_popup'), disableontablet: !!this.getelementsettings('disable_lightbox_on_tablet'), disableonmobile: !!this.getelementsettings('disable_lightbox_on_mobile') }; }, runfilter: function runfilter() { var self = this, lbsettings = this.getlightboxsettings(); initfilternav(this.$element, function (filter) { self.elements.$container.isotope({ filter: filter }); if (filter !== '*') { lbsettings.selector = filter; } initpopupgallery(lbsettings); }); }, onelementchange: function onelementchange(changedprop) { if (['layout', 'image_height', 'columns', 'image_margin', 'enable_popup'].indexof(changedprop) !== -1) { this.run(); } }, run: function run() { var self = this; self.elements.$container.isotope(self.getdefaultsettings()).imagesloaded().progress(function () { self.elements.$container.isotope('layout'); }); initpopupgallery(self.getlightboxsettings()); } }); var justifiedgrid = modulehandler.extend({ oninit: function oninit() { modulehandler.prototype.oninit.apply(this, arguments); this.run(); this.runfilter(); $window.on('resize', debounce(this.run.bind(this), 100)); }, getdefaultsettings: function getdefaultsettings() { var $defaultsettings = { rowheight: +this.getelementsettings('row_height.size') || 150, lastrow: this.getelementsettings('last_row'), margins: +this.getelementsettings('margins.size'), captions: !!this.getelementsettings('show_caption') }; var $maxrowheight = {}; if ('yes' == this.getelementsettings('max_row_height')) { $maxrowheight = { maxrowheight: +this.getelementsettings('row_height.size') || 150 }; } return $.extend($defaultsettings, $maxrowheight); }, getdefaultelements: function getdefaultelements() { return { $container: this.findelement('.hajs-justified-grid') }; }, getlightboxsettings: function getlightboxsettings() { return { key: 'justifiedgallery', $element: this.$element, selector: '.ha-js-lightbox', isenabled: !!this.getelementsettings('enable_popup'), disableontablet: !!this.getelementsettings('disable_lightbox_on_tablet'), disableonmobile: !!this.getelementsettings('disable_lightbox_on_mobile') }; }, runfilter: function runfilter() { var self = this, lbsettings = this.getlightboxsettings(), settings = { lastrow: this.getelementsettings('last_row') }; initfilternav(self.$element, function (filter) { if (filter !== '*') { settings.lastrow = 'nojustify'; lbsettings.selector = filter; } settings.filter = filter; self.elements.$container.justifiedgallery(settings); initpopupgallery(lbsettings); }); }, onelementchange: function onelementchange(changedprop) { if (['row_height', 'max_row_height', 'last_row', 'margins', 'show_caption', 'enable_popup'].indexof(changedprop) !== -1) { this.run(); } }, run: function run() { this.elements.$container.justifiedgallery(this.getdefaultsettings()); initpopupgallery(this.getlightboxsettings()); } }); // newsticker var newsticker = modulehandler.extend({ oninit: function oninit() { modulehandler.prototype.oninit.apply(this, arguments); this.wrapper = this.$element.find('.ha-news-ticker-wrapper'); this.run(); }, onelementchange: function onelementchange(changed_prop) { if (changed_prop === 'item_space' || changed_prop === 'title_typography_font_size') { this.run(); } }, run: function run() { if (0 == this.wrapper.length) { return; } var wrapper_height = this.wrapper.innerheight(), wrapper_width = this.wrapper.innerwidth(), container = this.wrapper.find('.ha-news-ticker-container'), single_item = container.find('.ha-news-ticker-item'), scroll_direction = this.wrapper.data('scroll-direction'), scroll = "scroll" + scroll_direction + parseint(wrapper_height) + parseint(wrapper_width), duration = this.wrapper.data('duration'), direction = 'normal', all_title_width = 10; var start = { 'transform': 'translatex(0' + wrapper_width + 'px)' }, end = { 'transform': 'translatex(-101%)' }; if ('right' === scroll_direction) { direction = 'reverse'; } single_item.each(function () { all_title_width += $(this).outerwidth(true); }); container.css({ 'width': all_title_width, 'display': 'flex' }); $.keyframe.define([{ name: scroll, '0%': start, '100%': end }]); container.playkeyframe({ name: scroll, duration: duration.tostring() + "ms", timingfunction: 'linear', delay: '0s', iterationcount: 'infinite', direction: direction, fillmode: 'none', complete: function complete() {} }); } }); // fun factor var funfactor = function funfactor($scope) { elementorfrontend.waypoint($scope, function () { var $fun_factor = $scope.find('.ha-fun-factor__content-number'); $fun_factor.numerator($fun_factor.data('animation')); }); }; var barchart = function barchart($scope) { elementorfrontend.waypoint($scope, function () { var $chart = $(this), $container = $chart.find('.ha-bar-chart-container'), $chart_canvas = $chart.find('#ha-bar-chart'), settings = $container.data('settings'); if ($container.length) { new chart($chart_canvas, settings); } }); }; //twitter feed var twitterfeed = function twitterfeed($scope) { var button = $scope.find('.ha-twitter-load-more'); var twitter_wrap = $scope.find('.ha-tweet-items'); button.on("click", function (e) { e.preventdefault(); var $self = $(this), query_settings = $self.data("settings"), total = $self.data("total"), items = $scope.find('.ha-tweet-item').length; $.ajax({ url: happylocalize.ajax_url, type: 'post', data: { action: "ha_twitter_feed_action", security: happylocalize.nonce, query_settings: query_settings, loaded_item: items }, success: function success(response) { if (total > items) { $(response).appendto(twitter_wrap); } else { $self.text('all loaded').addclass('loaded'); settimeout(function () { $self.css({ "display": "none" }); }, 800); } }, error: function error(_error) {} }); }); }; //posttab var posttab = modulehandler.extend({ oninit: function oninit() { modulehandler.prototype.oninit.apply(this, arguments); this.wrapper = this.$element.find('.ha-post-tab'); this.run(); }, run: function run() { var filter_wrap = this.wrapper.find('.ha-post-tab-filter'), filter = filter_wrap.find('li'), event = this.wrapper.data('event'), args = this.wrapper.data('query-args'); filter.on(event, debounce(function (e) { e.preventdefault(); var $self = $(this), term_id = $self.data("term"), $wrapper = $self.closest(".ha-post-tab"), content = $wrapper.find('.ha-post-tab-content'), loading = content.find('.ha-post-tab-loading'), tab_item = content.find('.ha-post-tab-item-wrapper'), $content_exist = false; if (0 === loading.length) { filter.removeclass('active'); tab_item.removeclass('active'); $self.addclass('active'); tab_item.each(function () { var $self = $(this), $content_id = $self.data("term"); if (term_id === $content_id) { $self.addclass('active'); $content_exist = true; } }); if (false === $content_exist) { $.ajax({ url: happylocalize.ajax_url, type: 'post', data: { action: "ha_post_tab_action", security: happylocalize.nonce, post_tab_query: args, term_id: term_id }, beforesend: function beforesend() { content.append(''); }, success: function success(response) { content.find('.ha-post-tab-loading').remove(); content.append(response); }, error: function error(_error2) {} }); } } }, 200)); } }); var datatable = function datatable($scope) { var columnth = $scope.find('.ha-table__head-column-cell'); var rowtr = $scope.find('.ha-table__body-row'); rowtr.each(function (i, tr) { var th = $(tr).find('.ha-table__body-row-cell'); th.each(function (index, th) { $(th).prepend('
' + columnth.eq(index).html() + '
'); }); }); }; //threesixty rotation var threesixty_rotation = function threesixty_rotation($scope) { var ha_circlr = $scope.find('.ha-threesixty-rotation-inner'); var cls = ha_circlr.data('selector'); var autoplay = ha_circlr.data('autoplay'); var glass_on = $scope.find('.ha-threesixty-rotation-magnify'); var t360 = $scope.find('.ha-threesixty-rotation-360img'); var zoom = glass_on.data('zoom'); var playb = $scope.find('.ha-threesixty-rotation-play'); var crl = circlr(cls, { play: true }); if ('on' === autoplay) { var autoplay_btn = $scope.find('.ha-threesixty-rotation-autoplay'); autoplay_btn.on('click', function (el) { el.preventdefault(); crl.play(); t360.remove(); }); settimeout(function () { autoplay_btn.trigger('click'); autoplay_btn.remove(); }, 1000); } else { playb.on('click', function (el) { el.preventdefault(); var $self = $(this); var $i = $self.find('i'); if ($i.hasclass('hm-play-button')) { $i.removeclass('hm-play-button'); $i.addclass('hm-stop'); crl.play(); } else { $i.removeclass('hm-stop'); $i.addclass('hm-play-button'); crl.stop(); } t360.remove(); }); } glass_on.on('click', function (el) { var img_block = $scope.find('img'); img_block.each(function () { var style = $(this).attr('style'); if (-1 !== style.indexof("block")) { happysimplamagnify($(this)[0], zoom); glass_on.css('display', 'none'); t360.remove(); } }); }); $(document).on('click', function (e) { var t = $(e.target); var magnifier = $scope.find('.ha-img-magnifier-glass'); var i = glass_on.find('i'); if (magnifier.length && t[0] !== i[0]) { magnifier.remove(); glass_on.removeattr('style'); } if (t[0] === ha_circlr[0]) { t360.remove(); } }); ha_circlr.on('mouseup mousedown touchstart touchend', function (e) { t360.remove(); }); }; //event calendar var event_calendar = function event_calendar($scope) { var calendarel = $scope.find('.ha-ec'); var popup = $scope.find('.ha-ec-popup-wrapper'); var popupclose = $scope.find(".ha-ec-popup-close"); var events = calendarel.data('events'); var initialview = calendarel.data('initialview'); var firstday = calendarel.data('firstday'); var locale = calendarel.data('locale'); var showpopup = calendarel.data('show-popup'); var allday_text = calendarel.data('allday-text'); if ('undefined' == typeof events) { return; } var option = { stickyheaderdates: false, locale: locale, headertoolbar: { left: "prev,next today", center: "title", right: "daygridmonth,timegridweek,timegridday,listmonth" }, initialview: initialview, firstday: firstday, eventtimeformat: { // like '7pm' hour: 'numeric', minute: '2-digit', meridiem: 'short' }, events: events, height: 'auto', eventclick: function eventclick(info) { if ('yes' == showpopup) { // don't let the browser navigate var getthedate = function getthedate(timestring) { return new date(timestring); }; var timeformat = function timeformat(date) { var hours = date.gethours(); var minutes = date.getminutes(); var ampm = hours >= 12 ? 'pm' : 'am'; hours = hours % 12; hours = hours ? hours : 12; // the hour '0' should be '12' minutes = minutes < 10 ? '0' + minutes : minutes; var strtime = hours + ':' + minutes + '' + ampm; return strtime; }; info.jsevent.preventdefault(); var todaydatestring = info.view.calendar.currentdata.currentdate.tostring(), allday = info.event.allday, title = info.event.title, startdate = info.event.startstr, enddate = info.event.endstr, guest = info.event.extendedprops.guest, location = info.event.extendedprops.location, description = info.event.extendedprops.description, detailsurl = info.event.url, imageurl = info.event.extendedprops.image; var titlewrap = popup.find('.ha-ec-event-title'), timewrap = popup.find('.ha-ec-event-time-wrap'), guestwrap = popup.find('.ha-ec-event-guest-wrap'), locationwrap = popup.find('.ha-ec-event-location-wrap'), descwrap = popup.find('.ha-ec-popup-desc'), detailswrap = popup.find('.ha-ec-popup-readmore-link'), imagewrap = popup.find('.ha-ec-popup-image'); // display none imagewrap.css('display', 'none'); titlewrap.css('display', 'none'); timewrap.css('display', 'none'); guestwrap.css('display', 'none'); locationwrap.css('display', 'none'); descwrap.css('display', 'none'); detailswrap.css('display', 'none'); popup.addclass("ha-ec-popup-ready"); // image markup if (imageurl) { imagewrap.removeattr("style"); imagewrap.find('img').attr("src", imageurl); imagewrap.find('img').attr("alt", title); } // title markup if (title) { titlewrap.removeattr("style"); titlewrap.text(title); } // guest markup if (guest) { guestwrap.removeattr("style"); guestwrap.find('span.ha-ec-event-guest').text(guest); } // location markup if (location) { locationwrap.removeattr("style"); locationwrap.find('span.ha-ec-event-location').text(location); } // description markup if (description) { descwrap.removeattr("style"); descwrap.html(description); } // time markup if (allday !== true) { timewrap.removeattr("style"); startdate = date.parse(getthedate(startdate)); enddate = date.parse(getthedate(enddate)); var starttimetext = timeformat(getthedate(startdate)); var endtimetext = 'invalid data'; if (startdate < enddate) { endtimetext = timeformat(getthedate(enddate)); } timewrap.find('span.ha-ec-event-time').text(starttimetext + ' - ' + endtimetext); } else { timewrap.removeattr("style"); timewrap.find('span.ha-ec-event-time').text(allday_text); } // read more markup if (detailsurl) { detailswrap.removeattr("style"); detailswrap.attr("href", detailsurl); if ("on" === info.event.extendedprops.external) { detailswrap.attr("target", "_blank"); } if ("on" === info.event.extendedprops.nofollow) { detailswrap.attr("rel", "nofollow"); } } } else { if (info.event.url && info.event.extendedprops.external) { info.jsevent.preventdefault(); var id = $scope.data('id'), anchor = document.createelement('a'), anchorreal, timeout; anchor.id = 'happy-even-calender-link-' + id; anchor.href = info.event.url; anchor.target = info.event.extendedprops.external ? '_blank' : '_self'; anchor.rel = info.event.extendedprops.nofollow ? 'nofollow noreferer' : ''; anchor.style.display = 'none'; document.body.appendchild(anchor); anchorreal = document.getelementbyid(anchor.id); anchorreal.click(); timeout = settimeout(function () { document.body.removechild(anchorreal); cleartimeout(timeout); }); return false; } } }, dateclick: function dateclick(arg) { itemdate = arg.date.toutcstring(); } }; var calendar = new fullcalendar.calendar(calendarel[0], option); calendar.render(); $scope.find(".ha-ec-popup-wrapper").on("click", function (e) { e.stoppropagation(); if (e.target === e.currenttarget || e.target == popupclose[0] || e.target == popupclose.find(".eicon-editor-close")[0]) { popup.addclass("ha-ec-popup-removing").removeclass("ha-ec-popup-ready"); } }); }; var mailchimp = function mailchimp($scope) { var elform = $scope.find('.ha-mailchimp-form'), elmessage = $scope.find('.ha-mc-response-message'), successmessage = elform.data('success-message'); elform.on('submit', function (e) { e.preventdefault(); var data = { action: 'ha_mailchimp_ajax', security: happylocalize.nonce, subscriber_info: elform.serialize(), list_id: elform.data('list-id'), post_id: elform.parent().data('post-id'), widget_id: elform.parent().data('widget-id') }; $.ajax({ type: 'post', url: happylocalize.ajax_url, data: data, success: function success(response) { elform.trigger('reset'); if (response.status) { elmessage.removeclass('error'); elmessage.addclass('success'); elmessage.text(successmessage); } else { elmessage.addclass('error'); elmessage.removeclass('success'); elmessage.text(response.msg); } var hidemsg = settimeout(function () { elmessage.removeclass('error'); elmessage.removeclass('success'); cleartimeout(hidemsg); }, 5000); }, error: function error(_error3) { // console.log(error); } }); }); }; //image accordion var image_accordion = function image_accordion($scope) { if ($scope.hasclass('ha-image-accordion-click')) { var items = $scope.find('.ha-ia-item'); items.each(function (inx, btn) { $(this).on('click', function (e) { // e.preventdefault(); if ($(this).hasclass('active')) { return; } else { items.removeclass('active'); $(this).addclass('active'); } }); }); } }; //content switcher var content_switcher = function content_switcher($scope) { var parent = $scope.find('.ha-content-switcher-wrapper'), designtype = parent.data('design-type'); if (designtype == 'button') { var buttons = parent.find('.ha-cs-button'), contents = parent.find('.ha-cs-content-section'); buttons.each(function (inx, btn) { $(this).on('click', function (e) { e.preventdefault(); if ($(this).hasclass('active')) { return; } else { buttons.removeclass('active'); $(this).addclass('active'); contents.removeclass('active'); var contentid = $(this).data('content-id'); parent.find('#' + contentid).addclass('active'); } }); }); } else { var toggleswitch = parent.find('.ha-cs-switch.ha-input-label'), input = parent.find('input.ha-cs-toggle-switch'), primaryswitcher = parent.find('.ha-cs-switch.primary'), secondaryswitcher = parent.find('.ha-cs-switch.secondary'), primarycontent = parent.find('.ha-cs-content-section.primary'), secondarycontent = parent.find('.ha-cs-content-section.secondary'); toggleswitch.on('click', function (e) { if (input.is(':checked')) { primaryswitcher.removeclass('active'); primarycontent.removeclass('active'); secondaryswitcher.addclass('active'); secondarycontent.addclass('active'); } else { secondaryswitcher.removeclass('active'); secondarycontent.removeclass('active'); primaryswitcher.addclass('active'); primarycontent.addclass('active'); } }); } }; //team member var team_member = function team_member($scope) { var btn = $scope.find('.ha-btn'); var lightbox = $scope.find('.ha-member-lightbox'); if (lightbox.length > 0) { var close = lightbox.find('.ha-member-lightbox-close'); btn.on('click', function () { lightbox.addclass('ha-member-lightbox-show'); }); lightbox.on('click', function (e) { if (lightbox.hasclass('ha-member-lightbox-show')) { if (e.target == lightbox[0]) { lightbox.removeclass('ha-member-lightbox-show'); } else if (e.target == close[0]) { lightbox.removeclass('ha-member-lightbox-show'); } else if (e.target == close.find('i.eicon-editor-close')[0]) { lightbox.removeclass('ha-member-lightbox-show'); } } }); } }; //creative button var creative_button = function creative_button($scope) { var btn_wrap = $scope.find('.ha-creative-btn-wrap'); var magnetic = btn_wrap.data('magnetic'); var btn = btn_wrap.find('a.ha-creative-btn'); if ('yes' == magnetic) { btn_wrap.on('mousemove', function (e) { var x = e.pagex - (btn_wrap.offset().left + btn_wrap.outerwidth() / 2); var y = e.pagey - (btn_wrap.offset().top + btn_wrap.outerheight() / 2); btn.css("transform", "translate(" + x * 0.3 + "px, " + y * 0.5 + "px)"); }); btn_wrap.on('mouseout', function (e) { btn.css("transform", "translate(0px, 0px)"); }); } //for expandable button style only var expandable = $scope.find('.ha-eft--expandable'); var text = expandable.find('.text'); if (expandable.length > 0 && text.length > 0) { text[0].addeventlistener("transitionend", function () { if (text[0].style.width) { text[0].style.width = "auto"; } }); expandable[0].addeventlistener("mouseenter", function (e) { e.currenttarget.classlist.add('hover'); text[0].style.width = "auto"; var predicted_answer = text[0].offsetwidth; text[0].style.width = "0"; window.getcomputedstyle(text[0]).transform; text[0].style.width = "".concat(predicted_answer, "px"); }); expandable[0].addeventlistener("mouseleave", function (e) { e.currenttarget.classlist.remove('hover'); text[0].style.width = "".concat(text[0].offsetwidth, "px"); window.getcomputedstyle(text[0]).transform; text[0].style.width = ""; }); } }; var pdf_view = function pdf_view($scope) { var $id = $scope.data('id'); var $settings = $scope.find(".viewer-" + $id).data('pdf-settings'); var options = { width: $settings.width, height: $settings.height, page: $settings.page_number }; pdfobject.embed($settings.pdf_url, "#" + $settings.unique_id, options); }; var comparison_table = function comparison_table($scope) { var $table = $scope.find('.ha-comparison-table-wrapper'); var $table_head = $scope.find('.ha-comparison-table__head'); var $sticky_header = $table_head.data('sticky-header'); var $section_height = $scope.height(); var $table_height = $table.innerheight(); var $tableoffsettop = $table.offset().top; if ($sticky_header === 'yes') { $window.scroll(function () { var offset = $(this).scrolltop(); if (offset >= $tableoffsettop) { $table_head.addclass('table-sticky'); } else if (offset > $table_height) { $table_head.removeclass('table-sticky'); } }); } }; // slider elementorfrontend.hooks.addaction('frontend/element_ready/ha-slider.default', function ($scope) { elementorfrontend.elementshandler.addhandler(sliderbase, { $element: $scope }); }); // carousel elementorfrontend.hooks.addaction('frontend/element_ready/ha-carousel.default', function ($scope) { elementorfrontend.elementshandler.addhandler(sliderbase, { $element: $scope }); }); //horizontal timeline elementorfrontend.hooks.addaction('frontend/element_ready/ha-horizontal-timeline.default', function ($scope) { elementorfrontend.elementshandler.addhandler(sliderbase, { $element: $scope, autoplay: false, container: '.ha-horizontal-timeline-wrapper', navigation: 'arrow', arrows: true }); var img_wrap = $scope.find(".ha-horizontal-timeline-image"); var magnific_popup = img_wrap.data("mfp-src"); if (undefined !== magnific_popup) { img_wrap.magnificpopup({ type: "image", gallery: { enabled: true } }); } }); // elementorfrontend.hooks.addaction( // 'frontend/element_ready/ha-mailchimp.default', // function ($scope) { // elementorfrontend.elementshandler.addhandler(mailchimp, { // $element: $scope, // }); // } // ); $('body').on('click.onwrapperlink', '[data-ha-element-link]', function () { var $wrapper = $(this), data = $wrapper.data('ha-element-link'), id = $wrapper.data('id'), anchor = document.createelement('a'), anchorreal, timeout; anchor.id = 'happy-addons-wrapper-link-' + id; anchor.href = data.url; anchor.target = data.is_external ? '_blank' : '_self'; anchor.rel = data.nofollow ? 'nofollow noreferer' : ''; anchor.style.display = 'none'; document.body.appendchild(anchor); anchorreal = document.getelementbyid(anchor.id); anchorreal.click(); timeout = settimeout(function () { document.body.removechild(anchorreal); cleartimeout(timeout); }); }); // background overlay extension var backgroundoverlay = function backgroundoverlay($scope) { $scope.hasclass('elementor-element-edit-mode') && $scope.addclass('ha-has-bg-overlay'); }; var fnhanlders = { 'ha-image-compare.default': handleimagecompare, 'ha-number.default': numberhandler, 'ha-skills.default': skillhandler, 'ha-fun-factor.default': funfactor, 'ha-bar-chart.default': barchart, 'ha-twitter-feed.default': twitterfeed, 'ha-threesixty-rotation.default': threesixty_rotation, 'ha-data-table.default': datatable, // 'widget' : backgroundoverlay, 'section': backgroundoverlay, 'column': backgroundoverlay, 'ha-event-calendar.default': event_calendar, 'ha-mailchimp.default': mailchimp, 'ha-image-accordion.default': image_accordion, 'ha-content-switcher.default': content_switcher, 'ha-member.default': team_member, 'ha-creative-button.default': creative_button, 'ha-pdf-view.default': pdf_view, 'ha-comparison-table.default': comparison_table }; $.each(fnhanlders, function (widgetname, handlerfn) { elementorfrontend.hooks.addaction('frontend/element_ready/' + widgetname, handlerfn); }); var classhandlers = { 'ha-image-grid.default': imagegrid, 'ha-justified-gallery.default': justifiedgrid, 'ha-news-ticker.default': newsticker, 'ha-post-tab.default': posttab }; $.each(classhandlers, function (widgetname, handlerclass) { elementorfrontend.hooks.addaction('frontend/element_ready/' + widgetname, function ($scope) { elementorfrontend.elementshandler.addhandler(handlerclass, { $element: $scope }); }); }); //nav menu var navigationmenu = function __init($scope) { var navmenu = $scope.find('.ha-nav-menu'); var humburgerbtn = navmenu.find('.ha-menu-toggler'); humburgerbtn.on('click', function (e) { var humberger = $(this).data('humberger'); var $pel = navmenu.find('ul.menu'); if ('open' == humberger) { $('.ha-menu-open-icon').addclass('hide-icon'); $('.ha-menu-close-icon').removeclass('hide-icon'); $('.ha-menu-close-icon').addclass('show-icon'); $pel.slidedown(); } else { $('.ha-menu-close-icon').addclass('hide-icon'); $('.ha-menu-open-icon').removeclass('hide-icon'); $('.ha-menu-open-icon').addclass('show-icon'); $pel.slideup(); } }); function burgerclsadd() { if (jquery(window).width() < 768) { navmenu.removeclass('ha-navigation-menu-wrapper'); navmenu.addclass('ha-navigation-burger-menu'); var humburgersubmenubtn = navmenu.find('.ha-submenu-indicator-wrap'); humburgersubmenubtn.on('click', function (e) { e.preventdefault(); var $parentel = $(this).parent('li.menu-item-has-children'); if ($parentel) { $parentel.children('ul.sub-menu').slidetoggle(); } }); } else { navmenu.addclass('ha-navigation-menu-wrapper'); navmenu.removeclass('ha-navigation-burger-menu'); navmenu.find('ul.menu').removeattr('style'); navmenu.find('ul.sub-menu').removeattr('style'); } } burgerclsadd(); $window.on('resize', debounce(burgerclsadd, 100)); }; elementorfrontend.hooks.addaction("frontend/element_ready/ha-navigation-menu.default", navigationmenu); }); })(jquery);