PageSourceSearch

https://www.keeskee.com/wp-content/themes/monstroid2/assets/js/theme-script.js?ver=1.3.2

js keeskee.com collected 2026-10-02 00:52:09 UTC 41,157 bytes, 1,096 lines download raw bytes

1/* UItoTop jQuery Plugin | Matt Varone | http://www.mattvarone.com/web-design/uitotop-jquery-plugin */
2!function(n){n.fn.UItoTop=function(o){var e={text:"To Top",min:200,inDelay:600,outDelay:400,containerID:"toTop",containerHoverID:"toTopHover",scrollSpeed:1200,easingType:"linear"},t=n.extend(e,o),i="#"+t.containerID,a="#"+t.containerHoverID;n("body").append('<a href="#" id="'+t.containerID+'"><span>'+t.text+"</span></a>"),n(i).hide().on("click.UItoTop",function(){return n("html, body").animate({scrollTop:0},t.scrollSpeed,t.easingType),n("#"+t.containerHoverID,this).stop().animate({opacity:0},t.inDelay,t.easingType),!1}).hover(function(){n(a,this).stop().animate({opacity:1},600,"linear")},function(){n(a,this).stop().animate({opacity:0},700,"linear")}),n(window).scroll(function(){var o=n(window).scrollTop();"undefined"==typeof document.body.style.maxHeight&&n(i).css({position:"absolute",top:o+n(window).height()-50}),o>t.min?n(i).fadeIn(t.inDelay):n(i).fadeOut(t.Outdelay)})}}(jQuery);
3/* jquery.stickup.min.js */
4!function(t){t.fn.stickUp=function(e){function o(){a=parseInt(n.offset().top),d=parseInt(n.css("margin-top")),u=parseInt(n.outerHeight(!0)),c.pseudo&&(t('<div class="pseudoStickyBlock"></div>').insertAfter(n),i=t(".pseudoStickyBlock"),i.css({position:"relative",display:"block"})),c.active&&s(),n.addClass("stuckMenu")}function s(){p.on("scroll.stickUp",function(){r=t(this).scrollTop(),S=r>k?"down":"up",k=r,0!=h.length?correctionValue=h.outerHeight(!0):correctionValue=0,f=parseInt(l.scrollTop()),a+u-correctionValue<f?(n.addClass("isStuck"),v.addClass("isStuck"),c.pseudo?(n.css({position:"fixed",top:correctionValue}),i.css({height:u})):n.css({position:"fixed",top:correctionValue})):(n.removeClass("isStuck"),v.removeClass("isStuck"),c.pseudo?(n.css({position:"relative",top:0}),i.css({height:0})):n.css({position:"absolute",top:0}))}).trigger("scroll.stickUp"),p.on("resize",function(){n.hasClass("isStuck")?a!=parseInt(i.offset().top)&&(a=parseInt(i.offset().top)):a!=parseInt(n.offset().top)&&(a=parseInt(n.offset().top))})}var c={correctionSelector:".correctionSelector",listenSelector:".listenSelector",active:!1,pseudo:!0};t.extend(c,e);var i,r,n=t(this),l=t(window),p=t(document),a=0,u=0,d=0,f=0,k=0,S="",h=t(c.correctionSelector),v=t(c.listenSelector);0!=n.length&&o()}}(jQuery);
5/* super-guacamole.min.js */
6!function(e,t){function n(t){var n,i,r=this;n={id:"",href:"",title:"&middot;&middot;&middot;",children:{},templates:{},container:null},i=e.extend(n,t),r.id=i.id,r.href=i.href,r.title=i.title,r.children=i.children,r.templates=i.templates,r.$container=i.container,r.node=null,r.attachedNode=null,r.options={},r.visible=!0}var i={menu:'<li class="%1$s"><a href="%2$s">%3$s</a>%4$s</li>',child_wrap:"<ul>%s</ul>",child:'<li class="%1$s" id="%5$s"><a href="%2$s">%3$s</a><ul class="sub-menu">%4$s</ul></li>'};n.prototype.set=function(e){if(!1==e instanceof n)throw new Error("Invalid argument type");return this.children[e.id]=e,this},n.prototype.push=function(e){return this.set(e)},n.prototype.get=function(e){var t=null;return this.map(e,function(e,n){return t=n,n}),t},n.prototype.map=function(e,t,n){var i={id:e},r=this;return"string"!=typeof e&&(i=e),n=n||this.children,0>=n.length?i:(Object.keys(n).forEach(function(e){child=n[e],i.id===child.id?n[i.id]=t(child):child.children&&0<Object.keys(child.children).length&&(i=r.map(i,t,child.children))}),i)},n.prototype.has=function(e){return t!==this.children[e]},n.prototype.isVisible=function(){return this.visible},n.prototype.forEach=function(e){return this.children.forEach(e)},n.prototype.countVisibleAttachedNodes=function(){var t=this,n=-1;return Object.keys(t.children).forEach(function(i){e(t.children[i].getAttachedNode()).attr("hidden")||n++}),n},n.prototype.countVisibleNodes=function(){var t,n=this,i=0;return Object.keys(n.children).forEach(function(r){t=n.children[r],e(t.getNode()).attr("hidden")||i++}),i},n.prototype.countVisible=function(){var e=this,t=0;return Object.keys(e.children).forEach(function(n){e.children[n].isVisible()&&t++}),t},n.prototype.getNode=function(){return this.node},n.prototype.getAttachedNode=function(){return this.attachedNode}
6,n.prototype.setNode=function(e){this.node=e},n.prototype.attachNode=function(e){this.attachedNode=e},n.prototype.setOptions=function(e){return this.options=e,this},n.prototype.getOptions=function(){return this.options},n.prototype.render=function(){function t(e,n,i){var r=e.replace(new RegExp("\\%"+n+"\\$s","g"),i);return pipes={replace:function(e,n){return t(r,e,n),pipes},get:function(){return r}},pipes}function n(e,i,r){var o="",a=Object.keys(i.children);return r=r||!1,a.forEach(function(e){o+=n("super-guacamole__menu__child",i.children[e])}),t(r?d:c,1,e+" menu-item"+(0<a.length?" menu-item-has-children":"")).replace(2,i.href).replace(3,i.title).replace(4,0<a.length?o:"").replace(5,i.id).get().replace('<ul class="sub-menu"></ul>',"")}function i(e){var t="";return Object.keys(e).forEach(function(i){t+=n("super-guacamole__menu",e[i])}),t}var r,o=this,c=o.templates.menu,d=o.templates.child,a=o.$container;o.options.$menu;return 0<a.length&&(a.append(i([o])),a.find(".super-guacamole__menu__child").each(function(){$current_el=e(this),id=e(this).attr("id"),r=a.find("#"+id.replace("sg-","")),0===r.length&&(r=a.find("."+id.replace("sg-",""))),0<r.length&&o.map(id,function(e){return e.attachNode(r),e.setNode($current_el),e})})),this},n.extract=function(t){function i(e){var t="",n=null,i=/menu\-item\-[0-9]+/i;return e.attr("class").split(" ").forEach(function(e){n=i.exec(e),null!==n&&(t=n[0])}),t}var r,o,c,d,a={};return t.each(function(t,u){var h={};r=e(u),o=r.find("a:first"),menuId=r.attr("id"),"undefined"==typeof menuId&&(menuId=i(r)),h={id:"sg-"+menuId,href:o.attr("href")},o.length>0&&o.get(0).childNodes.length>0&&(h.title=o.get(0).childNodes[0].data),c=new n(h),c.attachNode(r),-1<r.children(".sub-menu").length&&(subMenu=n.extract(r.children(".sub-menu").children(".menu-item")),Object.keys(subMenu).forEach(function(e){d=subMenu[e],c.set(d)})),a[c.id]=c}),a},n.prototype.attachedNodesFit=function(){var t,n,i=this,r=0,o=0,c=e(e(".header-container > .container").length>0?".header-container > .container":".header-container > div"),d=i.$container.outerWidth(!0)-i.$container.find(".super-guacamole__menu").outerWidth(!0)-(parseInt(c.css("padding-left"),10)+parseInt(c.css("padding-right"),10))/2;return Object.keys(i.children).forEach(function(r){n=i.children[r],$attachedNode=e(n.getAttachedNode()),t=e(n.getNode()),$attachedNode.removeAttr("hidden"),t.attr("hidden",!0)}),Object.keys(i.children).forEach(function(c){n=n=i.children[c],$attachedNode=e(n.getAttachedNode()),t=e(n.getNode()),o=$attachedNode.outerWidth(!0),o>0&&$attachedNode.data("width",o),r+=$attachedNode.data("width"),r>d&&($attachedNode.attr("hidden",!0),t.removeAttr("hidden"))}),!0},n.prototype.menuFit=function(t){var n,i=this,r={removeAttr:function(e,t){return e.removeAttr(t)},attr:function(e,t){return e.attr(t,!0)}},o="removeAttr",c=i.options.threshold||768;return t=t||!1,0===i.countVisibleNodes()&&(o="attr"),e(window).width()<=c-1&&(o="attr",Object.keys(i.children).forEach(function(t){n=i.children[t],$attachedNode=e(n.getAttachedNode()),$node=e(n.getNode()),$attachedNode.removeAttr("hidden"),$node.attr("hidden",!0)})),t||r[o](i.$container.find(".super-guacamole__menu"),"hidden"),"removeAttr"===o},n.prototype.watch=function(t){function n(){r.attachedNodesFit(),r.menuFit()}function i(e){var t;return function(i){function r(){n(),timeout=null}t&&clearTimeout(t),t=setTimeout(r,e)}}var r=this;return(t=t||!1)?(n(),r):(e(window).on("resize",i(10)),e(window).on("orientationchange",i(10)),r)},e.fn.superGuacamole=function(t){var r,o,c,d,a=e(this),u=a.find("#main-menu");r={threshold:544,minChildren:3,childrenFilter:"li",menuTitle:"&middot;&middot;&middot;",menuUrl:"#",templates:i},o=e.extend(r,t),c=u.children(o.childrenFilter+":not(.super-guacamole__menu):not(.super-guacamole__menu__child)"),d=new n({title:o.menuTitle,href:o.menuUrl,templates:o.templates,children:n.extract(c),container:u}),o.$menu=u,d.setOptions(o).render().watch(!0).watch()}}(jQuery);
7
8(function( $ ) {
9	"use strict";
10
11	CherryJsCore.utilites.namespace( 'theme_script' );
12	CherryJsCore.theme_script = {
13		init: function() {
14			// Document ready event check
15			if ( CherryJsCore.status.is_ready ) {
16				this.document_ready_render();
17			} else {
18				CherryJsCore.variable.$document.on( 'ready', this.document_ready_render.bind( this ) );
19			}
20
21			// Windows load event check
22			if ( CherryJsCore.status.on_load ) {
23				this.window_load_render();
24			} else {
25				CherryJsCore.variable.$window.on( 'load', this.window_load_render.bind( this ) );
26			}
27		},
28
29		document_ready_render: function() {
30			this.smart_slider_init( this );
31			this.swiper_carousel_init( this );
32			this.post_formats_custom_init( this );
33			this.subscribe_init( this );
34			this.main_menu( this, $( '.main-navigation' ) );
35			this.mega_menu( this );
36			this.to_top_init( this );
37			this.playlist_slider_widget_init( this );
38			this.news_smart_box_init( this );
39			this.header_search( this );
40			this.mobile_menu( this );
41			this.vertical_menu_init( this );
42			this.add_project_inline_style( this );
43			this.anchor_navigation( this );
44			this.anchor_scrolling_navigation( this );
45			this.ofi_init( this );
46		},
47
48		window_load_render: function() {
49			this.page_preloader_init( this );
50			this.navbar_init( this );
51		},
52
53		anchor_navigation: function ( self ) {
54			$( '.page-template-landing div:not(.woocommerce-tabs) a[href*=#]:not([href=#])' ).on( 'click', function( event ) {
55
56				var $window = CherryJsCore.variable.$window,
57					width = $window.outerWidth( true ),
58					$menuItem = $( '.menu-item' ),
59					$menuToggle = $( '.main-menu-toggle[aria-controls="main-menu"]' );
60
61				if ( 768 > width && $( event.target ).closest( $menuItem ).length ) {
62					$menuToggle.trigger( 'click.mobileMenuToggle' );
63				}
64
65				if ( location.pathname.replace( /^\//, '' ) === this.pathname.replace( /^\//, '' ) || location.hostname === this.hostname ) {
66					var target     = $( this.hash ),
67						targetLink = this.hash,
68						$correctionSelector = ( 768 <= width ) ? $( '#main-menu' ) : $( '.mobile-panel' ),
69						menuHeight = $correctionSelector.outerHeight(true);
70
71					target = target.length ? target : $( '[name=' + this.hash.slice( 1 ) + ']' );
72
73					if ( target.length ) {
74						$( 'html, body' ).animate( {
75							scrollTop: target.offset().top - menuHeight
76						}, 1000 );
77
78						return false;
79					}
80				}
81			});
82		},
83
84		anchor_scrolling_navigation: function ( self ) {
85
86			var $document   = $( document ),
87				top         = null,
88				changed     = false,
89				currentHash = null,
90				sections    = null,
91				timeout     = null,
92				interval    = null,
93				menuHeight  = $( '#main-menu' ).outerHeight(true),
94				$sections   = $( '.tm_pb_anchor' );
95
96			sections = getSections();
97
98
99			$( window ).on( 'scroll.cherry_anchor_navigation', function () {
100				var newTop  = $document.scrollTop();
101
102				changed = newTop != top;
103
104				if ( changed ) {
105					top = newTop;
106				}
107			});
108
109			$( window ).on( 'resize.cherry_anchor_navigation', function () {
110				sections = getSections();
111			});
112
113			function getSections() {
114				sections = $.map( $sections, function ( event ) {
115					var $event = $( event ),
116						position = $event.position();
117
118					return {
119						top: position.top - menuHeight,
120						bottom: position.top + $event.outerHeight( true ) - menuHeight,
121						hash: $event.attr( 'id' )
122					};
123				});
124
125				return sections;
126
127			}
128
129			function iteration() {
130
131				var sectionsLength = sections.length,
132					section,
133					scrollTop;
134
135				while ( section = sections[--sectionsLength] ) {
136
137					if ( section.top >= top || section.bottom <= top ) {
138						continue;
139					}
140
141					if ( currentHash == section.hash ) {
142						break;
143					}
144
145					currentHash = section.hash;
146					history.pushState( null, null, '#' + section.hash );
147				}
148			}
149
150			timeout = setTimeout( function (){
151				interval = setInterval( iteration, 250 );
152			}, 250 );
153		},
154
155		smart_slider_init: function( self ) {
156			$( '.monstroid2-smartslider' ).each( function() {
157				var slider = $( this ),
158					sliderId = slider.data( 'id' ),
159					sliderWidth = slider.data( 'width' ),
160					sliderHeight = slider.data( 'height' ),
161					sliderOrientation = slider.data( 'orientation' ),
162					slideDistance = slider.data( 'slide-distance' ),
163					slideDuration = slider.data( 'slide-duration' ),
164					sliderFade = slider.data( 'slide-fade' ),
165					sliderNavigation = slider.data( 'navigation' ),
166					sliderFadeNavigation = slider.data( 'fade-navigation' ),
167					sliderPagination = slider.data( 'pagination' ),
168					sliderAutoplay = slider.data( 'autoplay' ),
169					sliderFullScreen = slider.data( 'fullscreen' ),
170					sliderShuffle = slider.data( 'shuffle' ),
171					sliderLoop = slider.data( 'loop' ),
172					sliderThumbnailsArrows = slider.data( 'thumbnails-arrows' ),
173					sliderThumbnailsPosition = slider.data( 'thumbnails-position' ),
174					sliderThumbnailsWidth = slider.data( 'thumbnails-width' ),
175					sliderThumbnailsHeight = slider.data( 'thumbnails-height' );
176
177				if ( $( '.smart-slider__items', '#' + sliderId ).length > 0 ) {
178					$( '#' + sliderId ).sliderPro( {
179						width: sliderWidth,
180						height: sliderHeight,
181						orientation: sliderOrientation,
182						slideDistance: slideDistance,
183						slideAnimationDuration: slideDuration,
184						fade: sliderFade,
185						arrows: sliderNavigation,
186						fadeArrows: sliderFadeNavigation,
187						buttons: sliderPagination,
188						autoplay: sliderAutoplay,
189						fullScreen: sliderFullScreen,
190						shuffle: sliderShuffle,
191						loop: sliderLoop,
192						waitForLayers: false,
193						thumbnailArrows: sliderThumbnailsArrows,
194						thumbnailsPosition: sliderThumbnailsPosition,
195						thumbnailWidth: sliderThumbnailsWidth,
196						thumbnailHeight: sliderThumbnailsHeight,
197						init: function() {
198							$( this ).resize();
199						},
200						sliderResize: function( event ) {
201							var thisSlider = $( '#' + sliderId ),
202								slides = $( '.sp-slide', thisSlider );
203
204							slides.each( function() {
205
206								if ( $( '.sp-title a', this ).width() > $( this ).width() ) {
207									$( this ).addClass( 'text-wrapped' );
208								} else {
209									$( this ).removeClass( 'text-wrapped' );
210								}
211
212							} );
213						},
214						breakpoints: {
215							991: {
216								height: parseFloat( sliderHeight ) * 0.75
217							},
218							767: {
219								height: parseFloat( sliderHeight ) * 0.5,
220								thumbnailsPosition: ( 'top' === this.thumbnailsPosition ) ? 'top' : 'bottom',
221								thumbnailHeight: parseFloat( sliderThumbnailsHeight ) * 0.75,
222								thumbnailWidth: parseFloat( sliderThumbnailsWidth ) * 0.75
223							}
224						}
225					} );
226				}
227			} );//each end
228		},
229
230		swiper_carousel_init: function( self ) {
231
232			// Enable swiper carousels
233			jQuery( '.monstroid2-carousel' ).each( function() {
234				var swiper = null,
235					uniqId = jQuery( this ).data( 'uniq-id' ),
236					slidesPerView = parseFloat( jQuery( this ).data( 'slides-per-view' ) ),
237					slidesPerGroup = parseFloat( jQuery( this ).data( 'slides-per-group' ) ),
238					slidesPerColumn = parseFloat( jQuery( this ).data( 'slides-per-column' ) ),
239					spaceBetweenSlides = parseFloat( jQuery( this ).data( 'space-between-slides' ) ),
240					durationSpeed = parseFloat( jQuery( this ).data( 'duration-speed' ) ),
241					swiperLoop = jQuery( this ).data( 'swiper-loop' ),
242					freeMode = jQuery( this ).data( 'free-mode' ),
243					grabCursor = jQuery( this ).data( 'grab-cursor' ),
244					mouseWheel = jQuery( this ).data( 'mouse-wheel' ),
245					breakpointsSettings = {
246						1199: {
247							slidesPerView: Math.floor( slidesPerView * 0.75 ),
248							spaceBetween: Math.floor( spaceBetweenSlides * 0.75 )
249						},
250						991: {
251							slidesPerView: Math.floor( slidesPerView * 0.5 ),
252							spaceBetween: Math.floor( spaceBetweenSlides * 0.5 )
253						},
254						767: {
255							slidesPerView: ( 0 !== Math.floor( slidesPerView * 0.25 ) ) ? Math.floor( slidesPerView * 0.25 ) : 1
256						}
257					};
258
259				if ( 1 == slidesPerView ) {
260					breakpointsSettings = {}
261				}
262
263				var swiper = new Swiper( '#' + uniqId, {
264						slidesPerView: slidesPerView,
265						slidesPerGroup: slidesPerGroup,
266						slidesPerColumn: slidesPerColumn,
267						spaceBetween: spaceBetweenSlides,
268						speed: durationSpeed,
269						loop: swiperLoop,
270						freeMode: freeMode,
271						grabCursor: grabCursor,
272						mousewheelControl: mouseWheel,
273						paginationClickable: true,
274						nextButton: '#' + uniqId + '-next',
275						prevButton: '#' + uniqId + '-prev',
276						pagination: '#' + uniqId + '-pagination',
277						onInit: function() {
278							$( '#' + uniqId + '-next' ).css( { 'display': 'block' } );
279							$( '#' + uniqId + '-prev' ).css( { 'display': 'block' } );
280						},
281						breakpoints: breakpointsSettings
282					}
283				);
284			} );
285		},
286
287		post_formats_custom_init: function( self ) {
288			CherryJsCore.variable.$document.on( 'cherry-post-formats-custom-init', function( event ) {
289
290				if ( 'slider' !== event.object ) {
291					return;
292				}
293
294				var uniqId = '#' + event.item.attr( 'id' ),
295					settings = event.item.data( 'init' ),
296					swiper = new Swiper( uniqId, {
297						pagination: uniqId + ' .swiper-pagination',
298						paginationClickable: true,
299						nextButton: uniqId + ' .swiper-button-next',
300						prevButton: uniqId + ' .swiper-button-prev',
301						spaceBetween: 0,
302						onInit: function() {
303							if ( settings['arrows'] ) {
304								$( uniqId + ' .swiper-button-next' ).css( { 'display': 'block' } );
305								$( uniqId + ' .swiper-button-prev' ).css( { 'display': 'block' } );
306							}
307							if ( settings['buttons'] ) {
308								$( uniqId + ' .swiper-pagination' ).css( { 'display': 'block' } );
309							}
310						}
311					} );
312
313				event.item.data( 'initalized', true );
314			} );
315
316			var items = [];
317
318			$( '.mini-gallery .post-thumbnail__link' ).on( 'click', function( event ) {
319				event.preventDefault();
320
321				$( this ).parents( '.mini-gallery' ).find( '.post-gallery__slides > a[href]' ).each( function() {
322					items.push( {
323						src: $( this ).attr( 'href' ),
324						type: 'image'
325					} );
326				} );
327
328				$.magnificPopup.open( {
329					items: items,
330					gallery: {
331						enabled: true
332					}
333				} );
334			} );
335		},
336
337		navbar_init: function ( self ) {
338			var $sticky_target = $( '.header-container' ),
339				$layout = window.monstroid2.labels.header_layout;
340
341			if ( undefined !== window.monstroid2.sticky_settings.sticky_target && 'menu_only' === window.monstroid2.sticky_settings.sticky_target ) {
342				$sticky_target = ( 'style-3' === $layout || 'style-7' === $layout  ) ? $( '.vertical-menu-toggle' ) : $( '#main-menu' );
343			}
344
345			if ( ! $.isFunction( jQuery.fn.stickUp ) || undefined === window.monstroid2.stickUp || ! $sticky_target.length ) {
346				return !1;
347			}
348
349			$sticky_target.stickUp( {
350				correctionSelector: '#wpadminbar',
351				pseudo: true,
352				active: true
353			} );
354
355			CherryJsCore.variable.$document.trigger( 'scroll.stickUp' );
356		},
357
358		subscribe_init: function( self ) {
359			CherryJsCore.variable.$document.on( 'click', '.subscribe-block__submit', function( event ) {
360
361				event.preventDefault();
362
363				var $this = $( this ),
364					form = $this.parents( 'form' ),
365					nonce = form.find( 'input[name="nonce"]' ).val(),
366					mail_input = form.find( 'input[name="subscribe-mail"]' ),
367					mail = mail_input.val(),
368					error = form.find( '.subscribe-block__error' ),
369					success = form.find( '.subscribe-block__success' ),
370					hidden = 'hidden';
371
372				if ( '' === mail ) {
373					mail_input.addClass( 'error' );
374					return !1;
375				}
376
377				if ( $this.hasClass( 'processing' ) ) {
378					return !1;
379				}
380
381				$this.addClass( 'processing' );
382				error.empty();
383				mail_input.removeClass( 'error' );
384
385				if ( !error.hasClass( hidden ) ) {
386					error.addClass( hidden );
387				}
388
389				if ( !success.hasClass( hidden ) ) {
390					success.addClass( hidden );
391				}
392
393				$.ajax( {
394					url: monstroid2.ajaxurl,
395					type: 'post',
396					dataType: 'json',
397					data: {
398						action: 'monstroid2_subscribe',
399						mail: mail,
400						nonce: nonce
401					},
402					error: function() {
403						$this.removeClass( 'processing' );
404					}
405				} ).done( function( response ) {
406
407					$this.removeClass( 'processing' );
408
409					if ( true === response.success ) {
410						success.removeClass( hidden );
411						mail_input.val( '' );
412						return 1;
413					}
414
415					error.removeClass( hidden ).html( response.data.message );
416					mail_input.addClass( 'error' );
417					return !1;
418
419				} );
420
421			} );
422		},
423
424
425		isMegaMenuEnabled: function() {
426
427			if ( undefined === window.monstroid2.megaMenu ) {
428				return false;
429			}
430
431			if ( true === window.monstroid2.megaMenu.isActive && 'main' == window.monstroid2.megaMenu.location ) {
432				return true;
433			}
434
435			return false;
436		},
437
438		main_menu: function( self, $mainNavigation ) {
439
440			if ( self.isMegaMenuEnabled() ) {
441				//return;
442			}
443
444			var transitionend = 'transitionend oTransitionEnd webkitTransitionEnd',
445				moreMenuContent = '&middot;&middot;&middot;',
446				imgurl = '',
447				srcset = '',
448				hasimg = false,
449				hasicon = false,
450				hasprop = Object.prototype.hasOwnProperty,
451				$menuToggle = $( '.main-menu-toggle[aria-controls="main-menu"]', $mainNavigation ),
452				liWithChildren = 'li.menu-item-has-children, li.page_item_has_children',
453				$body = $( 'body' ),
454				$parentNode,
455				menuItem,
456				subMenu,
457				index = -1,
458				$layout = window.monstroid2.labels.header_layout;
459
460			if ( hasprop.call( window, 'monstroid2' ) &&
461				hasprop.call( window.monstroid2, 'more_button_options' ) &&
462				hasprop.call( window.monstroid2.more_button_options, 'more_button_type' ) ) {
463				switch ( window.monstroid2.more_button_options.more_button_type ) {
464					case 'image':
465						imgurl = window.monstroid2.more_button_options.more_button_image_url;
466						if ( window.monstroid2.more_button_options.retina_more_button_image_url ) {
467							srcset = ' srcset="' + window.monstroid2.more_button_options.retina_more_button_image_url + ' 2x"';
468						}
469						moreMenuContent = '<img src="' + imgurl + '"' + srcset + ' alt="' + moreMenuContent + '">';
470						hasimg = true;
471						break;
472					case 'icon':
473						moreMenuContent = '<i class="fa ' + window.monstroid2.more_button_options.more_button_icon + '"></i>';
474						hasicon = true;
475						break;
476					case 'text':
477					default:
478						moreMenuContent = window.monstroid2.more_button_options.more_button_text || moreMenuContent;
479						hasimg = false;
480						hasicon = false;
481						break;
482				}
483			}
484
485			if ( 'style-3' !== $layout && 'style-7' !== $layout && $.isFunction( jQuery.fn.superGuacamole ) ) {
486				$mainNavigation.superGuacamole( {
487					threshold: 768, // Minimal menu width, when this plugin activates
488					minChildren: 3, // Minimal visible children count
489					childrenFilter: '.menu-item:not(.wpml-ls-item):not([class*="pll-"]):not(.lang-item)', // Child elements selector
490					menuTitle: moreMenuContent, // Menu title
491					menuUrl: '#',
492					templates: {
493						menu: '<li id="%5$s" class="%1$s' + ( hasimg ? ' super-guacamole__menu-with-image' : '' ) +
494						( hasicon ? ' super-guacamole__menu-with-icon' : '' ) + '"><a href="%2$s">%3$s</a><ul class="sub-menu">%4$s</ul></li>',
495						child_wrap: '<ul class="%1$s">%2$s</ul>',
496						child: '<li id="%5$s" class="%1$s"><a href="%2$s">%3$s</a><ul class="sub-menu">%4$s</ul></li>'
497					}
498				} );
499			}
500
501			function hideSubMenu( menuItem, $event ) {
502				var subMenus = menuItem.find( '.sub-menu' ),
503					subMenu = menuItem.children( '.sub-menu' ).first();
504
505				menuItem
506					.removeData( 'index' )
507					.removeClass( 'menu-hover' );
508
509				subMenus.addClass( 'in-transition' );
510
511				subMenus
512					.one( transitionend, function() {
513						subMenus.removeClass( 'in-transition' );
514					} );
515			}
516
517			function handleMenuItemHover( $event ) {
518				if ( $( 'html' ).hasClass( 'mobile-menu-active' ) ) {
519					return;
520				}
521				menuItem = $( $event.target ).parents( '.menu-item' );
522				subMenu = menuItem.children( '.sub-menu' ).first();
523
524				var subMenus = menuItem.find( '.sub-menu' );
525
526				if ( !menuItem.hasClass( 'menu-item-has-children' ) ) {
527					menuItem = $event.target.tagName === 'LI' ?
528						$( $event.target ) :
529						$( $event.target ).parents().filter( '.menu-item' );
530				}
531
532				switch ( $event.type ) {
533					case 'mouseenter':
534					case 'mouseover':
535						if ( 0 < subMenu.length ) {
536							var maxWidth = $body.outerWidth( true ),
537								subMenuOffset = subMenu.offset().left + subMenu.outerWidth( true );
538
539							menuItem.addClass( 'menu-hover' );
540							subMenus.addClass( 'in-transition' );
541
542							if ( $( 'body' ).hasClass( 'rtl' ) ) {
543								if ( 0 > subMenu.offset().left ) {
544									subMenu.addClass( 'inverse-side' );
545									subMenu.find( '.sub-menu' ).addClass( 'inverse-side' );
546								} else if ( maxWidth <= subMenuOffset ) {
547									subMenu.removeClass( 'inverse-side' );
548									subMenu.find( '.sub-menu' ).removeClass( 'inverse-side' );
549								}
550
551							} else {
552								if ( maxWidth <= subMenuOffset ) {
553									subMenu.addClass( 'inverse-side' );
554									subMenu.find( '.sub-menu' ).addClass( 'inverse-side' );
555								} else if ( 0 > subMenu.offset().left ) {
556									subMenu.removeClass( 'inverse-side' );
557									subMenu.find( '.sub-menu' ).removeClass( 'inverse-side' );
558								}
559							}
560
561							subMenus
562								.one( transitionend, function() {
563									subMenus.removeClass( 'in-transition' );
564								} );
565						}
566						break;
567					case 'mouseleave':
568					case 'mouseout':
569						hideSubMenu( menuItem, $event );
570						break;
571				}
572			}
573
574			CherryJsCore.variable.$window.on( 'orientationchange resize', function() {
575				if ( $( 'html' ).hasClass( 'mobile-menu-active' ) ) {
576					return;
577				}
578				$mainNavigation.find( '.menu-item' ).removeClass( 'menu-hover' );
579				$mainNavigation.find( '.sub-menu.inverse-side' ).removeClass( 'inverse-side' );
580			} );
581
582			$( liWithChildren ).hoverIntent( {
583				over: function() {
584				},
585				out: function() {
586				},
587				timeout: 300,
588				selector: '.menu-item'
589			} );
590
591			$mainNavigation.on( 'mouseenter mouseover mouseleave mouseout', '.menu-item', handleMenuItemHover );
592
593			function doubleClickMenu( $jqEvent ) {
594				$parentNode = $( this );
595
596				if ( $( 'html' ).hasClass( 'mobile-menu-active' ) ) {
597					return true;
598				}
599
600				var menuIndex = $parentNode.index();
601
602				if ( menuIndex !== parseInt( $parentNode.data( 'index' ), 10 ) ) {
603					$jqEvent.preventDefault();
604				}
605
606				$parentNode.data( 'index', menuIndex );
607			}
608
609			// Check if touch events supported
610			if ( 'ontouchend' in window ) {
611
612				// Attach event listener for double click
613				$( liWithChildren, $mainNavigation )
614					.on( 'click', doubleClickMenu );
615
616				// Reset index on touchend event
617				CherryJsCore.variable.$document.on( 'touchend', function( $jqEvent ) {
618					if ( !$( 'html' ).hasClass( 'mobile-menu-active' ) ) {
619						$parentNode = $( $jqEvent.target ).parents().filter( '.menu-item:first' );
620
621						if ( $parentNode.hasClass( 'menu-hover' ) === false ) {
622							hideSubMenu( $parentNode, $jqEvent );
623
624							index = $parentNode.data( 'index' );
625
626							if ( index ) {
627								$parentNode.data( 'index', parseInt( index, 10 ) - 1 );
628							}
629						}
630					}
631				} );
632			}
633
634			$menuToggle.on( 'click', function( $event ) {
635				$event.preventDefault();
636				$mainNavigation.toggleClass( 'toggled' );
637			} );
638		},
639
640		mega_menu: function( self ) {
641
642			/**
643			 * Mega-menu mobile SubMenu Toggled.
644			 */
645			function megaMenuSubMenuToggled() {
646				$( this ).toggleClass( 'active' );
647			}
648
649			// ADD to Mega-menu sub-menu toggle active class.
650			$( '.mega-menu-mobile-arrow' ).on( 'click', megaMenuSubMenuToggled );
651		},
652
653		mobile_menu: function( self ) {
654
655			var $mainNavigation = $( '.main-navigation' ),
656				$menuToggle = $( '.main-menu-toggle[aria-controls="main-menu"]' );
657
658			$mainNavigation
659				.find( 'li.menu-item-has-children > a' )
660				.append( '<span class="sub-menu-toggle"></span>' );
661
662			/**
663			 * Debounce the function call
664			 *
665			 * @param  {number}   threshold The delay.
666			 * @param  {Function} callback  The function.
667			 */
668			function debounce( threshold, callback ) {
669				var timeout;
670
671				return function debounced( $event ) {
672					function delayed() {
673						callback.call( this, $event );
674						timeout = null;
675					}
676
677					if ( timeout ) {
678						clearTimeout( timeout );
679					}
680
681					timeout = setTimeout( delayed, threshold );
682				};
683			}
684
685			/**
686			 * Resize event handler.
687			 *
688			 * @param {jqEvent} jQuery event.
689			 */
690			function resizeHandler( $event ) {
691				var $window = CherryJsCore.variable.$window,
692					width = $window.outerWidth( true );
693
694				if ( 768 <= width ) {
695					$mainNavigation.removeClass( 'mobile-menu' );
696				} else {
697					$mainNavigation.addClass( 'mobile-menu' );
698				}
699			}
700
701			/**
702			 * Toggle sub-menus.
703			 *
704			 * @param  {jqEvent} $event jQuery event.
705			 */
706			function toggleSubMenuHandler( $event ) {
707
708				$event.preventDefault();
709
710				$( this ).toggleClass( 'active' );
711				$( this ).parents().filter( 'li:first' ).toggleClass( 'sub-menu-open' );
712
713				event.stopPropagation();
714			}
715
716			/**
717			 * Toggle menu.
718			 *
719			 * @param  {jqEvent} $event jQuery event.
720			 */
721			function toggleMenuHandler( $event ) {
722				var $toggle = $( '.sub-menu-toggle' );
723
724				if ( !$event.isDefaultPrevented() ) {
725					$event.preventDefault();
726				}
727
728				setTimeout( function() {
729					if ( !$mainNavigation.hasClass( 'animate' ) ) {
730						$mainNavigation.addClass( 'animate' );
731					}
732					$mainNavigation.toggleClass( 'show' );
733					$( 'html' ).toggleClass( 'mobile-menu-active' );
734				}, 10 );
735
736				$menuToggle.toggleClass( 'toggled' );
737				$menuToggle.attr( 'aria-expanded', !$menuToggle.hasClass( 'toggled' ) );
738
739				if ( $toggle.hasClass( 'active' ) ) {
740					$toggle.removeClass( 'active' );
741					$mainNavigation.find( '.sub-menu-open' ).removeClass( 'sub-menu-open' );
742				}
743			}
744
745			resizeHandler();
746			CherryJsCore.variable.$window.on( 'resize orientationchange', debounce( 500, resizeHandler ) );
747			$( '.sub-menu-toggle', $mainNavigation ).on( 'click', toggleSubMenuHandler );
748			$menuToggle.on( 'click.mobileMenuToggle', toggleMenuHandler );
749		},
750
751		page_preloader_init: function( self ) {
752
753			if ( $( '.page-preloader-cover' )[0] ) {
754				$( '.page-preloader-cover' ).delay( 500 ).fadeTo( 500, 0, function() {
755					$( this ).remove();
756				} );
757			}
758		},
759
760		to_top_init: function( self ) {
761			if ( $.isFunction( jQuery.fn.UItoTop ) && undefined !== window.monstroid2.toTop ) {
762				$().UItoTop( {
763					text: monstroid2.labels.totop_button,
764					scrollSpeed: 600
765				} );
766			}
767		},
768
769		ofi_init: function( self ) {
770			if ( $( 'body' ).hasClass( 'ie' ) && 'undefined' !== typeof objectFitImages ) {
771				objectFitImages();
772			}
773		},
774
775		playlist_slider_widget_init: function( self ) {
776			$( '.widget-playlist-slider .playlist-slider' ).each( function() {
777				var $this = $( this ),
778					settings = $this.data( 'settings' ),
779					breakpoints = JSON.parse( settings.breakpoints );
780
781				$this.sliderPro( {
782					autoplay: false,
783					width: settings['width'],
784					height: parseInt( settings['height'] ),
785					orientation: 'vertical',
786					waitForLayers: false,
787					touchSwipe: false,
788					updateHash: false,
789					arrows: settings['arrows'],
790					buttons: settings['buttons'],
791					thumbnailArrows: settings['thumbnailArrows'],
792					thumbnailsPosition: settings['thumbnailsPosition'],
793					thumbnailPointer: true,
794					thumbnailWidth: settings['thumbnailWidth'],
795					thumbnailHeight: settings['thumbnailHeight'],
796					breakpoints: breakpoints,
797					init: function() {
798						$this.resize().fadeTo( 0, 1 );
799					},
800					gotoSlideComplete: function( event ) {
801						var prevSlide = $( '.sp-slide', $this ).eq( event.previousIndex ),
802							iframe = prevSlide.find( 'iframe' ),
803							html5Video = prevSlide.find( 'video' );
804
805						if ( iframe[0] ) {
806							var iframeSrc = iframe.attr( 'src' );
807
808							iframe.attr( 'src', iframeSrc );
809						} else if ( html5Video[0] ) {
810							html5Video[0].stop();
811						}
812					}
813				} );
814			} );
815		},
816		news_smart_box_init: function( self ) {
817			jQuery( '.news-smart-box__instance' ).each( function() {
818				var uniqId = $( this ).data( 'uniq-id' ),
819					instanceSettings = $( this ).data( 'instance-settings' ),
820					instance = $( '#' + uniqId ),
821					$termItem = $( '.news-smart-box__navigation-terms-list-item', instance ),
822					$currentTerm = $( '.news-smart-box__navigation-title', instance ),
823					$listContainer = $( '.news-smart-box__wrapper', instance ),
824					$ajaxPreloader = $( '.nsb-spinner', instance ),
825					$termsList = $( '.news-smart-box__navigation-terms-list', instance ),
826					$menuToggle = $( '.menu-toggle', instance ),
827					ajaxGetNewInstance = null,
828					ajaxGetNewInstanceSuccess = true,
829					showNewItems = null;
830
831				$termItem.each( function() {
832					var slug = $( this ).data( 'slug' );
833
834					if ( 'category' === instanceSettings.terms_type ) {
835						if ( slug === instanceSettings.current_category ) {
836							$( this ).addClass( 'is-active' );
837						}
838					} else {
839						if ( slug === instanceSettings.current_tag ) {
840							$( this ).addClass( 'is-active' );
841						}
842					}
843				} );
844
845				$menuToggle.on( 'click', function( $jqEvent ) {
846					$jqEvent.preventDefault();
847					$menuToggle.toggleClass( 'news-smart-box__navigation-toggle--open' );
848					$termsList.toggleClass( 'news-smart-box__navigation-terms-list--open' );
849				} );
850
851				$termItem.on( 'click', function() {
852					var slug = $( this ).data( 'slug' ),
853						data = {
854							action: 'new_smart_box_instance',
855							nonce: monstroid2.new_smart_box_nonce,
856							value_slug: slug,
857							instance_settings: instanceSettings
858						},
859						currentTermName = $( this ).text(),
860						counter = 0;
861
862					if ( !$( this ).hasClass( 'is-active' ) ) {
863						$termItem.removeClass( 'is-active' );
864						$( this ).addClass( 'is-active' );
865					}
866
867					$currentTerm.html( currentTermName );
868
869					if ( ajaxGetNewInstance !== null ) {
870						ajaxGetNewInstance.abort();
871					}
872					ajaxGetNewInstance = $.ajax( {
873						type: 'GET',
874						url: monstroid2.ajaxurl,
875						data: data,
876						cache: false,
877						beforeSend: function() {
878							ajaxGetNewInstanceSuccess = false;
879							$ajaxPreloader.css( { 'display': 'block' } ).fadeTo( 300, 1 );
880						},
881						success: function( response ) {
882							ajaxGetNewInstanceSuccess = true;
883
884							$ajaxPreloader.fadeTo( 300, 0, function() {
885								$( this ).css( { 'display': 'none' } );
886							} );
887
888							$( '.news-smart-box__listing', $listContainer ).html( response );
889
890							counter = 0;
891							$( '.news-smart-box__item-inner', $listContainer ).addClass( 'animate-cycle-sh
891ow' );
892							$( '.news-smart-box__item', $listContainer ).each( function() {
893								showItem( $( this ), 100 * parseInt( counter ) + 200 );
894								counter++;
895							} )
896
897						}
898					} );
899
900				} );
901
902				var showItem = function( itemList, delay ) {
903					var timeOutInterval = setTimeout( function() {
904						$( '.news-smart-box__item-inner', itemList ).removeClass( 'animate-cycle-show' );
905					}, delay );
906				}
907			} );
908		},
909		header_search: function( self ) {
910			var $header = $( '.site-header' ),
911				$searchToggle = $( '.search-form__toggle, .search-form__close', $header ),
912				$headerSearch = $( '.header-search', $header ),
913				$searchInput = $( '.search-form__field', $headerSearch ),
914				searchHandler = function( event ) {
915					$header.toggleClass( 'search-active' );
916					if ( $header.hasClass( 'search-active' ) ) {
917						$searchInput.focus();
918					}
919				},
920				removeActiveClass = function( event ) {
921					if ( $( event.target ).closest( $searchToggle ).length || $( event.target ).closest( $headerSearch ).length ) {
922						return;
923					}
924
925					if ( $header.hasClass( 'search-active' ) ) {
926						$header.removeClass( 'search-active' );
927					}
928
929					event.stopPropagation();
930				};
931
932			$searchToggle.on( 'click', searchHandler );
933			CherryJsCore.variable.$document.on( 'click', removeActiveClass );
934
935		},
936		vertical_menu_init: function( self ) {
937			var $mainNavigation = $( '.main-navigation.vertical-menu' ),
938				$mainMenu = $( '.menu', $mainNavigation ),
939				$back = $( '.back', $mainNavigation ),
940				$close = $( '.close', $mainNavigation ),
941				currentTranslate = parseInt( $mainMenu.css( 'transform' ) ),
942				isAnimate = false,
943				offset = 300;
944
945			resizeHandler();
946			CherryJsCore.variable.$window.on( 'resize', resizeHandler );
947
948			function resizeHandler( event ) {
949				var $window = CherryJsCore.variable.$window,
950					width = $window.outerWidth( true );
951
952				if ( 768 > width ) {
953					$mainNavigation.removeClass( 'vertical-menu' );
954
955					$( '.vertical-menu-toggle' ).off( 'click.open', openHandler );
956					$( '.menu-item-has-children > a', $mainNavigation ).off( 'click.active', clickHandler );
957					$back.off( 'click.back', backHandler );
958					$close.off( 'click.close', closeHandler );
959					$mainMenu.removeClass( 'scroll' );
960
961					$( '.main-navigation .menu' ).css( 'transform', 'translateX(0)' );
962
963				} else {
964					$mainNavigation.addClass( 'vertical-menu' );
965					$( '.vertical-menu-toggle' ).off( 'click.open', openHandler ).on( 'click.open', openHandler );
966					$( '.menu-item-has-children > a', $mainNavigation ).off( 'click.active', clickHandler ).on( 'click.active', clickHandler );
967					$back.on( 'click.back', backHandler );
968					$close.on( 'click.close', closeHandler );
969					$mainMenu.addClass( 'scroll' );
970				}
971			}
972
973			$( '.menu-item-has-children', $mainNavigation ).each( function() {
974				var $li = $( this ),
975					$link = $( '>a', $li ),
976					linkText = $link.html(),
977					linkHref = $link[0].cloneNode( true ),
978					$subMenu = $( '> .sub-menu', $li );
979				$subMenu.prepend( '<li class="parent-title"><a href="' + linkHref + '">' + linkText + '</a></li>' );
980			} );
981
982			function openHandler( event ) {
983				$( this ).toggleClass( 'toggled' );
984				if ( $mainNavigation.hasClass( 'menu-open' ) ) {
985					closeHandler();
986					return false;
987				}
988				$mainNavigation.toggleClass( 'menu-open' );
989			}
990
991			function backHandler( event ) {
992				var currentTranslate = parseInt( ($mainMenu.css( 'transform' ).replace( /,/g, "" )).split( " " )[4] ),
993					translate = currentTranslate + offset,
994					$active = $( '.active', $mainMenu ),
995					$lastActive = $( $active[$active.length - 1] );
996
997				if ( isAnimate ) {
998					return false;
999				}
1000
1001				if ( currentTranslate < 0 ) {
1002					isAnimate = true;
1003					$mainMenu.css( 'transform', 'translateX(' + translate + 'px)' );
1004
1005					if ( translate >= 0 ) {
1006						translate = 0;
1007						$( this ).addClass( 'hide' );
1008						$close.removeClass( 'hide' );
1009					}
1010
1011					setTimeout( function() {
1012						$lastActive.removeClass( 'active' );
1013						$lastActive.siblings().toggleClass( 'hide' );
1014						$( '>a', $lastActive ).removeClass( 'hide' );
1015						$lastActive.parent().addClass( 'scroll' );
1016						isAnimate = false;
1017					}, 250 );
1018
1019				}
1020				return false;
1021			}
1022
1023			function closeHandler( event ) {
1024				if ( !isAnimate ) {
1025					$( '.active', $mainMenu ).removeClass( 'active' );
1026					$( '.hide', $mainMenu ).removeClass( 'hide' );
1027					$( '.close.hide', $mainNavigation ).removeClass( 'hide' );
1028					$back.addClass( 'hide' );
1029					$mainNavigation.removeClass( 'menu-open' );
1030					$mainMenu.css( 'transform', 'translateX(0)' );
1031				}
1032
1033				$( '.vertical-menu-toggle' ).removeClass( 'toggled' );
1034				return false;
1035			}
1036
1037			function clickHandler( event ) {
1038				var $_target = $( event.currentTarget ),
1039					$mainMenu = $_target.closest( '.menu' ),
1040					deep = $_target.parents( 'ul' ).length,
1041					translate = deep * offset;
1042
1043				$mainMenu.css( 'transform', 'translateX(' + -translate + 'px)' );
1044
1045				setTimeout( function() {
1046					$_target.parent().addClass( 'active' );
1047					$_target.parent().siblings().toggleClass( 'hide' );
1048					$_target.parents( '.active' ).find( '> a' ).addClass( 'hide' );
1049					$_target.siblings( 'ul' ).addClass( 'scroll' );
1050					$_target.parents( 'ul' ).removeClass( 'scroll' );
1051				}, 250 );
1052
1053				$back.removeClass( 'hide' );
1054				$close.addClass( 'hide' );
1055
1056				return false;
1057			}
1058		},
1059
1060		add_project_inline_style: function( self ) {
1061			var $projectGridContainer = $( '.projects-container.grid-layout' ),
1062				$projectJustifiedContainer = $( '.projects-container.justified-layout' ),
1063				$projectGridTermsContainer = $( '.projects-terms-container.grid-layout' ),
1064				$projectContainer = $( '.projects-container' ),
1065
1066				addInlineStyle = function() {
1067					var $this = $( this ),
1068						$projectsSettings = $this.data( 'settings' ),
1069						$projectItemIndent = Math.ceil( +$projectsSettings['item-margin'] );
1070
1071					$this.css( {
1072						'margin-left': -$projectItemIndent / 2 + 'px',
1073						'margin-right': -$projectItemIndent / 2 + 'px'
1074					} );
1075				},
1076
1077				addTemplateClass = function() {
1078					var $this = $( this ),
1079						$projectsSettings = $this.data( 'settings' ),
1080						$projectsTemplate = $projectsSettings['template'];
1081
1082					if ( $projectsTemplate ) {
1083						$this.addClass( $projectsTemplate.replace( '.', '-' ) );
1084					}
1085				};
1086
1087			$projectGridContainer.each( addInlineStyle );
1088			$projectJustifiedContainer.each( addInlineStyle );
1089			$projectGridTermsContainer.each( addInlineStyle );
1090
1091			$projectContainer.each( addTemplateClass );
1092		}
1093	};
1094	CherryJsCore.theme_script.init();
1095
1096}( 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.