PageSourceSearch

https://newthoughtlibrary.com/lib/js/script.js

js newthoughtlibrary.com collected 2026-10-02 07:29:30 UTC 8,790 bytes, 302 lines download raw bytes

1
2(function($) {
3    "use strict";
4		
5	/* Contact form */
6	$('#contact-form').each( function(){
7		var form = $(this);
8		//form.validate();
9		form.submit(function(e) {
10			if (!e.isDefaultPrevented()) {
11				jQuery.post(this.action,{
12					'names':$('input[name="contact_names"]').val(),
13					'email':$('input[name="contact_email"]').val(),
14					'message':$('textarea[name="contact_message"]').val(),
15				},function(data){
16					form.fadeOut('fast', function() {
17						$(this).siblings('p').show();
18					});
19				});
20				e.preventDefault();
21			}
22		});
23	})
24
25	/* Newsletter */
26	$('.newsletter_wrapper .newsletter_form').each( function(){
27		var form = $(this);
28		//form.validate();
29		form.submit(function(e) {
30			if (!e.isDefaultPrevented()) {
31				jQuery.post(this.action,{
32					'email':$('input[name="nf_email"]').val(),
33				},function(data){
34					form.fadeOut('fast', function() {
35						$(this).siblings('p.newsletter_success_box').show();
36					});
37				});
38				e.preventDefault();
39			}
40		});
41	});	
42	
43	/* template functions */
44	$(document).ready(function(){
45		
46		// smaller screens
47		main_functions_call();
48		function main_functions_call(container){
49			if(typeof container === 'undefined'){
50				container = 'body';
51			}
52			
53			// adding mobile class on smaller screens
54			$(container).is_smallerScreen();
55			// responsive navigation
56			$(container).wt_responsive_nav();	
57		}
58		
59		/* Youtube player */
60		if ($.fn.mb_YTPlayer) { 
61		 var onMobile = false;
62		 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { onMobile = true; }
63		 if( ( onMobile === false ) ) {
64			$(".player").mb_YTPlayer();
65			$('.bg_video_mobile').hide();
66		  } else {
67			/* hide player and video volume button */
68			$(".player").hide();
69			$(".video-volume").hide();
70		  }
71			//$(".wt_youtube_player").mb_YTPlayer(); 
72		}
73			
74	})
75	
76	jQuery(window).load(function(){	
77	});
78	
79	/* Adding Mobile Class
80	================================================== */
81	(function($) {
82		$.fn.is_smallerScreen = function() {
83			var win               = $(window),
84				container         = $('html'),
85				isResponsiveMode  = container.hasClass('cssanimations'),	
86				check_screen      = function() {
87					
88					if( win.width() < 1000 && isResponsiveMode ){
89						container.addClass('is_smallScreen');
90					} else {
91						container.removeClass('is_smallScreen');
92					}
93				};
94	
95				win.on("smartresize", check_screen);
96				check_screen();
97		};
98	})(jQuery);
99	
100		
101	// ========================= smartresize ===============================
102			
103	/*
104	* smartresize: special jQuery event that happens once after a window resize
105	*
106	* latest version and complete README available on Github:
107	* https://github.com/louisremi/jquery-smartresize
108	*
109	* Copyright 2012 @louis_remi
110	* Licensed under the MIT license.
111	*
112	* This saved you an hour of work? 
113	* Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON
114	*/
115		
116	(function($){
117		"use strict";
118				
119		if(!jQuery.fn.smartresize)
120		  {
121			  var $event = $.event,
122				  resizeTimeout;
123			
124			  $event.special.smartresize = {
125				setup: function() {
126				  $(this).bind( "resize", $event.special.smartresize.handler );
127				},
128				teardown: function() {
129				  $(this).unbind( "resize", $event.special.smartresize.handler );
130				},
131				handler: function( event, execAsap ) {
132				  // Save the context
133				  var context = this,
134					  args = arguments;
135			
136				  // set correct event type
137				  event.type = "smartresize";
138			
139				  if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
140				  resizeTimeout = setTimeout(function() {
141					jQuery.event.handle.apply( context, args );
142				  }, execAsap === "execAsap"? 0 : 100 );
143				}
144			  };
145			
146			  $.fn.smartresize = function( fn ) {
147				return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
148			  };
149		  }	
150	}(jQuery));
151
152			
153	/* Responsive Navigation
154	================================================== */
155	(function($) {
156		$.fn.wt_responsive_nav = function() {
157			var win = $(window), header = $('#header');
158	
159			if(!header.length) {
160				return;
161			}
162	
163			var menu              = header.find('#nav:eq(0)'),
164				first_level_items = menu.find('>li').length,
165				switchWidth = 768;
166	
167			if(first_level_items > 8) {
168				switchWidth = 959;
169			}
170			// if there is no menu selected
171			if(header.is('.drop_down_nav')) {
172				menu.mobileMenu({
173					switchWidth: switchWidth,
174					topOptionText: $('#nav').data('select-name'), // first option text
175					indentString: 'ontouchstart' in document.documentElement ? '- ' : "&nbsp;&nbsp;&nbsp;"  // string for indenting nested items
176				});
177			} else {
178				var container       = $('#container'),
179					responsive_nav_wrap	= $('<div id="wt_responsive_nav_wrap"></div>').prependTo(container),
180					show_menu		= $('<a id="responsive_nav_open" href="#" class=""><i class="icon icon-align-justify"></i></a>'),
181					hide_menu		= $('<a id="responsive_nav_hide" href="#" class=""><i class="icon icon-remove"></i></a>'),
182					responsive_nav  = menu.clone().attr({id:"wt-responsive-nav", "class":""}),
183					menu_item       = responsive_nav.find('a'),    
184					one_page_item   = menu_item.attr('href').match("^#") ? true : false,
185					menu_added      = false;
186									
187					responsive_nav.find('ul').removeAttr("style");
188					responsive_nav.find('.notMobile').remove();
189					
190					// hiding all sub-menus		
191					/*	
192					responsive_nav.find('li').each(function(){
193						var el = $(this);
194						if(el.find('> ul').length > 0) {
195							 el.find('> a').append('<i class="fontawesome-icon wt_icon-angle-down"></i>');
196						}
197					});
198	
199					responsive_nav.find('li:has(">ul") > a').click(function(){
200						var el = $(this),
201							icon = el.find('.fontawesome-icon'),
202							el_parent = el.parent().find('> ul'),
203							screen_h  = win.height();
204						
205						var el_parent_height = el_parent.css({position:'relative'}).outerHeight(true),
206							container_height = container.outerHeight(true),
207							new_height = container_height + el_parent_height,
208							new_height_1 = container_height - el_parent_height;
209							
210						el.toggleClass('active');
211						el_parent.stop(true,true).slideToggle();
212						
213						if ( el.hasClass('active') ) {
214							icon.removeClass('wt_icon-angle-down').addClass('wt_icon-angle-up');
215							if(new_height < screen_h) new_height = screen_h;
216								container.css({'height':new_height});
217						} else {
218							icon.removeClass('wt_icon-angle-up').addClass('wt_icon-angle-down');
219							if(new_height_1 < screen_h) new_height_1 = screen_h;
220								container.css({'height':new_height_1});
221							
222						}
223						
224						return false;
225					});
226					*/
227					// end hiding all sub-menus	
228					
229					show_menu.click(function() {
230						if(container.is('.show_responsive_nav')) {
231							container.removeClass('show_responsive_nav');
232							container.css({'height':"auto"});
233						} else {
234							container.addClass('show_responsive_nav');
235							set_height();
236						}
237						return false;
238					});
239					
240					// start responsive one page navigation	
241					if (one_page_item) {			
242						menu_item.click(function(e) {
243							if(container.is('.show_responsive_nav')) {						
244								container.removeClass('show_responsive_nav');
245								container.css({'height':"auto"});
246									var full_url = this.href;
247									var parts = full_url.split("#");
248									var trgt = parts[1];
249									var target_offset = $("#"+trgt).offset();
250									var target_top = target_offset.top;
251									$('html,body').animate({scrollTop:target_top -60}, 1000);
252									return false;
253								e.preventDefault();
254							}
255						});
256					}
257					// end responsive one page navigation
258					
259					hide_menu.click(function() {
260						container.removeClass('show_responsive_nav');
261						container.css({'height':"auto"});
262						return false;
263					});
264	
265					var set_visibility = function() {
266						if(win.width() > switchWidth) {
267							header.removeClass('small_device_active');
268							container.removeClass('show_responsive_nav');
269							container.css({'height':"auto"});
270						} else {
271							header.addClass('small_device_active');
272							if(!menu_added) {
273								var before_menu = header.find('#nav');
274								show_menu.insertBefore(before_menu);
275								responsive_nav.prependTo(responsive_nav_wrap);
276								hide_menu.prependTo(container);
277								menu_added = true;
278							}
279	
280							if(container.is('.show_responsive_nav')) {
281								set_height();
282							}
283						}
284					},
285	
286					set_height = function() {
287						var height = responsive_nav.css({position:'relative'}).outerHeight(true),
288							win_h  = win.height();
289	
290						if(height < win_h) {
291							height = win_h;
292						}
293						responsive_nav.css({position:'absolute'});
294						container.css({'height':height});
295					};
296	
297					win.on("smartresize", set_visibility);
298					set_visibility();
299			}	
300		};
301	})(jQuery);
302})(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.