PageSourceSearch

https://16superpoteri.com/js/main.js

js 16superpoteri.com collected 2026-10-09 05:14:45 UTC 18,846 bytes, 700 lines download raw bytes

1/*
2	Name: Read
3	Description: Responsive HTML5 Template
4	Version: 1.0
5	Author: pixelwars
6*/
7
8
9(function ($) {
10
11	/* DOCUMENT LOAD */
12	$(function() {
13		
14		
15			
16		//**********************************
17		//NAV MENU
18		$('.main-navigation li').hover(function() {
19			var subMenu = $(this).find('ul:first');
20			$(this).siblings().find('a').removeClass("selected");
21			//if has sub menu
22			if(subMenu.length) {
23				$(this).find('a').eq(0).addClass("selected");
24				subMenu.show();
25			}
26		}, function(e) {  //hover out
27			var subMenu = $(this).find('ul:first');
28			subMenu.hide();
29			$(this).find('a').eq(0).removeClass("selected");
30		});
31		//NAV MENU
32		//**********************************
33		
34		
35		//**********************************
36		// prepeare mobile search form 
37		var searchForm = $('.main-navigation li:last').clone();
38		searchForm.find('form').attr('id','search-form-mobile');
39		searchForm.find('#search').attr('id','search-mobile-input').attr('placeholder',searchForm.find('label').text());
40		searchForm.find('#search-submit').attr('id','search-mobile-submit');
41		searchForm.find('label').remove();
42		$('body').prepend('<div class="search-mobile">'+ searchForm.html() + '</div>');
43		//**********************************
44		
45		
46		// MOBIL NAV MENU - SELECT LIST
47		//**********************************
48		/* Clone our navigation */
49		var mainNavigation = $('.main-navigation > ul').clone();
50		
51		/* Replace unordered list with a "select" element to be populated with options, and create a variable to select our new empty option menu */
52		$('.main-navigation').prepend('<select class="menu"></select>');
53		var selectMenu = $('select.menu');
54		$(selectMenu).append('<option value="null">'+"MENU"+'</option>');
55		
56		/* Navigate our nav clone for information needed to populate options */
57		$(mainNavigation).children('li').each(function() {
58		
59			 /* menu - LEVEL 1 */
60			 $(selectMenu).append(generateSelectLink($(this), ''));
61			
62			 /* menu - LEVEL 2 */
63			 if ($(this).children('ul').length > 0) {
64					$(this).children('ul').children('li').each(function() {
65			
66					/* Append this option to our "select" */
67					$(selectMenu).append(generateSelectLink($(this), ' » '));
68				   
69				   /* menu - LEVEL 3 */
70				   if ($(this).children('ul').length > 0) {
71						$(this).children('ul').children('li').each(function() {
72					
73						   /* Append this option to our "select" */
74						   $(selectMenu).append(generateSelectLink($(this), ' »» '));
75						   
76						   
77						   /* menu - LEVEL 4 */
78						   if ($(this).children('ul').length > 0) {
79								$(this).children('ul').children('li').each(function() {
80							
81								   /* Append this option to our "select" */
82								   $(selectMenu).append(generateSelectLink($(this), ' »»» '));
83								   
84								});
85							 }
86						   
87						});
88					 }
89				   
90				});
91			 }
92		});
93		
94		function generateSelectLink(li, prefix) {
95			var navLink = li.children('a'); 
96			if(navLink.length) {
97				return '<option value="' + navLink.attr('href') + '"> ' + prefix + navLink.text() + '</option>';
98			}
99			var sForm = li.children('form');
100			if(sForm.length) {
101				return '<option value="search"> ' + sForm.find('label').text() + '</option>';
102			}
103		}
104		
105		/* When our select menu is changed, change the window location to match the value of the selected option. */
106		$(selectMenu).change(function() {
107			
108				var url = this.options[this.selectedIndex].value;
109				if(url == 'search') {
110					$('.search-mobile').slideDown().find('#search-mobile-input').focus();
111				} else if (url != "null") {
112					location = this.options[this.selectedIndex].value; 
113				}
114		});
115		//**********************************
116		
117		
118		//**********************************
119		// mobile search focus out
120		$('#search-mobile-input').focusout(function() {
121			$('.search-mobile').slideUp();
122			$("select.menu").val('null').trigger('click');
123		});
124		//**********************************
125		
126		
127		
128		//**********************************
129		// SEARCH BOX
130		$("#search-form #search").focus(function () {
131			 $(this).stop().animate({ width:140 }).siblings('label').stop(true,true).fadeOut(400);
132		}).blur(function() {
133		  $(this).stop().animate({ width:50 });
134		  if($(this).val() == "") {
135			$(this).siblings('label').stop(true,true).fadeIn(400);
136		  }
137		});
138		//**********************************
139		
140		
141		//**********************************
142		// WP FIX - searchbox
143		$("#searchform #s").attr('placeholder','Enter keyword...');
144		
145		//button with icons
146		$('input[type=submit], input[type=button], button, a.button').each(function(index, element) {
147			if($(this).find('i').length) {
148				$(this).addClass('icon-button');	
149			}
150		});
151		//**********************************
152		
153		
154		//**********************************
155		// CODE PRETTIFY
156		if($('.prettyprint').length) {
157			window.prettyPrint && prettyPrint();
158		}
159		//**********************************
160		
161		
162		
163		
164		//**********************************
165		// UNIFORM
166		//if(!window.location.href.includes(debug=true))
167		//$("select:not([multiple]), input:checkbox, input:radio, input:file").uniform();
168		var ua = navigator.userAgent.toLowerCase();
169		var isAndroid = ua.indexOf("android") > -1;
170		if(isAndroid) {
171			$('html').addClass('android');
172		}
173		//**********************************
174		
175		
176		
177		
178		//**********************************
179		// TABS
180		$('.tabs').each(function() {
181			if(!$(this).find('.tab-titles li a.active').length) {
182				$(this).find('.tab-titles li:first-child a').addClass('active');
183				$(this).find('.tab-content > div:first-child').show();
184			} else {
185				$(this).find('.tab-content > div').eq($(this).find('.tab-titles li a.active').parent().index()).show();	
186			}
187		});
188		
189		$('.tabs .tab-titles li a').click(function() {
190			if($(this).hasClass('active')) { return; }
191			$(this).parent().siblings().find('a').removeClass('active');
192			$(this).addClass('active');
193			$(this).parents('.tabs').find('.tab-content > div').hide().eq($(this).parent().index()).show();
194			return false;
195			});
196		//**********************************
197		
198		
199		//**********************************
200		// TOGGLES
201		var toggleSpeed = 300;
202		$('.toggle h4.active + .toggle-content').show();
203	
204		$('.toggle h4').click(function() {
205			if($(this).hasClass('active')) { 
206				$(this).removeClass('active');
207				$(this).next('.toggle-content').stop(true,true).slideUp(toggleSpeed);
208			} else {
209				
210				$(this).addClass('active');
211				$(this).next('.toggle-content').stop(true,true).slideDown(toggleSpeed);
212				
213				//accordion
214				if($(this).parents('.toggle-group').hasClass('accordion')) {
215					$(this).parent().siblings().find('h4').removeClass('active');
216					$(this).parent().siblings().find('.toggle-content').stop(true,true).slideUp(toggleSpeed);
217				}
218				
219			}
220			return false;
221			});
222		//**********************************
223		
224		
225		
226		
227		//**********************************
228		// RESPONSIVE VIDEOS
229		//$(".media-wrap").fitVids();
230		//**********************************
231		
232		
233		
234		//**********************************
235		// PREVIEW ONLY - BUTTONS
236		$('.show-buttons a.button').click(function() { return false; });
237		//**********************************
238		
239		
240		
241	
242	
243		//**********************************
244		// PORTFOLIO FILTERING - ISOTOPE
245		// cache container
246		var $container = $('.portfolio-items');
247		if($container.length) {
248			
249			var page = 0,
250				itemPerPage = parseInt($container.attr('data-itemPerPage')),
251				result,
252				moreLink = $( '#loadmore' );
253			var url = moreLink.attr('href');
254			
255			$container.imagesLoaded(function() {
256				
257				setMasonry();
258				$(window).resize(function() {
259					setMasonry();
260				});
261				
262				// initialize isotope
263				$container.isotope({
264				  itemSelector : '.hentry',
265				  layoutMode : 'masonry'
266				});
267				
268				// fix v1.1
269				setTimeout(function() { setMasonry(); $container.isotope({ filter: "*" }); }, 0);
270				
271				// filter items when filter link is clicked
272				$('#filters a').click(function(){
273				  var selector = $(this).attr('data-filter');
274				  setMasonry();
275				  $container.isotope({ filter: selector });
276				  $(this).parent().addClass('current').siblings().removeClass('current');
277				  return false;
278				});
279				
280			});
281			
282			
283			// Get All Images via Ajax
284			if(!$container.find('.hentry').length) {
285	
286				$.get(url, function(data) {
287				  result = data;
288				  
289				  addItems();
290				  
291				  ++page;
292				  handleMoreLink();
293				  
294				},'html');
295			} 
296			
297			// Show more images
298			moreLink.on( 'click', function() {
299				
300				moreLink.addClass('loading');
301				addItems();
302				++page;
303				handleMoreLink();
304				
305				// fix v1.1
306				setTimeout(function() { setMasonry();  }, 0);
307				
308				return false;
309			} );
310			
311			// Hide more link if there is no image left to show
312			function handleMoreLink() {
313				if(getNewItems().length == 0) {
314					moreLink.hide();	
315				}	
316			}
317			
318			// Get New Images
319			function getNewItems() {
320				var iMin = page * itemPerPage;
321				var iMax = iMin + itemPerPage;
322				
323				return iMin == 0 ? $(result).find('.portfolio-items .hentry:lt('+ itemPerPage +')') 
324									: $(result).find('.portfolio-items .hentry:gt(' + (iMin-1) +'):lt('+ itemPerPage +')');
325			}
326			
327			function addItems() {
328				var newItems = getNewItems();
329				  newItems.imagesLoaded(function() { 
330					$container.removeClass('loading').isotope( 'insert', newItems );
331					setupLigtbox();
332					setMasonry();
333					setTimeout( function() { moreLink.removeClass('loading'); }, 1000);
334				  });	
335			}
336			
337		} // if($container.length)
338		
339		
340		// change the number of masonry columns based on the current container's width
341		function setMasonry() {
342			
343			var containerW = $container.width();
344			var items = $container.children('.hentry');
345			var columns, columnWidth;
346			var viewports = [ {
347					width : 1200,
348					columns : 5
349				}, {
350					width : 900,
351					columns : 4
352				}, {
353					width : 500,
354					columns : 3
355				}, { 
356					width : 320,
357					columns : 2
358				}, { 
359					width : 0,
360					columns : 2
361				} ];
362	
363			for( var i = 0, len = viewports.length; i < len; ++i ) {
364	
365				var viewport = viewports[i];
366	
367				if( containerW > viewport.width ) {
368	
369					columns = viewport.columns;
370					break;
371	
372				}
373			}
374	
375			// set the widths (%) for each of item
376			items.each(function(index, element) {
377				var multiplier = $(this).hasClass('x2') ? 2 : 1;
378				var itemWidth = (Math.floor( containerW / columns ) * 100 / containerW) * multiplier ;
379				$(this).css( 'width', itemWidth + '%' );
380			});
381			if($container.isotope()) {
382					columnWidth = Math.floor( containerW / columns );
383					$container.isotope( 'reLayout' ).isotope( 'option', { masonry: { columnWidth: columnWidth } } );
384				}
385	
386		} // setMasonry
387		
388		//**********************************
389		
390		
391		
392		
393		
394		
395		//**********************************
396		/* Gamma Gallery */
397		var gammaGallery = $('.gamma-gallery');
398		if(gammaGallery.length) {
399			
400			var g_page = 0,
401				g_itemPerPage = parseInt(gammaGallery.attr('data-itemPerPage')),
402				g_result,
403				g_moreLink = $( '#loadmore' );
404			var g_url = g_moreLink.attr('href');
405			
406			var GammaSettings = {
407				interval : parseInt(gammaGallery.attr('data-slideshowInterval')),
408				circular : gammaGallery.attr('data-circular') != "false",
409				nextOnClickImage : gammaGallery.attr('data-nextOnClickImage') != "false",
410				// order is important!
411				viewport : [ {
412					width : 1200,
413					columns : 5
414				}, {
415					width : 900,
416					columns : 4
417				}, {
418					width : 500,
419					columns : 3
420				}, { 
421					width : 320,
422					columns : 2
423				}, { 
424					width : 0,
425					columns : 2
426				} ]
427			};
428			
429			
430			// Get All Images via Ajax
431			if(!gammaGallery.find('li').length) {
432				
433				$.get(g_url, function(data) {
434				  g_result = data;
435				  
436				  gammaGallery.html(getNewImages());
437				  ++g_page;
438				  g_handleMoreLink();
439				  Gamma.init( GammaSettings );
440				},'html');
441			} else {
442				Gamma.init( GammaSettings ); 
443			}
444			
445			
446			// Show more images
447			g_moreLink.on( 'click', function() {
448				g_moreLink.addClass('loading');
449				Gamma.add( getNewImages(), function() {
450					setTimeout( function() { g_moreLink.removeClass('loading'); }, 1000);
451					} );
452				g_page++;
453				g_handleMoreLink();
454				return false;
455			} );
456			
457			// Hide more link if there is no image left to show
458			function g_handleMoreLink() {
459				if(getNewImages().length == 0) {
460					g_moreLink.hide();	
461				}	
462			}
463			
464			// Get New Images
465			function getNewImages() {
466				var iMin = g_page * g_itemPerPage;
467				var iMax = iMin + g_itemPerPage;
468				return iMin == 0 ? $(g_result).find('.gamma-gallery li:lt('+ g_itemPerPage +')') 
469									: $(g_result).find('.gamma-gallery li:gt(' + (iMin-1) +'):lt('+ g_itemPerPage +')');
470			}
471		
472		}//if .gamma-gallery.length
473		//**********************************
474		
475		
476		
477		
478		// LIGHTBOX
479		//**********************************
480		setupLigtbox();
481		//**********************************
482		
483		
484		// SHARE LINKS
485		//**********************************
486		$('.share-links').hover(function() {
487			$(this).find('.share-wrap').show();
488			});
489				
490		$('body, body *').click(function (e) {
491			  if ($(e.target).is('.share-links *')) return;
492			  $('.share-links').find('.share-wrap').hide();
493		});	
494		//**********************************
495		
496		
497		
498		
499		
500		//**********************************
501		// BLOG MASONRY
502		// cache container
503		var blogAnimEngine = $.browser.mozilla && $.browser.version > '2' ? "jquery" : "best-available";
504		var $containerBlog = $('.blog-masonry');
505		if($containerBlog.length) {
506			
507			$containerBlog.imagesLoaded(function() {
508				
509				setMasonryBlog();
510				$(window).resize(function() {
511					setMasonryBlog();
512				});
513				
514				// initialize isotope
515				$containerBlog.isotope({
516				  itemSelector : '.hentry',
517				  layoutMode : 'masonry',
518				  animationEngine : blogAnimEngine
519				});
520				
521				setTimeout(function() { setMasonryBlog(); }, 1000);
522			
523			});
524			
525		} // if($container.length)
526		
527		
528		// change the number of masonry columns based on the current container's width
529		function setMasonryBlog() {
530			
531			var containerW = $containerBlog.width();
532			var items = $containerBlog.children('.hentry');
533			var columns, columnWidth;
534			var viewports = [ {
535					width : 1900,
536					columns : 5
537				}, {
538					width : 1200,
539					columns : 4
540				}, {
541					width : 768,
542					columns : 3
543				}, { 
544					width : 480,
545					columns : 2
546				}, { 
547					width : 0,
548					columns : 1
549				} ];
550	
551			for( var i = 0, len = viewports.length; i < len; ++i ) {
552	
553				var viewport = viewports[i];
554	
555				if( containerW > viewport.width ) {
556	
557					columns = viewport.columns;
558					break;
559	
560				}
561			}
562	
563			// set the widths (%) for each of item
564			items.each(function(index, element) {
565				var multiplier = $(this).hasClass('x2') ? 2 : 1;
566				var itemWidth = (Math.floor( containerW / columns ) * 100 / containerW) * multiplier ;
567				$(this).css( 'width', itemWidth + '%' );
568			});
569			if($containerBlog.isotope({ animationEngine : blogAnimEngine })) {
570					columnWidth = Math.floor( containerW / columns );
571					$containerBlog.isotope( 'reLayout' ).isotope( 'option', { masonry: { columnWidth: columnWidth } } );
572				}
573	
574		} // setMasonry
575		
576		//**********************************
577		
578		
579		
580		
581		
582		//**********************************
583		/* FLEX SLIDER */
584		// cache container
585		var $flexslider = $('.flexslider');
586		if($flexslider.length) {
587			
588			$flexslider.each(function() {
589			
590				//wait for images
591				$(this).imagesLoaded(function() {
592					
593					//remove loading
594					$(this).find('.loading').remove();
595					
596					//setup slider
597					$(this).flexslider({ 
598						smoothHeight: true,
599						slideshow: $(this).attr('data-autoplay') != "false",
600						slideshowSpeed: $(this).attr('data-interval'), 
601						animationSpeed : $(this).attr('data-animationSpeed'),
602						animation: $(this).attr('data-animation'), 
603						direction : $(this).attr('data-direction'),
604						directionNav : $(this).attr('data-directionNav') != "false",
605						controlNav : $(this).attr('data-controlNav') != "false",
606						randomize : $(this).attr('data-randomize') == "true",
607						startAt : $(this).attr('data-startAt') != null ? parseInt($(this).attr('data-startAt')) : 0,
608						animationLoop : $(this).attr('data-animationLoop') != "false",
609						pauseOnHover : $(this).attr('data-pauseOnHover') != "false",
610						reverse : $(this).attr('data-reverse') == "true",
611						prevText: "",
612						nextText: ""
613						});
614					
615				});
616			
617			});
618		}
619		//**********************************
620		
621		
622		
623		//**********************************
624		/* MEDIAELEMENT.JS - self hosted html5 video and audio player */
625		if($('video,audio').length) {
626			$('video,audio').mediaelementplayer({});	
627		}
628		//**********************************
629		
630		
631		
632		
633		//*************************************
634		// FORM VALIDATION - v1.1
635		
636		// comment form validation fix
637		$('#commentform').addClass('validate-form');
638		$('#commentform').find('input,textarea').each(function(index, element) {
639            if($(this).attr('aria-required') == "true") {
640				$(this).addClass('required');
641			}
642			if($(this).attr('name') == "email") {
643				$(this).addClass('email');
644			}
645		});
646		
647		// validate form
648		if($('.validate-form').length) {
649			$('.validate-form').each(function() {
650					$(this).validate();
651				});
652		}
653		//*************************************
654		
655		
656		//*************************************
657		// DETECT BLOG WITH SIDEBAR
658		if($('#secondary').length) {
659			$('#main > .row-fluid').addClass('blog-with-sidebar');	
660		}
661		//*************************************
662		
663		
664	});
665	/* DOCUMENT LOAD */
666	
667	
668	
669	
670	// ------------------------------
671	// LIGHTBOX
672	function setupLigtbox() {
673		
674		//html5 validate fix
675		$('.lightbox').each(function(index, element) {
676			$(this).attr('rel', $(this).attr('data-lightbox-gallery'));
677		});
678		
679		if($("a[rel^='fancybox']").length) {
680			$("a[rel^='fancybox']").fancybox({
681				centerOnScroll : true,
682				padding : 0,
683				margin : 44,
684				width : 640,
685				height : 360,
686				transitionOut : 'none',
687				overlayColor : '#000',
688				overlayOpacity : '.9',
689				onComplete : function() {
690					if ($(this).attr('href').indexOf("soundcloud.com") >= 0) {
691						$('#fancybox-content').height(166);
692					}
693				}
694			});
695		}	
696	}
697	// ------------------------------	
698	
699	
700})(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.