PageSourceSearch

https://www.edglossary.org/wp-content/themes/eg-resp/assets/js/script.js

js edglossary.org collected 2026-10-02 02:23:25 UTC 6,482 bytes, 213 lines download raw bytes

1/* Author: Liberty Concepts
2 * v.2.0
3*/
4
5jQuery.noConflict();
6	
7jQuery(document).ready(function($){
8
9	// Main Navigation - depends on superfish-1.4.8-yui
10	if ($("ul.sf-menu").length) {
11		$("ul.sf-menu").supersubs({
12				minWidth:15,
13				maxWidth:30,
14				extraWidth:1 
15		}).superfish({delay:400,speed:200 }).find('ul').bgIframe({
16				opacity:false
17		});
18	}
19
20	// open stuff - 
21	// usage: <div id="open-close"><a href="#open-close" class="open">open</a></div>
22	$('.open').click(function(){
23		var $myTarget = $(this).attr('href');
24		var $myDiv = $('div#'+$myTarget);	
25		$($myDiv).slideToggle();
26		return false;
27	});	
28	
29	// close stuff
30	// usage: <div id="open-close"><a href="#open-close" class="close">close</a></div>
31	$('.close').click(function(){
32		var $myTarget = $(this).attr('href');
33		var $myDiv = $('div#'+$myTarget);	
34		$($myDiv).slideUp();
35		return false;
36	});	
37
38	// remove error state from form fields on focus
39	$('.fieldWithErrors input[type=text]').focus(function(){
40		$(this).parent('.fieldWithErrors').removeClass().prev('.fieldErrMessage').fadeOut();
41	});	
42	
43	// Text Resizer
44	$('#font_select').click(function(){
45		$('.content:not("h1,h2,h3,h4")').animate({'font-size':'100%','line-height':'150%'}, 500);
46	});
47	$('#font_select_mid').click(function(){
48		$('.content:not("h1,h2,h3,h4")').animate({'font-size':'120%','line-height':'180%'}, 500);
49	});
50	$('#font_select_large').click(function(){
51		$('.content:not("h1,h2,h3,h4")').animate({'font-size':'150%','line-height':'200%'}, 500);
52	});
53		
54	//fade siblings on hover
55	$(".social a, #flickr li").live({
56		mouseenter:
57		 function() {
58			$(this).siblings().stop().animate({opacity: 0.5}, "200"); 
59		 },
60		mouseleave:
61		 function() {
62			$(this).siblings().stop().animate({opacity: 1.0}, "200");   
63		 }
64		}
65   );
66
67	// slide show depends on cycle plugin
68		$('.slides').cycle({
69		fx: 'scrollHorz', // requires cycle.all for any fx besides fade
70		timeout: 8000,
71		cleartypeNoBg: true, // prevent IE from fillng bg with white
72		
73		// next and previous slide links
74		next: '.next',
75		prev: '.prev',
76
77		pager:  '.controls',
78		
79		// put slide numbers in the controls
80		// pagerAnchorBuilder:function(idx,slide){
81		// return '<li><a href="#">'+ parseFloat(idx+1) +'</a></li>';
82		// }
83		
84		// put bullets in the controls
85		pagerAnchorBuilder: function(index, el) {
86				return '<li><a href="#">&bull;</a></li>';     
87		}
88		
89	});
90
91	//tab widget
92	//$('.tab').hide(); do this in css instead
93	$('.activetab').show();
94	$('#tabnav li').click(function (e) {
95			var $myId = $(this).find('a').attr('href');
96			var $myTab = $('#tabs').find('#'+$myId);	
97			$(this).addClass('activetab');
98			$(this).siblings('li').removeClass('activetab');	
99			$($myTab).siblings('div.tab').hide();	
100			$($myTab).fadeIn();
101			e.preventDefault();		
102	});
103	
104	// Most Popular List Page filters
105	$('#most-popular-filters li').click(function (e) {
106			var $myId = $(this).find('a').attr('href');
107			var $myTab = $('#most-popular-tabs').find('#'+$myId);	
108			$(this).addClass('activetab');
109			$(this).siblings('li').removeClass('activetab');	
110			$($myTab).siblings('.tab').hide();	
111			$($myTab).fadeIn();
112			e.preventDefault();		
113	});
114
115	// multiple elements cycle
116	$('#multiscroll').multipleElementsCycle({
117		container: '#container',
118		next: '.nextMulti',
119		prev: '.prevMulti',
120		start: 1, // defaults to 0 which will hide "prev" link
121		show: 5, // how many elements to show at once
122		speed: 400,
123		scrollCount: 5 // how mwny elements to scroll when clicking next/prev
124	});
125	
126	// show image captions above multi-cycle
127	// did this on murphyforpa.com & thought it was handy
128	$('#multi img').hover(function () {
129		myDefault = $('#writeTitle').html();
130		myTitle = $(this).prev('span').html();	
131		$('#writeTitle').html('<em>'+myTitle+'</em>');
132			}, function () {
133			$('#writeTitle').html(myDefault);
134		}
135	);
136
137	// show placeholders in ie
138	$('input,textarea').placeholder({blankSubmit: true});
139
140	// validate forms - depends on validation plugin 1.8.1
141	$("#theform").validate({
142		rules: {
143			/*fname: "required", // if input has class "required" you don't need these
144			lname: "required",*/
145			"contribute[amount]" : "required", // contribute[amount] is default CMS name for payment option radio buttons
146			email: {
147				/*required: true,*/
148				email: true
149			},
150			zip: {
151				digits: true, // don't allow letters in here
152				minlength: 5
153			}
154		},
155		messages: {
156			fname: "Please enter your first name",
157			lname: "Please enter your last name",
158			email: "Please enter a valid email address",
159			zip: 	 "Please enter your zip code",
160			"contribute[amount]": "Please select an amount"
161		},
162		errorElement: "span",
163        wrapper: "span",  // a wrapper around the error message
164        errorPlacement: function(error, element) {
165					offset = element.offset();
166					error.insertBefore(element)
167					error.addClass('err-message');  // add a class to the wrapper
168					error.css('position', 'absolute');
169					error.css('left', offset.left + element.outerWidth()*.04);
170					error.css('top', offset.top - element.outerHeight());
171					if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox'){
172							element = element.parent().parent(); // parent element is label; get parent of that
173							error.css('left', offset.left + element.outerWidth()*.01);
174							error.css('top', offset.top - element.outerHeight()*1.2); 
175					}
176					if (element.attr('type') == 'textarea'){
177							error.css('left', offset.left + element.outerWidth()*.01);
178							error.css('top', offset.top - element.outerHeight()/2); 
179					}
180        }		
181	});
182
183	// open external links in new window
184	$('a').each(function() {
185		$.expr[':'].external = function(obj){
186			return !obj.href.match(/^mailto\:/)
187			&& (obj.hostname != location.hostname)
188			&& !obj.href.match(/^javascript\:/)
189			&& !obj.href.match(/^http\:\/\/www.youtube.com\//)
190		};
191		$('a:external').addClass('external').attr('target','_blank');
192	});
193	
194	//Fix placeholders in webkit
195	$(function(){
196	if ($.browser.webkit) {
197	$('input, textarea').on('focus',function(){
198	if ( $(this).attr('placeholder') ) $(this).data('placeholder', $(this).attr('placeholder')).removeAttr('placeholder');
199	}).on('blur', function(){
200	if ( $(this).data('placeholder') ) $(this).attr('placeholder', $(this).data('placeholder')).removeData('placeholder');
201	});
202	}
203	});
204
205	
206	//Add colon to "Related Entries"
207	$(".related-posts h2").append(":");
208	
209	
210	// css for IE <9 - use first-child instead of last to reduce need for extra js for css
211	// $('').css({'':''});
212
213});

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.