PageSourceSearch

https://masontransit.org/wp-content/themes/nirvana/js/frontend.js?ver=1.4.6

js masontransit.org collected 2026-10-02 18:23:42 UTC 7,607 bytes, 225 lines download raw bytes

1/*
2 * Nirvana Theme custom frontend scripting
3 * http://www.cryoutcreations.eu/
4 *
5 * Copyright 2014, Cryout Creations
6 * Free to use and abuse under the GPL v3 license.
7 */
8
9jQuery(document).ready(function() {
10
11	// responsiveness check
12	if (nirvana_settings['mobile'] == 1) {
13		nirvana_mobilemenu_init();
14
15		if (nirvana_settings['fitvids'] == 1) jQuery(".entry-content").fitVids();
16	};
17
18	/* Standard menu touch support for tablets */
19	var custom_event = ('ontouchstart' in window) ? 'touchstart' : 'click'; // check touch support
20	var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
21		jQuery('#access .menu > ul > li a').on('click', function(e){
22			var $link_id = jQuery(this).attr('href');
23			if (jQuery(this).parent().data('clicked') == $link_id) { // second touch
24				jQuery(this).parent().data('clicked', null);
25			}
26			else { // first touch
27				if (custom_event != 'click' && !ios && (jQuery(this).parent().children('ul').length >0)) {e.preventDefault();}
28				jQuery(this).parent().data('clicked', $link_id);
29			}
30		});
31
32	/* Menu animation */
33	jQuery("#access ul ul").css({display: "none"}); /* Opera Fix */
34	jQuery("#access > .menu ul li > a:not(:only-child)").attr("aria-haspopup","true");/* IE10 mobile Fix */
35
36	jQuery("#access li").hover(function(){
37		jQuery(this).find('ul:first').stop();
38		jQuery(this).find('ul:first').css({opacity: "0",marginLeft:"50px"}).css({visibility: "visible",display: "block",overflow:"visible"}).animate({"opacity":"1",marginLeft:"-=50"},{queue:false});
39	},function(){
40		jQuery(this).find('ul:first').css({visibility: "visible",display: "block",overflow:"visible"}).animate({marginLeft:"-=50"}, {queue:false}).fadeOut();
41	});
42
43	/* Back to top button animation */
44	var offset = 500;
45	var duration = 500;
46	jQuery(window).scroll(function() {
47		if (jQuery(this).scrollTop() > offset) {
48			jQuery('#toTop').css({'bottom':'20px','opacity':1});
49		}
50		else {
51			jQuery('#toTop').css({'bottom':'-50px','opacity':0});
52		}
53	});
54
55    jQuery('#toTop').click(function(event) {
56        event.preventDefault();
57        jQuery('html, body').animate({scrollTop: 0}, duration);
58        return false;
59    });
60
61	/* Social Icons Animation */
62	jQuery(".socialicons").append('<div class="socials-hover"></div>');
63	var i=0;
64	/* Top bar search animation */
65	jQuery(".menu-header-search i.search-icon").click(function(event){
66		i++;
67		jQuery(this).animate({marginTop: "43px"}, 200);
68		jQuery(".menu-header-search .searchform").css('display','block').animate({opacity: "1"}, 200);
69		jQuery(".menu-header-search .s").focus();
70		if(i==2) {
71			jQuery(".menu-header-search .searchsubmit").click();
72		}
73		event.stopPropagation();
74	});
75
76	jQuery(".menu-header-search .searchform").click(function(event){
77		event.stopPropagation();
78	});
79
80	jQuery('html').click(function() {
81		i=0;
82		jQuery(".menu-header-search i.search-icon").animate({marginTop: "0px"}, 200);
83		jQuery(".menu-header-search .searchform").hide();
84	});
85
86
87	/* Detect and apply custom class for Safari */
88	if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
89		jQuery('body').addClass('safari');
90	}
91
92});
93/* end document.ready */
94
95
96/* Mobile Menu */
97function nirvana_mobilemenu_init() {
98	var state = false;
99	jQuery("#nav-toggle").click(function(){
100		jQuery("#access").slideToggle(function(){ if (state) {jQuery(this).removeAttr( 'style' )}; state = ! state; } );
101	});
102}
103
104/* Columns equalizer, used if at least one sidebar has a bg color */
105function equalizeHeights(){
106    var h1 = jQuery("#primary").height();
107	var h2 = jQuery("#secondary").height();
108	var h3 = jQuery("#content").height();
109    var max = Math.max(h1,h2,h3);
110	if (h1<max) { jQuery("#primary").height(max); };
111	if (h2<max) { jQuery("#secondary").height(max); };
112}
113
114/*!
115* FitVids 1.0
116*
117* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
118* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
119* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
120*
121* Date: Thu Sept 01 18:00:00 2011 -0500
122*/
123
124(function( $ ){
125  "use strict";
126  $.fn.fitVids = function( options ) {
127    var settings = {
128      customSelector: null
129    };
130
131    if(!document.getElementById('fit-vids-style')) {
132      var div = document.createElement('div'),
133          ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
134      div.className = 'fit-vids-style';
135      div.id = 'fit-vids-style';
136      div.style.display = 'none';
137      div.innerHTML = '&shy;<style> .nirvana-width-video-wrapper { width: 100%; position: relative; padding: 0; } .nirvana-width-video-wrapper iframe, .nirvana-width-video-wrapper object, .nirvana-width-video-wrapper embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>';
138
139      ref.parentNode.insertBefore(div,ref);
140    }
141
142    if ( options ) {
143      $.extend( settings, options );
144    }
145
146    return this.each(function(){
147      var selectors = [
148        "iframe[src*='player.vimeo.com']",
149        "iframe[src*='youtube.com']",
150        "iframe[src*='youtube-nocookie.com']",
151        "iframe[src*='kickstarter.com'][src*='video.html']",
152        "object",
153        "embed"
154      ];
155
156      if (settings.customSelector) {
157        selectors.push(settings.customSelector);
158      }
159
160      var $allVideos = $(this).find(selectors.join(','));
161      $allVideos = $allVideos.not("object object");
161 /* SwfObj conflict patch */
162
163      $allVideos.each(function(){
164        var $this = $(this);
165        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.nirvana-width-video-wrapper').length) { return; }
166        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
167            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
168            aspectRatio = height / width;
169		if ( width<cryout_global_content_width ) { return; } /* hack to not resize small objects */
170        if(!$this.attr('id')){
171          var videoID = 'fitvid' + Math.floor(Math.random()*999999);
172          $this.attr('id', videoID);
173        }
174        $this.wrap('<div class="nirvana-width-video-wrapper"></div>').parent('.nirvana-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
175        $this.removeAttr('height').removeAttr('width');
176      });
177    });
178  };
179})( jQuery );
180
181
182/* Returns the version of Internet Explorer or a -1
183  (indicating the use of another browser). */
184function getInternetExplorerVersion()
185{
186  var rv = -1; /* assume not IE. */
187  if (navigator.appName == 'Microsoft Internet Explorer')
188  {
189    var ua = navigator.userAgent;
190    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
191    if (re.exec(ua) != null)
192      rv = parseFloat( RegExp.$1 );
193  }
194  return rv;
195}
196
197jQuery(document).ready(function() {
198	if(jQuery(window).width() < 767){
199		jQuery("a#nav-toggle span").after('<span></span><span></span>');
200
201		jQuery( "table" ).wrap( "<div class='table-responsive'></div>" );
202
203		jQuery("a#nav-toggle span").click(function(){
204	         jQuery("nav#access").slideToggle(250);
205	         jQuery("a#nav-toggle span").toggleClass("active");
206		});
207
208        jQuery("button.searchsubmit i.crycon-search").clone().appendTo("li#search-3");
209
210		jQuery("li#search-3 > i.crycon-search").click(function(){
211	         jQuery("form.searchform").slideToggle(250); 
212		});
213	}
214
215	 
216});
217
218jQuery(document).ready(function(){
219  jQuery('.social_media a').attr('target', '_blank');
220});
221
222
223
224
225

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.