PageSourceSearch

https://wro.org/wp-content/themes/parabola/js/frontend.js?ver=2.4.3

js wro.org collected 2026-09-24 23:03:05 UTC 7,991 bytes, 227 lines download raw bytes

1/*
2 * Parabola theme frontend.js
3 */
4 
5jQuery(document).ready(function() {
6
7	/* Masonry */
8	parabola_activateMasonry();
9
10	/* Standard menu touch support for tablets */
11	var custom_event = ('ontouchstart' in window) ? 'touchstart' : 'click'; /* check touch support */
12	var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
13	jQuery( '#access .menu > ul > li a' ).on( 'click', function(e){
14			var link_id = jQuery(this).attr('href');
15			if (jQuery(this).closest('#access').data('clicked') == link_id) { 
16				/* second touch */
17				jQuery(this).closest('#access').data('clicked', null);
18			} else {
19				/* first touch */
20				if (custom_event != 'click' && !ios && (jQuery(this).parent().children('ul').length >0)) { e.preventDefault(); }
21				jQuery(this).closest('#access').data('clicked', link_id);
22				jQuery(this).next('.sub-menu').slideDown();
23			}
24		});
25
26	/* Back to top button animation */
27	jQuery(function() {
28		jQuery(window).on('scroll', function() {
29			var x=jQuery(this).scrollTop();
30			var ver = getInternetExplorerVersion();
31			/* no fade animation (transparency) if IE8 or below */
32			if ( ver > -1 && ver <= 8 ) {
33				if(x != 0) {
34						jQuery('#toTop').show();
35					} else {
36						jQuery('#toTop').hide();
37					}
38			}
39			/* fade animation if not IE8 or below */
40			else {
41			if(x != 0) {
42					jQuery('#toTop').fadeIn(3000);
43				} else {
44					jQuery('#toTop').fadeOut();
45				}
46		}
47		});
48		jQuery('#toTop').on('click', function() { jQuery('body,html').animate({scrollTop:0},800); });
49	});
50
51	/* Menu animation */
52	jQuery("#access > div > ul > li").on( 'mouseenter', function(){
53		if (jQuery(this).find('ul').length > 0) jQuery("#access > div > ul > li > ul").hide();
54	});
55
56	jQuery("#access ul ul").css({display: "none"}); /* Opera Fix */
57	jQuery("#access > .menu ul li > a:not(:only-child)").attr("aria-haspopup","true"); /* IE10 mobile Fix */
58
59	jQuery("#access li").on( 'mouseenter', function(){
60		jQuery(this).find('ul:first').stop();
61		jQuery(this).find('ul:first').css({opacity: "0"}).css({visibility: "visible",display: "none",overflow:"visible"}).slideDown({duration:400}).animate({"opacity":1},{queue:false});
62	}).on( 'mouseleave', function(){
63		jQuery(this).find('ul:first').css({visibility: "visible",display: "block",overflow:"visible"}).slideUp(150);
64	});
65
66	/* Social Icons Animation */
67	jQuery(".socialicons").append('<div class="socials-hover"></div>');
68	jQuery(".socialicons").on('mouseenter', function(){
69			jQuery(this).find(".socials-hover").animate({"bottom":"0"},{queue:false,duration:150});
70		}).on('mouseleave', function() {
71			jQuery(this).find(".socials-hover").animate({"bottom":"100%"},{queue:false,duration:150, complete: function() {
72				jQuery(this).css({bottom:"-100%"});
73				}
74			});
75		}
76	);
77
78	/* Detect and apply custom class for Safari */
79	if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
80		jQuery('body').addClass('safari');
81	}
82
83});
84/* end document.ready */
85
86/* Masonry init, called on both ready and window.load */
87function parabola_activateMasonry(){ 
88	if ( (parabola_settings.masonry==1) && ( typeof jQuery.fn.masonry !== 'undefined' )) {
89			jQuery('body.magazine-layout .content-masonry').masonry({
90				itemSelector: 'article',
91				columnWidth: 'article',
92				percentPosition: true,
93			});
94		}
95}
96
97/* Mobile Menu v2 */
98function parabola_mobilemenu_init() {
99	var state = false;
100	jQuery("#nav-toggle").on('click', function(){
101		jQuery("#access").slideToggle(function(){ if (state) {jQuery(this).removeAttr( 'style' )}; state = ! state; } );
102	});
103}
104
105/* Columns equalizer, used if at least one sidebar has a bg color */
106function parabola_equalizeHeights(){
107    var h1 = jQuery("#primary").height();
108	var h2 = jQuery("#secondary").height();
109	var h3 = jQuery("#content").height();
110    var max = Math.max(h1,h2,h3);
111	if (h1<max) { jQuery("#primary").height(max); };
112	if (h2<max) { jQuery("#secondary").height(max); };
113}
114
115jQuery(window).on('load', function() {
116	/* FitVids & mobile menu */
117	if (parabola_settings.mobile==1) parabola_mobilemenu_init();
118	if (parabola_settings.fitvids==1) jQuery(".entry-content").fitVids();
119	
120	/* Second Masonry, in case elements expand size due to dynamic content; keep after FitVids */
121	parabola_activateMasonry();
122});
123
124/*!
125* FitVids 1.1
126*
127* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
128* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
129* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
130*
131*/
132
133;(function( $ ){
134
135  'use strict';
136
137  $.fn.fitVids = function( options ) {
138    var settings = {
139      customSelector: null,
140      ignore: null
141    };
142
143    if(!document.getElementById('fit-vids-style')) {
144      // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
145      var head = document.head || document.getElementsByTagName('head')[0];
146      var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
147      var div = document.createElement("div");
148      div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
149      head.appendChild(div.childNodes[1]);
150    }
151
152    if ( options ) {
153      $.extend( settings, options );
154    }
155
156    return this.each(function(){
157      var selectors = [
158        'iframe[src*="player.vimeo.com"]',
159        'iframe[src*="youtube.com"]',
160        'iframe[src*="youtube-nocookie.com"]',
161        'iframe[src*="kickstarter.com"][src*="video.html"]',
162        'object',
163        'embed'
164      ];
165
166      if (settings.customSelector) {
167        selectors.push(settings.customSelector);
168      }
169
170      var ignoreList = '.fitvidsignore';
171
172      if(settings.ignore) {
173        ignoreList = ignoreList + ', ' + settings.ignore;
174      }
175
176      var $allVideos = $(this).find(selectors.join(','));
177      $allVideos = $allVideos.not('object object'); // SwfObj conflict patch
178      $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
179
180      $allVideos.each(function(){
181        var $this = $(this);
182        if($this.parents(ignoreList).length > 0) {
183          return; // Disable FitVids on this video.
184        }
185        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
186        if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
187        {
188          $this.attr('height', 9);
189          $this.attr('width', 16);
190        }
191        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
192            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
193            aspectRatio = height / width;
194        if(!$this.attr('name')){
195          var videoName = 'fitvid' + $.fn.fitVids._count;
196          $this.attr('name', videoName);
197          $.fn.fitVids._count++;
198        }
199        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
200        $this.removeAttr('height').removeAttr('width');
201      });
202    });
203  };
204  
205  // Internal counter for unique video names.
206  $.fn.fitVids._count = 0;
207  
208// Works with either jQuery or Zepto
209})( window.jQuery || window.Zepto );
210
211
212/* Returns the version of Internet Explorer or a -1
213  (indicating the use of another browser). */
214function getInternetExplorerVersion()
215{
216  var rv = -1; /* assume not IE. */
217  if (navigator.appName == 'Microsoft Internet Explorer')
218  {
219    var ua = navigator.userAgent;
220    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
221    if (re.exec(ua) != null)
222      rv = parseFloat( RegExp.$1 );
223  }
224  return rv;
225}
226
227/* FIN */

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.