PageSourceSearch

https://nuocsinhhoat.com/wp-content/themes/soledad/js/main.js?ver=5.3

js nuocsinhhoat.com collected 2026-10-07 20:04:03 UTC 16,873 bytes, 566 lines download raw bytes

1/* global PENCILOCALIZE */
2
3(function($) {
4	"use strict";
5	var PENCI = PENCI || {};
6
7	/* General functions
8	 ---------------------------------------------------------------*/
9	PENCI.general = function () {
10		// Top search
11		$( '#top-search a.search-click' ).on( 'click', function () {
12			$( '.show-search' ).fadeToggle();
13			$( '.show-search input.search-input' ).focus();
14		} );
15
16		// Go to top
17		$( '.go-to-top, .penci-go-to-top-floating' ).on( 'click', function () {
18			$( 'html, body' ).animate( { scrollTop: 0 }, 700 );
19			return false;
20		} );
21
22		// Lazyload
23		$('.penci-lazy').Lazy({
24			effect: 'fadeIn',
25			effectTime: 300,
26			scrollDirection: 'both'
27		});
28
29		// Go to top button
30		var $goto_button = $( '.penci-go-to-top-floating' );
31		if ( $goto_button.length ) {
32			$(document).scroll(function() {
33				var y = $(this).scrollTop();
34				if ( y > 300) {
35					$goto_button.addClass('show-up');
36				} else {
37					$goto_button.removeClass('show-up');
38				}
39			} );
40		}
41		
42		// Call back fitvid when click load more button on buddypress
43		$( 'body.buddypress .activity .load-more a' ).on( 'click', function () {
44			$(document).ajaxStop(function() {
45			  $( ".container" ).fitVids();
46			});
47		} );
48
49		$( '.penci-gprd-accept, .penci-gdrd-show' ).on( 'click', function ( e ) {
50			e.preventDefault();
51
52			var $this = $(this),
53				$ajax_url = $this.data('url');
54			$this.closest( '.penci-wrap-gprd-law' ).toggleClass('penci-wrap-gprd-law-close');
55			
56			jQuery.ajax( {
57				type: "post",
58				url : $ajax_url,
59				data: "data=" + $this.data( 'cookie' )
60			} );
61		} );
62	}
63
64	/* Sticky main navigation
65	 ---------------------------------------------------------------*/
66	PENCI.main_sticky = function () {
67		if ( $().sticky && ! $( "nav#navigation" ).hasClass( 'penci-disable-sticky-nav' ) ) {
68			var spaceTop = 0;
69			if ( $( 'body' ).hasClass( 'admin-bar' ) ) {
70				spaceTop = 32;
71			}
72			$( "nav#navigation" ).each( function () {
73				$( this ).sticky( { topSpacing: spaceTop } );
74			} );
75		} // sticky
76	}
77
78	/* Fix margin headline
79	 ----------------------------------------------------------------*/
80	PENCI.fixheadline = function () {
81		var $headline_title = $( '.penci-headline .headline-title' );
82		if ( $headline_title.length ) {
83			var headline_w = $headline_title.outerWidth() + 70;
84			$('.penci-headline-posts' ).css( 'margin-left', headline_w + 'px' );
85			$('.rtl .penci-headline-posts' ).css( 'margin-left', 0 + 'px' );
86			$('.rtl .penci-headline-posts' ).css( 'margin-right', headline_w + 'px' );
87		}
88	}
89
90	/* Homepage Featured Slider
91	 ---------------------------------------------------------------*/
92	PENCI.featured_slider = function () {
93		if ( $().owlCarousel ) {
94			$( '.featured-area .penci-owl-featured-area' ).each( function () {
95				var $this = $( this ),
96					$style = $this.data( 'style' ),
97					$auto = false,
98					$autotime = $this.data( 'autotime' ),
99					$speed = $this.data( 'speed' ),
100					$loop = $this.data('loop'),
101					$item = 1,
102					$nav = true,
103					$dots = false,
104					$rtl = false,
105					$items_desktop = 1,
106					$items_tablet = 1,
107					$items_tabsmall = 1;
108
109				if( $style === 'style-2' ) {
110					$item = 2;
111				} else if( $style === 'style-28' ) {
112					$loop = true;
113				}
114
115				if( $('html').attr('dir') === 'rtl' ) {
116					$rtl = true;
117				}
118				if ( $this.attr('data-auto') === 'true' ) {
119					$auto = true;
120				}
121				if ( $this.attr('data-nav') === 'false' ) {
122					$nav = false;
123				}
124				if ( $this.attr('data-dots') === 'true' ) {
125					$dots = true;
126				}
127				if ( $this.attr('data-item') ) {
128					$item = parseInt( $this.data('item') );
129				}
130				if ( $this.attr('data-desktop') ) {
131					$items_desktop = parseInt( $this.data('desktop') );
132				}
133				if ( $this.attr('data-tablet') ) {
134					$items_tablet = parseInt( $this.data('tablet') );
135				}
136				if ( $this.attr('data-tabsmall') ) {
137					$items_tabsmall = parseInt( $this.data('tabsmall') );
138				}
139
140				var owl_args = {
141					rtl               : $rtl,
142					loop              : $loop,
143					margin            : 0,
144					items             : $item,
145					navSpeed          : $speed,
146					dotsSpeed         : $speed,
147					nav               : $nav,
148					slideBy           : $item,
149					mouseDrag         : false,
150					lazyLoad          : true,
151					dots              : $dots,
152					navText           : ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
153					autoplay          : $auto,
154					autoplayTimeout   : $autotime,
155					autoplayHoverPause: true,
156					autoplaySpeed     : $speed,
157					responsive        : {
158						0   : {
159							items: 1
160						},
161						480 : {
162							items  : $items_tabsmall,
163							slideBy: $items_tabsmall
164						},
165						768 : {
166							items  : $items_tablet,
167							slideBy: $items_tablet
168						},
169						1170: {
170							items  : $items_desktop,
171							slideBy: $items_desktop
172						}
173					}
174				}
175
176				if( $style === 'style-2' ) {
177					owl_args['center'] = true;
178					owl_args['margin'] = 10;
179					owl_args['autoWidth'] = true;
180				} else if( $style === 'style-28' ) {
181					owl_args['margin'] = 4;
182					owl_args['items'] = 6;
183					owl_args['autoWidth'] = true;
184				}
185
186				$this.owlCarousel( owl_args );
187
188				if( $style === 'style-2' || $style === 'style-5' || $style === 'style-28' || $style === 'style-29' ) {
189					$this.on( 'changed.owl.carousel', function ( event ) {
190						$this.find( '.penci-lazy' ).Lazy( {
191							effect: 'fadeIn',
192							effectTime: 300,
193							scrollDirection: 'both'
194						} );
195					} );
196				}
197			} );
198		}	// if owlcarousel
199	}
200
201	/* Owl Slider General
202	 ---------------------------------------------------------------*/
203	PENCI.owl_slider = function () {
204		if ( $().owlCarousel ) {
205			$( '.penci-owl-carousel-slider' ).each( function () {
206				var $this = $( this ),
207					$auto = true,
208					$dots = false,
209					$nav = true,
210					$loop = true,
211					$rtl = false,
212					$dataauto = $this.data( 'auto' ),
213					$items_desktop = 1,
214					$items_tablet = 1,
215					$items_tabsmall = 1,
216					$speed = 600,
217					$item = 1,
218					$autotime = 5000,
219					$datalazy = false;
220
221				if( $('html').attr('dir') === 'rtl' ) {
222					$rtl = true;
223				}
224				if ( $this.attr('data-dots') ) {
225					$dots = true;
226				}
227				if ( $this.attr('data-loop') ) {
228					$loop = false;
229				}
230				if ( $this.attr('data-nav') ) {
231					$nav = false;
232				}
233				if ( $this.attr('data-desktop') ) {
234					$items_desktop = parseInt( $this.data('desktop') );
235				}
236				if ( $this.attr('data-tablet') ) {
237					$items_tablet = parseInt( $this.data('tablet') );
238				}
239				if ( $this.attr('data-tabsmall') ) {
240					$items_tabsmall = parseInt( $this.data('tabsmall') );
241				}
242				if ( $this.attr('data-speed') ) {
243					$speed = parseInt( $this.data('speed') );
244				}
245				if ( $this.attr('data-autotime') ) {
246					$autotime = parseInt( $this.data('autotime') );
247				}
248				if ( $this.attr('data-item') ) {
249					$item = parseInt( $this.data('item') );
250				}
251				if ( $this.attr('data-lazy') ) {
252					$datalazy = true;
253				}
254
255				var owl_args = {
256					loop              : $loop,
257					rtl               : $rtl,
258					margin            : 0,
259					items             : $item,
260					slideBy           : $item,
261					lazyLoad          : $datalazy,
262					navSpeed          : $speed,
263					dotsSpeed         : $speed,
264					nav               : $nav,
265					dots              : $dots,
266					navText           : ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
267					autoplay          : $dataauto,
268					autoplayTimeout   : $autotime,
269					autoHeight        : true,
270					autoplayHoverPause: true,
271					autoplaySpeed     : $speed,
272					responsive        : {
273						0   : {
274							items  : 1,
275							slideBy: 1
276						},
277						480 : {
278							items  : $items_tabsmall,
279							slideBy: $items_tabsmall
280						},
281						768 : {
282							items  : $items_tablet,
283							slideBy: $items_tablet
284						},
285						1170: {
286							items  : $items_desktop,
287							slideBy: $items_desktop
288						}
289					}
290				};
291
292				if ( $this.hasClass( 'penci-headline-posts' ) ) {
293					owl_args['animateOut'] = 'slideOutUp';
294					owl_args['animateIn'] = 'slideInUp';
295				}
296
297				$this.owlCarousel( owl_args );
298
299				$this.on('changed.owl.carousel', function(event) {
300					$this.find( '.penci-lazy' ).Lazy( {
301						effect: 'fadeIn',
302						effectTime: 300,
303						scrollDirection: 'both'
304					} );
305				});
306			} );
307		}	// if owlcarousel
308	}
309
310	/* Fitvids
311	 ---------------------------------------------------------------*/
312	PENCI.fitvids = function() {
313		// Target your .container, .wrapper, .post, etc.
314		$( ".container" ).fitVids();
315	}
316
317	/* Sticky sidebar
318	 ----------------------------------------------------------------*/
319	PENCI.sticky_sidebar = function() {
320		if ( $().theiaStickySidebar ) {
321			var top_margin = 90;
322			if( $('body' ).hasClass('admin-bar') ) {
323				top_margin = 122;
324			}
325			$('#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar' ).the
325iaStickySidebar({
326				// settings
327				additionalMarginTop: top_margin
328			});
329		} // if sticky
330	}
331
332	/* Mega menu
333	 ----------------------------------------------------------------*/
334	PENCI.mega_menu = function () {
335		$( '#navigation .penci-mega-child-categories a' ).mouseenter( function () {
336			if ( !$( this ).hasClass( 'cat-active' ) ) {
337				var $this = $( this ),
338					$row_active = $this.data( 'id' ),
339					$parentA = $this.parent().children( 'a' ),
340					$parent = $this.closest( '.penci-megamenu' ),
341					$rows = $this.closest( '.penci-megamenu' ).find( '.penci-mega-latest-posts' ).children( '.penci-mega-row' );
342				$parentA.removeClass( 'cat-active' );
343				$this.addClass( 'cat-active' );
344				$rows.hide();
345				$parent.find( '.' + $row_active ).fadeIn( '300' ).css( 'display', 'inline-block' );
346			}
347		} );
348	}
349
350	/* Mobile menu responsive
351	 ----------------------------------------------------------------*/
352	PENCI.mobile_menu = function () {
353		// Add indicator
354		$( '#sidebar-nav .menu li.menu-item-has-children > a' ).append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' );
355		$( '#sidebar-nav .penci-mega-child-categories' ).closest('li.penci-mega-menu' ).children('a').append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' );
356
357		// Toggle menu when click show/hide menu
358		$( '#navigation .button-menu-mobile' ).on( 'click', function () {
359			$( 'body' ).addClass( 'open-sidebar-nav' );
360		} );
361
362		// indicator click
363		$( '#sidebar-nav .menu li a .indicator' ).on( 'click', function ( e ) {
364			var $this = $( this );
365			e.preventDefault();
366			$this.children().toggleClass( 'fa-angle-up' );
367			$this.parent().next().slideToggle( 'fast' );
368		} );
369
370		// Close sidebar nav
371		$( '#close-sidebar-nav' ).on( 'click', function () {
372			$( 'body' ).removeClass( 'open-sidebar-nav' );
373		} );
374	}
375
376	/* Light box
377	 ----------------------------------------------------------------*/
378	PENCI.lightbox = function () {
379		if ( $().magnificPopup) {
380			$( 'a[data-rel^="penci-gallery-image-content"], .penci-enable-lightbox .gallery-item a' ).magnificPopup( {
381				type               : 'image',
382				closeOnContentClick: true,
383				closeBtnInside     : false,
384				fixedContentPos    : true,
385				image              : {
386					verticalFit: true
387				},
388				gallery : {
389					enabled: true
390				},
391				zoom               : {
392					enabled : true,
393					duration: 300 // don't foget to change the duration also in CSS
394				}
395			} );
396
397			// Enable lightbox videos
398			$('.penci-other-layouts-lighbox').magnificPopup( {
399				type: 'iframe',
400				mainClass: 'mfp-fade',
401				fixedContentPos    : true,
402				closeBtnInside     : false,
403				closeOnContentClick: true
404			} );
405		} // if magnificPopup exists
406	}
407
408	/* Masonry layout
409	 ----------------------------------------------------------------*/
410	PENCI.masonry = function() {
411		$(window).load(function() {
412			var $masonry_container = $( '.penci-masonry' );
413			if ( $masonry_container.length ) {
414				$masonry_container.each( function () {
415					var $this = $( this );
416					// initialize isotope
417					$this.isotope( {
418						itemSelector      : '.item-masonry',
419						transitionDuration: '.55s',
420						layoutMode        : 'masonry'
421					} );
422				} );
423			}
424		});
425	}
426
427	/* Video Background
428	 ----------------------------------------------------------------*/
429	PENCI.video_background = function() {
430		var $penci_videobg = $( '#penci-featured-video-bg' );
431		if ( $().mb_YTPlayer && $penci_videobg.length ) {
432			$(window ).load( function() {
433				$("#penci-featured-video-bg").mb_YTPlayer();
434				setTimeout(function(){
435					$('.featured-area').addClass( 'loaded-wait' ).append('<div class="overlay-video-click"></div>');
436					$('.overlay-video-click').on( 'click', function () {
437						var $this = $(this);
438						if( !$this.hasClass( 'pause-video' ) ) {
439							$this.addClass('pause-video');
440							jQuery('#penci-featured-video-bg').pauseYTP();
441						} else {
442							$this.removeClass('pause-video');
443							jQuery('#penci-featured-video-bg').playYTP();
444						}
445					});
446				}, 4000);
447			} );
448		}
449	}
450
451	/* Portfolio
452	 ----------------------------------------------------------------*/
453	PENCI.portfolio = function () {
454		var $penci_portfolio = $( '.penci-portfolio' );
455		if ( $().isotope && $penci_portfolio.length ) {
456			$( '.penci-portfolio' ).each( function () {
457				var $this = $( this );
458				$( window ).load( function () {
459					$this.isotope( {
460						itemSelector    : '.portfolio-item',
461						animationEngine : 'best-available',
462						animationOptions: {
463							duration: 250,
464							queue   : false
465						}
466					} ); // isotope
467
468					$this.addClass( 'loaded' );
469
470					$('.portfolio-item .inner-item-portfolio').each( function () {
471						var $this = $( this );
472						$this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) {
473							$this.addClass( 'animated' );
474						} ); // inview
475					} ); // each
476
477				} ); // load
478
479				// filter items when filter link is clicked
480				$this.parent().find( '.penci-portfolio-filter' ).find( 'li' ).on( 'click', function () {
481					$this.parent().find( '.penci-portfolio-filter' ).find( 'li' ).removeClass( 'active' );
482					$( this ).addClass( 'active' );
483					var selector = $( this ).find( "a" ).attr( 'data-filter' );
484					$this.isotope( { filter: selector } );
485					return false;
486				} );
487			} ); // each .penci-portfolio
488
489		}	// end if isotope & portfolio
490	}
491
492	/* Gallery
493	 ----------------------------------------------------------------*/
494	PENCI.gallery = function () {
495		var $justified_gallery = $( '.penci-post-gallery-container.justified' );
496		var $masonry_gallery = $( '.penci-post-gallery-container.masonry' );
497		if ( $().justifiedGallery && $justified_gallery.length ) {
498			$( '.penci-post-gallery-container.justified' ).each( function () {
499				var $this = $( this );
500				$this.justifiedGallery( {
501					rowHeight: $this.data( 'height' ),
502					lastRow  : 'nojustify',
503					margins  : $this.data( 'margin' ),
504					randomize: false
505				} );
506			} ); // each .penci-post-gallery-container
507		}
508
509		if ( $().isotope && $masonry_gallery.length ) {
510
511			$('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () {
512				var $this = $(this);
513				if ($this.attr('title')) {
514					var $title = $this.attr('title');
515					$this.children().append('<div class="caption">' + $title + '</div>');
516				}
517			});
518		}
519
520		$(window).load(function() {
521			if ( $masonry_gallery.length ) {
522				$masonry_gallery.each( function () {
523					var $this = $( this );
524					// initialize isotope
525					$this.isotope( {
526						itemSelector      : '.item-gallery-masonry',
527						transitionDuration: '.55s',
528						layoutMode        : 'masonry'
529					} );
530
531					$this.addClass( 'loaded' );
532
533					$('.penci-post-gallery-container.masonry .item-gallery-masonry').each( function () {
534						var $this = $( this );
535						$this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) {
536							$this.addClass( 'animated' );
537						} ); // inview
538					} ); // each
539
540				} );
541			}
542		});
543	}
544
545
546	/* Init functions
547	 ---------------------------------------------------------------*/
548	$(document).ready(function() {
549		PENCI.general();
550		PENCI.main_sticky();
551		PENCI.fixheadline();
552		PENCI.featured_slider();
553		PENCI.owl_slider();
554		PENCI.fitvids();
555		PENCI.sticky_sidebar();
556		PENCI.mega_menu();
557		PENCI.mobile_menu();
558		PENCI.lightbox();
559		PENCI.masonry();
560		PENCI.video_background();
561		PENCI.portfolio();
562		PENCI.gallery();
563		$(window ).resize( function(){ PENCI.sticky_sidebar(); } );
564	});
565
566})(jQuery);	// EOF

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.