PageSourceSearch

https://mpbirlaplanetarium.org/wp-content/themes/lt-bespace/js/custom.js?ver=20181230

js mpbirlaplanetarium.org collected 2026-09-25 04:47:28 UTC 12,412 bytes, 363 lines download raw bytes

1// No Sidebar Full Content Blog
2jQuery(function ($) { 
3	if ( $(".sidebar-right-blog").parents("#content").length == 0 && $(".sidebar-left-blog").parents("#content").length == 0)   { 
4	   $("body").addClass("null-blog");
5	} else {	 
6	   $("body").removeClass("null-blog");
7	}
8});
9
10// Sidebar Content Sidebar Blog
11jQuery(function ($) { 
12	if ( $(".sidebar-right-blog").parents("#content").length == 1 && $(".sidebar-left-blog").parents("#content").length == 1 )     { 
13	   $("body").addClass("sidebar-content-sidebar-blog blog");
14	} else {	 
15	   $("body").removeClass("sidebar-content-sidebar-blog");
16	}
17});
18// Content Sidebar Blog
19jQuery(function ($) { 
20	if ( $(".sidebar-right-blog").parents("#content").length == 1 && $(".sidebar-left-blog").parents("#content").length == 0 )   { 
21	   $("body").addClass("content-sidebar-blog blog");
22	} else {	 
23	   $("body").removeClass("content-sidebar-blog");
24	}
25});
26//  Sidebar Content Blog
27jQuery(function ($) { 
28	if ( $(".sidebar-right-blog").parents("#content").length == 0 && $(".sidebar-left-blog").parents("#content").length == 1)   { 
29	   $("body").addClass("sidebar-content-blog blog");
30	} else {	 
31	   $("body").removeClass("sidebar-content-blog");
32	}
33});
34
35// No Sidebar Full Content ws
36jQuery(function ($) { 
37	if ( $(".sidebar-right-ws").parents("#content").length == 0 && $(".sidebar-left-ws").parents("#content").length == 0)   { 
38	   $("body.woocommerce").addClass("null-ws");
39	} else {	 
40	   $("body.woocommerce").removeClass("null-ws");
41	}
42});
43// Sidebar Content Sidebar ws
44jQuery(function ($) { 
45	if ( $(".sidebar-right-ws").parents("#content").length == 1 && $(".sidebar-left-ws").parents("#content").length == 1)   { 
46	   $("body").addClass("sidebar-content-sidebar-ws");
47	} else {	 
48	   $("body").removeClass("sidebar-content-sidebar-ws");
49	}
50});
51// Content Sidebar ws
52jQuery(function ($) { 
53	if ( $(".sidebar-right-ws").parents("#content").length == 1 && $(".sidebar-left-ws").parents("#content").length == 0)   { 
54	   $("body").addClass("content-sidebar-ws");
55	} else {	 
56	   $("body").removeClass("content-sidebar-ws");
57	}
58});
59//  Sidebar Content ws
60jQuery(function ($) { 
61	if ( $(".sidebar-right-ws").parents("#content").length == 0 && $(".sidebar-left-ws").parents("#content").length == 1)   { 
62	   $("body").addClass("sidebar-content-ws");
63	} else {	 
64	   $("body").removeClass("sidebar-content-ws");
65	}
66});
67jQuery(function ($) { 
68	 $("body.woocommerce").removeClass("sidebar-content-sidebar-blog");
69	 $("body.woocommerce").removeClass("content-sidebar-blog");
70	 $("body.woocommerce").removeClass("sidebar-content-blog");
71
72	 $("body.category").removeClass("sidebar-content-sidebar-ws");
73	 $("body.category").removeClass("content-sidebar-ws");
74	 $("body.category").removeClass("sidebar-content-ws");
75	 $("body.single-post").removeClass("sidebar-content-sidebar-ws");
76	 $("body.single-post").removeClass("content-sidebar-blog");
77	 $("body.single-post").removeClass("sidebar-content-blog");
78});
79// No sidebar full content 
80jQuery(function ($) { 
81	if ( $(".sidebar-right-blog").parents("#content").length == 0 && $(".sidebar-left-blog").parents("#content").length == 0  && $(".sidebar-right-ws").parents("#content").length == 0 && $(".sidebar-left-ws").parents("#content").length == 0)   { 
82	   $("body").addClass("full-content");
83	} else {	 
84	   $("body").removeClass("full-content");
85	}
86});
87jQuery(function ($) { 
88	$("body").addClass("full-content");
89});
90jQuery(function ($) { 
91	if ($("body").hasClass("archive"))    { 
92	    $("body").removeClass("full-content");
93	} 
94});
95jQuery(function ($) { 
96	if ($("body").hasClass("single-post"))    { 
97	    $("body").removeClass("full-content");
98	}
99});
100jQuery(function ($) { 
101	if ($("body").hasClass("woocommerce"))    { 
102	    $("body").removeClass("full-content");
103	}
104});
105//*** Sticky Menu
106jQuery(function($){
107  $(window).scroll(function() {
108    var winTop = $(window).scrollTop();
109    if (winTop >= 1) { 
110      $(".site-header").addClass("is-sticky");
111    } else {
112      $(".site-header").removeClass("is-sticky");
113    }
114  })
115})
116
117/*** LIGHTBOX Video ***/
118
119jQuery(function($){
120
121    // Lightbox Triggers
122    $(".open-video-link").videoBox();
123});
124/* ========================================================================= */
125/* FUNCTION TO CREATE LIGHTBOX */
126/* ========================================================================= */
127
128jQuery.fn.extend({
129    videoBox : function() {
130        var self, link, target, video, videoSrc, toggle;
131        this.each(function() {
132            self = this;
133            target = $(self).attr("href");
134            video = $(target).find(".popup-video iframe");
135            videoSrc = $(video).attr("src");
136          
137            $(this).on("click", function(event) {
138                event.preventDefault ? event.preventDefault() : event.returnValue = false;
139                $(target).wrap( "<div class='lightbox'></div>" );
140                $(".lightbox").fadeIn(300, function() {
141                    $(target).fadeIn(0);
142                    $("body").addClass("modal-open");
143                    $(video).attr("src",videoSrc+'?autoplay=1');
144                    resizeIfame(video);
145                });
146
147                $("body").on("click", function(event) {
148                    if(($(event.target).hasClass("lightbox") || $(event.target).hasClass("close")) && $(target).parent().hasClass("lightbox") ) {
149                        $(".lightbox").fadeOut(300, function() {
150                            $(target).hide(0);
151                            $(target).unwrap();
152                        });
153                        $("body").removeClass("modal-open");
154                        $(video).attr("src",videoSrc);
155                    }
156                });
157            });
158        });
159    }
160});
161
162
163/* ========================================================================= */
164/* RESIZE IFRAME VIDEO FUNCTION */
165/* ========================================================================= */
166function resizeIfame(frame) {
167
168    var oldWidth = $(frame).width();
169    var oldHeight = $(frame).height();
170    var propotion = oldHeight / oldWidth;
171    var newHeight;
172
173    $(frame).width('100%');
174    newHeight = $(frame).width() * propotion;
175    $(frame).height(newHeight);
176
177    $(window).resize(function() {
178        $(frame).width('100%');
179        newHeight = $(frame).width() * propotion;
180        $(frame).height(newHeight);
181    });
182}
183
184
185
186// JS written by Themetide
187
188jQuery(document).ready(function($){
189
190	//set animation timing
191	var animationDelay = 2500,
192		//loading bar effect
193		barAnimationDelay = 3800,
194		barWaiting = barAnimationDelay - 3000, //3000 is the duration of the transition on the loading bar - set in the scss/css file
195		//letters effect
196		lettersDelay = 50,
197		//type effect
198		typeLettersDelay = 150,
199		selectionDuration = 500,
200		typeAnimationDelay = selectionDuration + 800,
201		//clip effect 
202		revealDuration = 600,
203		revealAnimationDelay = 1500,
204  	stopAnimation = false;
205	
206	initHeadline();
207	
208
209	function initHeadline() {
210		//insert <i> element for each letter of a changing word
211		singleLetters($('.cd-headline.letters').find('b'));
212		//initialise headline animation
213		animateHeadline($('.cd-headline'));
214	}
215
216	function singleLetters($words) {
217		$words.each(function(){
218			var word = $(this),
219				letters = word.text().split(''),
220				selected = word.hasClass('is-visible');
221			for (i in letters) {
222				if(word.parents('.rotate-2').length > 0) letters[i] = '<em>' + letters[i] + '</em>';
223				letters[i] = (selected) ? '<i class="in">' + letters[i] + '</i>': '<i>' + letters[i] + '</i>';
224			}
225		    var newLetters = letters.join('');
226		    word.html(newLetters);
227		});
228	}
229
230	function animateHeadline($headlines) {
231		var duration = animationDelay;
232		$headlines.each(function(){
233			var headline = $(this);
234			
235			if(headline.hasClass('loading-bar')) {
236				duration = barAnimationDelay;
237				setTimeout(function(){ headline.find('.cd-words-wrapper').addClass('is-loading') }, barWaiting);
238			} else if (headline.hasClass('clip')){
239				var spanWrapper = headline.find('.cd-words-wrapper'),
240					newWidth = spanWrapper.width() + 10
241				spanWrapper.css('width', newWidth);
242			} else if (!headline.hasClass('type') ) {
243				//assign to .cd-words-wrapper the width of its longest word
244				var words = headline.find('.cd-words-wrapper b'),
245					width = 0;
246				words.each(function(){
247					var wordWidth = $(this).width();
248				    if (wordWidth > width) width = wordWidth;
249				});
250				headline.find('.cd-words-wrapper').css('width', width);
251			};
252
253			//trigger animation
254			setTimeout(function(){ hideWord( headline.find('.is-visible').eq(0) ) }, duration);
255		});
256	}
257
258	function hideWord($word) {
259		var nextWord = takeNext($word);
260		
261    if(stopAnimation){
262      return false;
263    }
264    
265		if($word.parents('.cd-headline').hasClass('type')) {
266			var parentSpan = $word.parent('.cd-words-wrapper');
267			parentSpan.addClass('selected').removeClass('waiting');	
268			setTimeout(function(){ 
269				parentSpan.removeClass('selected'); 
270				$word.removeClass('is-visible').addClass('is-hidden').children('i').removeClass('in').addClass('out');
271			}, selectionDuration);
272			setTimeout(function(){ showWord(nextWord, typeLettersDelay) }, typeAnimationDelay);
273		
274		} else if($word.parents('.cd-headline').hasClass('letters')) {
275			var bool = ($word.children('i').length >= nextWord.children('i').length) ? true : false;
276			hideLetter($word.find('i').eq(0), $word, bool, lettersDelay);
277			showLetter(nextWord.find('i').eq(0), nextWord, bool, lettersDelay);
278
279		}  else if($word.parents('.cd-headline').hasClass('clip')) {
280			$word.parents('.cd-words-wrapper').animate({ width : '2px' }, revealDuration, function(){
281				switchWord($word, nextWord);
282				showWord(nextWord);
283			});
284
285		} else if ($word.parents('.cd-headline').hasClass('loading-bar')){
286			$word.parents('.cd-words-wrapper').removeClass('is-loading');
287			switchWord($word, nextWord);
288			setTimeout(function(){ hideWord(nextWord) }, barAnimationDelay);
289			setTimeout(function(){ $word.parents('.cd-words-wrapper').addClass('is-loading') }, barWaiting);
290
291		} else {
292			switchWord($word, nextWord);
293			setTimeout(function(){ hideWord(nextWord) }, animationDelay);
294		}
295	}
296
297	function showWord($word, $duration) {
298		if($word.parents('.cd-headline').hasClass('type')) {
299			showLetter($word.find('i').eq(0), $word, false, $duration);
300			$word.addClass('is-visible').removeClass('is-hidden');
301
302		}  else if($word.parents('.cd-headline').hasClass('clip')) {
303			$word.parents('.cd-words-wrapper').animate({ 'width' : $word.width() + 10 }, revealDuration, function(){ 
304				setTimeout(function(){ hideWord($word) }, revealAnimationDelay); 
305			});
306		}
307	}
308
309	function hideLetter($letter, $word, $bool, $duration) {
310		$letter.removeClass('in').addClass('out');
311		
312		if(!$letter.is(':last-child')) {
313		 	setTimeout(function(){ hideLetter($letter.next(), $word, $bool, $duration); }, $duration);  
314		} else if($bool) { 
315		 	setTimeout(function(){ hideWord(takeNext($word)) }, animationDelay);
316		}
317
318		if($letter.is(':last-child') && $('html').hasClass('no-csstransitions')) {
319			var nextWord = takeNext($word);
320			switchWord($word, nextWord);
321		} 
322	}
323
324	function showLetter($letter, $word, $bool, $duration) {
325		$letter.addClass('in').removeClass('out');
326		
327		if(!$letter.is(':last-child')) { 
328			setTimeout(function(){ showLetter($letter.next(), $word, $bool, $duration); }, $duration); 
329		} else { 
330			if($word.parents('.cd-headline').hasClass('type')) { setTimeout(function(){ $word.parents('.cd-words-wrapper').addClass('waiting'); }, 200);}
331			if(!$bool) { setTimeout(function(){ hideWord($word) }, animationDelay) }
332		}
333	}
334
335	function takeNext($word) {
336		return (!$word.is(':last-child')) ? $word.next() : $word.parent().children().eq(0);
337	}
338
339	function takePrev($word) {
340		return (!$word.is(':first-child')) ? $word.prev() : $word.parent().children().last(
340);
341	}
342
343	function switchWord($oldWord, $newWord) {
344		$oldWord.removeClass('is-visible').addClass('is-hidden');
345		$newWord.removeClass('is-hidden').addClass('is-visible');
346	}
347  
348  var icon = $('#player');
349  icon.click(function() {
350    if(icon.hasClass("on")){
351    	icon.removeClass("on icon-pause-circle-fill").addClass("off icon-play-circle-fill");
352      stopAnimation = true;
353    } else {
354      icon.removeClass("off icon-play-circle-fill").addClass("on icon-pause-circle-fill");
355      stopAnimation = false;
356      animationDelay = 1000;
357      initHeadline();
358    }
359    return false;
360  });
361  
362});
363

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.