PageSourceSearch

https://www.christianmingle.com/wp-content/themes/monstroid2/assets/js/theme-script.js

js christianmingle.com collected 2026-09-24 09:27:10 UTC 40,808 bytes, 1,094 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-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){r=e(u),o=r.find("a:first"),menuId=r.attr("id"),"undefined"==typeof menuId&&(menuId=i(r)),c=new n({id:"sg-"+menuId,href:o.attr("href"),title:o.get(0).childNodes[0].data}),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.navbar_init( this );
34			this.subscribe_init( this );
35			this.main_menu( this, $( '.main-navigation' ) );
36			this.mega_menu( this );
37			this.to_top_init( this );
38			this.playlist_slider_widget_init( this );
39			this.news_smart_box_init( this );
40			this.header_search( this );
41			this.mobile_menu( this );
42			this.vertical_menu_init( this );
43			this.add_project_inline_style( this );
44			this.anchor_navigation( this );
45			this.anchor_scrolling_navigation( this );
46			this.ofi_init( this );
47		},
48
49		window_load_render: function() {
50			this.page_preloader_init( this );
51		},
52
53		anchor_navigation: function ( self ) {
54			$( '.page-template-landing div:not(.woocommerce-tabs) a[href*=#]:not([href=#])' ).on( 'click', function() {
55
56				var $window = CherryJsCore.variable.$window,
57					width = $window.outerWidth( true ),
58					$menuToggle = $( '.main-menu-toggle[aria-controls="main-menu"]' );
59
60				if ( 768 > width ) {
61					$menuToggle.trigger( 'click.mobileMenuToggle' );
62				}
63
64				if ( location.pathname.replace( /^\//, '' ) === this.pathname.replace( /^\//, '' ) || location.hostname === this.hostname ) {
65					var target     = $( this.hash ),
66						targetLink = this.hash,
67						$correctionSelector = ( 768 <= width ) ? $( '#main-menu' ) : $( '.mobile-panel' ),
68						menuHeight = $correctionSelector.outerHeight(true);
69
70					target = target.length ? target : $( '[name=' + this.hash.slice( 1 ) + ']' );
71
72					if ( target.length ) {
73						$( 'html, body' ).animate( {
74							scrollTop: target.offset().top - menuHeight
75						}, 1000 );
76
77						return false;
78					}
79				}
80			});
81		},
82
83		anchor_scrolling_navigation: function ( self ) {
84
85			var $document   = $( document ),
86				top         = null,
87				changed     = false,
88				currentHash = null,
89				sections    = null,
90				timeout     = null,
91				interval    = null,
92				menuHeight  = $( '#main-menu' ).outerHeight(true),
93				$sections   = $( '.tm_pb_anchor' );
94
95			sections = getSections();
96
97
98			$( window ).on( 'scroll.cherry_anchor_navigation', function () {
99				var newTop  = $document.scrollTop();
100
101				changed = newTop != top;
102
103				if ( changed ) {
104					top = newTop;
105				}
106			});
107
108			$( window ).on( 'resize.cherry_anchor_navigation', function () {
109				sections = getSections();
110			});
111
112			function getSections() {
113				sections = $.map( $sections, function ( event ) {
114					var $event = $( event ),
115						position = $event.position();
116
117					return {
118						top: position.top - menuHeight,
119						bottom: position.top + $event.outerHeight( true ) - menuHeight,
120						hash: $event.attr( 'id' )
121					};
122				});
123
124				return sections;
125
126			}
127
128			function iteration() {
129
130				var sectionsLength = sections.length,
131					section,
132					scrollTop;
133
134				while ( section = sections[--sectionsLength] ) {
135
136					if ( section.top >= top || section.bottom <= top ) {
137						continue;
138					}
139
140					if ( currentHash == section.hash ) {
141						break;
142					}
143
144					currentHash = section.hash;
145					history.pushState( null, null, '#' + section.hash );
146				}
147			}
148
149			timeout = setTimeout( function (){
150				interval = setInterval( iteration, 250 );
151			}, 250 );
152		},
153
154		smart_slider_init: function( self ) {
155			$( '.monstroid2-smartslider' ).each( function() {
156				var slider = $( this ),
157					sliderId = slider.data( 'id' ),
158					sliderWidth = slider.data( 'width' ),
159					sliderHeight = slider.data( 'height' ),
160					sliderOrientation = slider.data( 'orientation' ),
161					slideDistance = slider.data( 'slide-distance' ),
162					slideDuration = slider.data( 'slide-duration' ),
163					sliderFade = slider.data( 'slide-fade' ),
164					sliderNavigation = slider.data( 'navigation' ),
165					sliderFadeNavigation = slider.data( 'fade-navigation' ),
166					sliderPagination = slider.data( 'pagination' ),
167					sliderAutoplay = slider.data( 'autoplay' ),
168					sliderFullScreen = slider.data( 'fullscreen' ),
169					sliderShuffle = slider.data( 'shuffle' ),
170					sliderLoop = slider.data( 'loop' ),
171					sliderThumbnailsArrows = slider.data( 'thumbnails-arrows' ),
172					sliderThumbnailsPosition = slider.data( 'thumbnails-position' ),
173					sliderThumbnailsWidth = slider.data( 'thumbnails-width' ),
174					sliderThumbnailsHeight = slider.data( 'thumbnails-height' );
175
176				if ( $( '.smart-slider__items', '#' + sliderId ).length > 0 ) {
177					$( '#' + sliderId ).sliderPro( {
178						width: sliderWidth,
179						height: sliderHeight,
180						orientation: sliderOrientation,
181						slideDistance: slideDistance,
182						slideAnimationDuration: slideDuration,
183						fade: sliderFade,
184						arrows: sliderNavigation,
185						fadeArrows: sliderFadeNavigation,
186						buttons: sliderPagination,
187						autoplay: sliderAutoplay,
188						fullScreen: sliderFullScreen,
189						shuffle: sliderShuffle,
190						loop: sliderLoop,
191						waitForLayers: false,
192						thumbnailArrows: sliderThumbnailsArrows,
193						thumbnailsPosition: sliderThumbnailsPosition,
194						thumbnailWidth: sliderThumbnailsWidth,
195						thumbnailHeight: sliderThumbnailsHeight,
196						init: function() {
197							$( this ).resize();
198						},
199						sliderResize: function( event ) {
200							var thisSlider = $( '#' + sliderId ),
201								slides = $( '.sp-slide', thisSlider );
202
203							slides.each( function() {
204
205								if ( $( '.sp-title a', this ).width() > $( this ).width() ) {
206									$( this ).addClass( 'text-wrapped' );
207								} else {
208									$( this ).removeClass( 'text-wrapped' );
209								}
210
211							} );
212						},
213						breakpoints: {
214							991: {
215								height: parseFloat( sliderHeight ) * 0.75
216							},
217							767: {
218								height: parseFloat( sliderHeight ) * 0.5,
219								thumbnailsPosition: ( 'top' === this.thumbnailsPosition ) ? 'top' : 'bottom',
220								thumbnailHeight: parseFloat( sliderThumbnailsHeight ) * 0.75,
221								thumbnailWidth: parseFloat( sliderThumbnailsWidth ) * 0.75
222							}
223						}
224					} );
225				}
226			} );//each end
227		},
228
229		swiper_carousel_init: function( self ) {
230
231			// Enable swiper carousels
232			jQuery( '.monstroid2-carousel' ).each( function() {
233				var swiper = null,
234					uniqId = jQuery( this ).data( 'uniq-id' ),
235					slidesPerView = parseFloat( jQuery( this ).data( 'slides-per-view' ) ),
236					slidesPerGroup = parseFloat( jQuery( this ).data( 'slides-per-group' ) ),
237					slidesPerColumn = parseFloat( jQuery( this ).data( 'slides-per-column' ) ),
238					spaceBetweenSlides = parseFloat( jQuery( this ).data( 'space-between-slides' ) ),
239					durationSpeed = parseFloat( jQuery( this ).data( 'duration-speed' ) ),
240					swiperLoop = jQuery( this ).data( 'swiper-loop' ),
241					freeMode = jQuery( this ).data( 'free-mode' ),
242					grabCursor = jQuery( this ).data( 'grab-cursor' ),
243					mouseWheel = jQuery( this ).data( 'mouse-wheel' ),
244					breakpointsSettings = {
245						1199: {
246							slidesPerView: Math.floor( slidesPerView * 0.75 ),
247							spaceBetween: Math.floor( spaceBetweenSlides * 0.75 )
248						},
249						991: {
250							slidesPerView: Math.floor( slidesPerView * 0.5 ),
251							spaceBetween: Math.floor( spaceBetweenSlides * 0.5 )
252						},
253						767: {
254							slidesPerView: ( 0 !== Math.floor( slidesPerView * 0.25 ) ) ? Math.floor( slidesPerView * 0.25 ) : 1
255						}
256					};
257
258				if ( 1 == slidesPerView ) {
259					breakpointsSettings = {}
260				}
261
262				var swiper = new Swiper( '#' + uniqId, {
263						slidesPerView: slidesPerView,
264						slidesPerGroup: slidesPerGroup,
265						slidesPerColumn: slidesPerColumn,
266						spaceBetween: spaceBetweenSlides,
267						speed: durationSpeed,
268						loop: swiperLoop,
269						freeMode: freeMode,
270						grabCursor: grabCursor,
271						mousewheelControl: mouseWheel,
272						paginationClickable: true,
273						nextButton: '#' + uniqId + '-next',
274						prevButton: '#' + uniqId + '-prev',
275						pagination: '#' + uniqId + '-pagination',
276						onInit: function() {
277							$( '#' + uniqId + '-next' ).css( { 'display': 'block' } );
278							$( '#' + uniqId + '-prev' ).css( { 'display': 'block' } );
279						},
280						breakpoints: breakpointsSettings
281					}
282				);
283			} );
284		},
285
286		post_formats_custom_init: function( self ) {
287			CherryJsCore.variable.$document.on( 'cherry-post-formats-custom-init', function( event ) {
288
289				if ( 'slider' !== event.object ) {
290					return;
291				}
292
293				var uniqId = '#' + event.item.attr( 'id' ),
294					settings = event.item.data( 'init' ),
295					swiper = new Swiper( uniqId, {
296						pagination: uniqId + ' .swiper-pagination',
297						paginationClickable: true,
298						nextButton: uniqId + ' .swiper-button-next',
299						prevButton: uniqId + ' .swiper-button-prev',
300						spaceBetween: 0,
301						onInit: function() {
302							if ( settings['arrows'] ) {
303								$( uniqId + ' .swiper-button-next' ).css( { 'display': 'block' } );
304								$( uniqId + ' .swiper-button-prev' ).css( { 'display': 'block' } );
305							}
306							if ( settings['buttons'] ) {
307								$( uniqId + ' .swiper-pagination' ).css( { 'display': 'block' } );
308							}
309						}
310					} );
311
312				event.item.data( 'initalized', true );
313			} );
314
315			var items = [];
316
317			$( '.mini-gallery .post-thumbnail__link' ).on( 'click', function( event ) {
318				event.preventDefault();
319
320				$( this ).parents( '.mini-gallery' ).find( '.post-gallery__slides > a[href]' ).each( function() {
321					items.push( {
322						src: $( this ).attr( 'href' ),
323						type: 'image'
324					} );
325				} );
326
327				$.magnificPopup.open( {
328					items: items,
329					gallery: {
330						enabled: true
331					}
332				} );
333			} );
334		},
335
336		navbar_init: function( self ) {
337
338			$( window ).load( function() {
339
340				var $layout = window.monstroid2.labels.header_layout,
341					$navbar = ( 'style-3' === $layout || 'style-7' === $layout  ) ? $( '.vertical-menu-toggle' ) : $( '#main-menu' );
342
343				if ( !$.isFunction( jQuery.fn.stickUp ) || undefined === window.monstroid2.stickUp || !$navbar.length ) {
344					return !1;
345				}
346
347				$navbar.stickUp( {
348					correctionSelector: '#wpadminbar',
349					listenSelector: '.listenSelector',
350					pseudo: true,
351					active: true
352				} );
353				CherryJsCore.variable.$document.trigger( 'scroll.stickUp' );
354
355			} );
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  ) {
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
714			/**
715			 * Toggle menu.
716			 *
717			 * @param  {jqEvent} $event jQuery event.
718			 */
719			function toggleMenuHandler( $event ) {
720				var $toggle = $( '.sub-menu-toggle' );
721
722				if ( !$event.isDefaultPrevented() ) {
723					$event.preventDefault();
724				}
725
726				setTimeout( function() {
727					if ( !$mainNavigation.hasClass( 'animate' ) ) {
728						$mainNavigation.addClass( 'animate' );
729					}
730					$mainNavigation.toggleClass( 'show' );
731					$( 'html' ).toggleClass( 'mobile-menu-active' );
732				}, 10 );
733
734				$menuToggle.toggleClass( 'toggled' );
735				$menuToggle.attr( 'aria-expanded', !$menuToggle.hasClass( 'toggled' ) );
736
737				if ( $toggle.hasClass( 'active' ) ) {
738					$toggle.removeClass( 'active' );
739					$mainNavigation.find( '.sub-menu-open' ).removeClass( 'sub-menu-open' );
740				}
741			}
742
743			resizeHandler();
744			CherryJsCore.variable.$window.on( 'resize orientationchange', debounce( 500, resizeHandler ) );
745			$( '.sub-menu-toggle', $mainNavigation ).on( 'click', toggleSubMenuHandler );
746			$menuToggle.on( 'click.mobileMenuToggle', toggleMenuHandler );
747		},
748
749		page_preloader_init: function( self ) {
750
751			if ( $( '.page-preloader-cover' )[0] ) {
752				$( '.page-preloader-cover' ).delay( 500 ).fadeTo( 500, 0, function() {
753					$( this ).remove();
754				} );
755			}
756		},
757
758		to_top_init: function( self ) {
759			if ( $.isFunction( jQuery.fn.UItoTop ) && undefined !== window.monstroid2.toTop ) {
760				$().UItoTop( {
761					text: monstroid2.labels.totop_button,
762					scrollSpeed: 600
763				} );
764			}
765		},
766
767		ofi_init: function( self ) {
768			if ( $( 'body' ).hasClass( 'ie' ) && 'undefined' !== typeof objectFitImages ) {
769				objectFitImages();
770			}
771		},
772
773		playlist_slider_widget_init: function( self ) {
774			$( '.widget-playlist-slider .playlist-slider' ).each( function() {
775				var $this = $( this ),
776					settings = $this.data( 'settings' ),
777					breakpoints = JSON.parse( settings.breakpoints );
778
779				$this.sliderPro( {
780					autoplay: false,
781					width: settings['width'],
782					height: parseInt( settings['height'] ),
783					orientation: 'vertical',
784					waitForLayers: false,
785					touchSwipe: false,
786					updateHash: false,
787					arrows: settings['arrows'],
788					buttons: settings['buttons'],
789					thumbnailArrows: settings['thumbnailArrows'],
790					thumbnailsPosition: settings['thumbnailsPosition'],
791					thumbnailPointer: true,
792					thumbnailWidth: settings['thumbnailWidth'],
793					thumbnailHeight: settings['thumbnailHeight'],
794					breakpoints: breakpoints,
795					init: function() {
796						$this.resize().fadeTo( 0, 1 );
797					},
798					gotoSlideComplete: function( event ) {
799						var prevSlide = $( '.sp-slide', $this ).eq( event.previousIndex ),
800							iframe = prevSlide.find( 'iframe' ),
801							html5Video = prevSlide.find( 'video' );
802
803						if ( iframe[0] ) {
804							var iframeSrc = iframe.attr( 'src' );
805
806							iframe.attr( 'src', iframeSrc );
807						} else if ( html5Video[0] ) {
808							html5Video[0].stop();
809						}
810					}
811				} );
812			} );
813		},
814		news_smart_box_init: function( self ) {
815			jQuery( '.news-smart-box__instance' ).each( function() {
816				var uniqId = $( this ).data( 'uniq-id' ),
817					instanceSettings = $( this ).data( 'instance-settings' ),
818					instance = $( '#' + uniqId ),
819					$termItem = $( '.news-smart-box__navigation-terms-list-item', instance ),
820					$currentTerm = $( '.news-smart-box__navigation-title', instance ),
821					$listContainer = $( '.news-smart-box__wrapper', instance ),
822					$ajaxPreloader = $( '.nsb-spinner', instance ),
823					$termsList = $( '.news-smart-box__navigation-terms-list', instance ),
824					$menuToggle = $( '.menu-toggle', instance ),
825					ajaxGetNewInstance = null,
826					ajaxGetNewInstanceSuccess = true,
827					showNewItems = null;
828
829				$termItem.each( function() {
830					var slug = $( this ).data( 'slug' );
831
832					if ( 'category' === instanceSettings.terms_type ) {
833						if ( slug === instanceSettings.current_category ) {
834							$( this ).addClass( 'is-active' );
835						}
836					} else {
837						if ( slug === instanceSettings.current_tag ) {
838							$( this ).addClass( 'is-active' );
839						}
840					}
841				} );
842
843				$menuToggle.on( 'click', function( $jqEvent ) {
844					$jqEvent.preventDefault();
845					$menuToggle.toggleClass( 'news-smart-box__navigation-toggle--open' );
846					$termsList.toggleClass( 'news-smart-box__navigation-terms-list--open' );
847				} );
848
849				$termItem.on( 'click', function() {
850					var slug = $( this ).data( 'slug' ),
851						data = {
852							action: 'new_smart_box_instance',
853							nonce: monstroid2.new_smart_box_nonce,
854							value_slug: slug,
855							instance_settings: instanceSettings
856						},
857						currentTermName = $( this ).text(),
858						counter = 0;
859
860					if ( !$( this ).hasClass( 'is-active' ) ) {
861						$termItem.removeClass( 'is-active' );
862						$( this ).addClass( 'is-active' );
863					}
864
865					$currentTerm.html( currentTermName );
866
867					if ( ajaxGetNewInstance !== null ) {
868						ajaxGetNewInstance.abort();
869					}
870					ajaxGetNewInstance = $.ajax( {
871						type: 'GET',
872						url: monstroid2.ajaxurl,
873						data: data,
874						cache: false,
875						beforeSend: function() {
876							ajaxGetNewInstanceSuccess = false;
877							$ajaxPreloader.css( { 'display': 'block' } ).fadeTo( 300, 1 );
878						},
879						success: function( response ) {
880							ajaxGetNewInstanceSuccess = true;
881
882							$ajaxPreloader.fadeTo( 300, 0, function() {
883								$( this ).css( { 'display': 'none' } );
884							} );
885
886							$( '.news-smart-box__listing', $listContainer ).html( response );
887
888							counter = 0;
889							$( '.news-smart-box__item-inner', $listContainer ).addClass( 'animate-cycle-sh
889ow' );
890							$( '.news-smart-box__item', $listContainer ).each( function() {
891								showItem( $( this ), 100 * parseInt( counter ) + 200 );
892								counter++;
893							} )
894
895						}
896					} );
897
898				} );
899
900				var showItem = function( itemList, delay ) {
901					var timeOutInterval = setTimeout( function() {
902						$( '.news-smart-box__item-inner', itemList ).removeClass( 'animate-cycle-show' );
903					}, delay );
904				}
905			} );
906		},
907		header_search: function( self ) {
908			var $header = $( '.site-header' ),
909				$searchToggle = $( '.search-form__toggle, .search-form__close', $header ),
910				$headerSearch = $( '.header-search', $header ),
911				$searchInput = $( '.search-form__field', $headerSearch ),
912				searchHandler = function( event ) {
913					$header.toggleClass( 'search-active' );
914					if ( $header.hasClass( 'search-active' ) ) {
915						$searchInput.focus();
916					}
917				},
918				removeActiveClass = function( event ) {
919					if ( $( event.target ).closest( $searchToggle ).length || $( event.target ).closest( $headerSearch ).length ) {
920						return;
921					}
922
923					if ( $header.hasClass( 'search-active' ) ) {
924						$header.removeClass( 'search-active' );
925					}
926
927					event.stopPropagation();
928				};
929
930			$searchToggle.on( 'click', searchHandler );
931			CherryJsCore.variable.$document.on( 'click', removeActiveClass );
932
933		},
934		vertical_menu_init: function( self ) {
935			var $mainNavigation = $( '.main-navigation.vertical-menu' ),
936				$mainMenu = $( '.menu', $mainNavigation ),
937				$back = $( '.back', $mainNavigation ),
938				$close = $( '.close', $mainNavigation ),
939				currentTranslate = parseInt( $mainMenu.css( 'transform' ) ),
940				isAnimate = false,
941				offset = 300;
942
943			resizeHandler();
944			CherryJsCore.variable.$window.on( 'resize', resizeHandler );
945
946			function resizeHandler( event ) {
947				var $window = CherryJsCore.variable.$window,
948					width = $window.outerWidth( true );
949
950				if ( 768 > width ) {
951					$mainNavigation.removeClass( 'vertical-menu' );
952
953					$( '.vertical-menu-toggle' ).off( 'click.open', openHandler );
954					$( '.menu-item-has-children > a', $mainNavigation ).off( 'click.active', clickHandler );
955					$back.off( 'click.back', backHandler );
956					$close.off( 'click.close', closeHandler );
957					$mainMenu.removeClass( 'scroll' );
958
959					$( '.main-navigation .menu' ).css( 'transform', 'translateX(0)' );
960
961				} else {
962					$mainNavigation.addClass( 'vertical-menu' );
963					$( '.vertical-menu-toggle' ).off( 'click.open', openHandler ).on( 'click.open', openHandler );
964					$( '.menu-item-has-children > a', $mainNavigation ).off( 'click.active', clickHandler ).on( 'click.active', clickHandler );
965					$back.on( 'click.back', backHandler );
966					$close.on( 'click.close', closeHandler );
967					$mainMenu.addClass( 'scroll' );
968				}
969			}
970
971			$( '.menu-item-has-children', $mainNavigation ).each( function() {
972				var $li = $( this ),
973					$link = $( '>a', $li ),
974					linkText = $link.html(),
975					linkHref = $link[0].cloneNode( true ),
976					$subMenu = $( '> .sub-menu', $li );
977				$subMenu.prepend( '<li class="parent-title"><a href="' + linkHref + '">' + linkText + '</a></li>' );
978			} );
979
980			function openHandler( event ) {
981				$( this ).toggleClass( 'toggled' );
982				if ( $mainNavigation.hasClass( 'menu-open' ) ) {
983					closeHandler();
984					return false;
985				}
986				$mainNavigation.toggleClass( 'menu-open' );
987			}
988
989			function backHandler( event ) {
990				var currentTranslate = parseInt( ($mainMenu.css( 'transform' ).replace( /,/g, "" )).split( " " )[4] ),
991					translate = currentTranslate + offset,
992					$active = $( '.active', $mainMenu ),
993					$lastActive = $( $active[$active.length - 1] );
994
995				if ( isAnimate ) {
996					return false;
997				}
998
999				if ( currentTranslate < 0 ) {
1000					isAnimate = true;
1001					$mainMenu.css( 'transform', 'translateX(' + translate + 'px)' );
1002
1003					if ( translate >= 0 ) {
1004						translate = 0;
1005						$( this ).addClass( 'hide' );
1006						$close.removeClass( 'hide' );
1007					}
1008
1009					setTimeout( function() {
1010						$lastActive.removeClass( 'active' );
1011						$lastActive.siblings().toggleClass( 'hide' );
1012						$( '>a', $lastActive ).removeClass( 'hide' );
1013						$lastActive.parent().addClass( 'scroll' );
1014						isAnimate = false;
1015					}, 250 );
1016
1017				}
1018				return false;
1019			}
1020
1021			function closeHandler( event ) {
1022				if ( !isAnimate ) {
1023					$( '.active', $mainMenu ).removeClass( 'active' );
1024					$( '.hide', $mainMenu ).removeClass( 'hide' );
1025					$( '.close.hide', $mainNavigation ).removeClass( 'hide' );
1026					$back.addClass( 'hide' );
1027					$mainNavigation.removeClass( 'menu-open' );
1028					$mainMenu.css( 'transform', 'translateX(0)' );
1029				}
1030
1031				$( '.vertical-menu-toggle' ).removeClass( 'toggled' );
1032				return false;
1033			}
1034
1035			function clickHandler( event ) {
1036				var $_target = $( event.currentTarget ),
1037					$mainMenu = $_target.closest( '.menu' ),
1038					deep = $_target.parents( 'ul' ).length,
1039					translate = deep * offset;
1040
1041				$mainMenu.css( 'transform', 'translateX(' + -translate + 'px)' );
1042
1043				setTimeout( function() {
1044					$_target.parent().addClass( 'active' );
1045					$_target.parent().siblings().toggleClass( 'hide' );
1046					$_target.parents( '.active' ).find( '> a' ).addClass( 'hide' );
1047					$_target.siblings( 'ul' ).addClass( 'scroll' );
1048					$_target.parents( 'ul' ).removeClass( 'scroll' );
1049				}, 250 );
1050
1051				$back.removeClass( 'hide' );
1052				$close.addClass( 'hide' );
1053
1054				return false;
1055			}
1056		},
1057
1058		add_project_inline_style: function( self ) {
1059			var $projectGridContainer = $( '.projects-container.grid-layout' ),
1060				$projectJustifiedContainer = $( '.projects-container.justified-layout' ),
1061				$projectGridTermsContainer = $( '.projects-terms-container.grid-layout' ),
1062				$projectContainer = $( '.projects-container' ),
1063
1064				addInlineStyle = function() {
1065					var $this = $( this ),
1066						$projectsSettings = $this.data( 'settings' ),
1067						$projectItemIndent = Math.ceil( +$projectsSettings['item-margin'] );
1068
1069					$this.css( {
1070						'margin-left': -$projectItemIndent / 2 + 'px',
1071						'margin-right': -$projectItemIndent / 2 + 'px'
1072					} );
1073				},
1074
1075				addTemplateClass = function() {
1076					var $this = $( this ),
1077						$projectsSettings = $this.data( 'settings' ),
1078						$projectsTemplate = $projectsSettings['template'];
1079
1080					if ( $projectsTemplate ) {
1081						$this.addClass( $projectsTemplate.replace( '.', '-' ) );
1082					}
1083				};
1084
1085			$projectGridContainer.each( addInlineStyle );
1086			$projectJustifiedContainer.each( addInlineStyle );
1087			$projectGridTermsContainer.each( addInlineStyle );
1088
1089			$projectContainer.each( addTemplateClass );
1090		}
1091	};
1092	CherryJsCore.theme_script.init();
1093
1094}( 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.