PageSourceSearch

https://arshadrishti.org/wp-content/themes/mantra/resources/js/frontend.js?ver=3.2.0

js arshadrishti.org collected 2026-10-03 00:51:32 UTC 7,112 bytes, 190 lines download raw bytes

1/******************************
2    Mantra Theme
3    custom scripting
4    (c) Cryout Creations
5    www.cryoutcreations.eu
6*******************************/
7
8
9jQuery(document).ready(function() {
10
11/* Standard menu touch support for tablets */
12var custom_event = ('ontouchstart' in window) ? 'touchstart' : 'click'; /* check touch support */
13var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
14	jQuery('#access .menu > ul > li a').on('click', function(e){
15		var $link_id = jQuery(this).attr('href');
16		if (jQuery(this).parent().data('clicked') == $link_id) { /* second touch */
17			jQuery(this).parent().data('clicked', null);
18		}
19		else { /* first touch */
20			if (custom_event != 'click' && !ios && (jQuery(this).parent().children('ul').length >0)) {e.preventDefault();}
21			jQuery(this).parent().data('clicked', $link_id);
22		}
23	});
24
25/* Back to top button animation */
26jQuery(function() {
27	jQuery(window).scroll(function() {
28		var x=jQuery(this).scrollTop();
29
30		if(x != 0) {
31				jQuery('#toTop').addClass('showtop')
32			} else {
33				jQuery('#toTop').removeClass('showtop');
34			}
35
36	});
37	jQuery('#toTop').click(function() { jQuery('body,html').animate({scrollTop:0},800); });
38});
39
40
41/* Menu animation */
42jQuery("#access ul ul").css({display: "none"}); /* Opera Fix */
43jQuery("#access").removeClass("jssafe"); /* JS failsafe */
44jQuery("#access .menu ul li").hoverIntent({
45	over: function(){jQuery(this).children("ul").fadeIn(300);},
46	out: function(){ jQuery(this).children('ul').fadeOut();},
47	timeout:300}
48);
49
50
51/* detect and apply custom class for safari */
52if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
53	jQuery('body').addClass('safari');
54}
55
56/* Add custom borders to images */
57jQuery("img.alignnone, img.alignleft, img.aligncenter,  img.alignright").addClass(mantra_options.image_class);
58
59
60});
61/* end document.ready */
62
63/* Mobile Menu v2 */
64function mantra_mobilemenu_init() {
65	var state = false;
66	jQuery("#nav-toggle").click(function(){
67		jQuery("#access").slideToggle(function(){ if (state) {jQuery(this).removeAttr( 'style' )}; state = ! state; } );
68	});
69}
70
71jQuery(window).load(function() {
72	mantra_mobilemenu_init();
73});
74
75/* Columns equalizer, used if at least one sidebar has a bg color */
76function equalizeHeights(){
77    var h1 = jQuery("#primary").height();
78	var h2 = jQuery("#secondary").height();
79	var h3 = jQuery("#content").height();
80    var max = Math.max(h1,h2,h3);
81	if (h1<max) { jQuery("#primary").height(max); };
82	if (h2<max) { jQuery("#secondary").height(max); };
83}
84
85function makeDoubleDelegate(function1, function2) {
86// concatenate functions
87    return function() { if (function1) function1(); if (function2) function2(); }
88}
89
90function mantra_onload() {
91	if ( mantra_options.responsive == 1 ) {
92		/* Add responsive videos */
93		if (jQuery(window).width() < 800) jQuery(".entry-content").fitVids();
94	}
95	if ( mantra_options.equalizesidebars = 1 ) {
96		/* Check if sidebars have user colors and if so equalize their heights */
97		equalizeHeights();
98	}
99}; // mantra_onload
100
101// make sure not to lose previous onload events
102window.onload = makeDoubleDelegate(window.onload, mantra_onload );
103
104/*!
105* FitVids 1.0
106*
107* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
108* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
109* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
110*
111* Date: Thu Sept 01 18:00:00 2011 -0500
112*/
113
114(function( $ ){
115
116  $.fn.fitVids = function( options ) {
117    var settings = {
118      customSelector: null
119    }
120
121    var div = document.createElement('div'),
122        ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
123
124   div.className = 'fit-vids-style';
125    div.innerHTML = '&shy;<style> .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%; } </style>';
126
127    ref.parentNode.insertBefore(div,ref);
128
129    if ( options ) {
130      $.extend( settings, options );
131    }
132
133    return this.each(function(){
134      var selectors = [
135        "iframe[src*='player.vimeo.com']",
136        "iframe[src*='www.youtube.com']",
137        "iframe[src*='www.kickstarter.com']",
138        "object",
139        "embed"
140      ];
141
142      if (settings.customSelector) {
143        selectors.push(settings.customSelector);
144      }
145
146      var $allVideos = $(this).find(selectors.join(','));
147
148      $allVideos.each(function(){
149        var $this = $(this);
150        if (this.tagName.toLowerCase() == 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
151        var height = this.tagName.toLowerCase() == 'object' ? $this.attr('height') : $this.height(),
152            aspectRatio = height / $this.width();
153			if(!$this.attr('id')){
154				var videoID = 'fitvid' + Math.floor(Math.random()*999999);
155				$this.attr('id', videoID);
156			}
157        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
158        $this.removeAttr('height').removeAttr('width');
159      });
160    });
161
162  }
163}
163)( jQuery );
164
165
166/*!
167 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
168 * http://cherne.net/brian/resources/jquery.hoverIntent.html
169 *
170 * You may use hoverIntent under the terms of the MIT license.
171 * Copyright 2007, 2013 Brian Cherne
172 */
173(function(e){e.fn.hoverIntent=function(t,n,r){var i={interval:100,sensitivity:7,timeout:0};if(typeof t==="object"){i=e.extend(i,t)}else if(e.isFunction(n)){i=e.extend(i,{over:t,out:n,selector:r})}else{i=e.extend(i,{over:t,out:t,selector:n})}var s,o,u,a;var f=function(e){s=e.pageX;o=e.pageY};var l=function(t,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if(Math.abs(u-s)+Math.abs(a-o)<i.sensitivity){e(n).off("mousemove.hoverIntent",f);n.hoverIntent_s=1;return i.over.apply(n,[t])}else{u=s;a=o;n.hoverIntent_t=setTimeout(function(){l(t,n)},i.interval)}};var c=function(e,t){t.hoverIntent_t=clearTimeout(t.hoverIntent_t);t.hoverIntent_s=0;return i.out.apply(t,[e])};var h=function(t){var n=jQuery.extend({},t);var r=this;if(r.hoverIntent_t){r.hoverIntent_t=clearTimeout(r.hoverIntent_t)}if(t.type=="mouseenter"){u=n.pageX;a=n.pageY;e(r).on("mousemove.hoverIntent",f);if(r.hoverIntent_s!=1){r.hoverIntent_t=setTimeout(function(){l(n,r)},i.interval)}}else{e(r).off("mousemove.hoverIntent",f);if(r.hoverIntent_s==1){r.hoverIntent_t=setTimeout(function(){c(n,r)},i.timeout)}}};return this.on({"mouseenter.hoverIntent":h,"mouseleave.hoverIntent":h},i.selector)}})(jQuery)
174
175
176/* Returns the version of Internet Explorer or a -1
177 * (indicating the use of another browser).
178 */
179function getInternetExplorerVersion()
180{
181  var rv = -1; /* Return value assumes failure. */
182  if (navigator.appName == 'Microsoft Internet Explorer')
183  {
184    var ua = navigator.userAgent;
185    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
186    if (re.exec(ua) != null)
187      rv = parseFloat( RegExp.$1 );
188  }
189  return rv;
190}

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.