PageSourceSearch

https://www.biblicalarchaeology.org/wp-content/themes/baswp_transitional/assets/js/commonjs.js?ver=1790239640

js biblicalarchaeology.org collected 2026-09-24 08:48:15 UTC 5,877 bytes, 185 lines download raw bytes

1/*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
2/*  Constant Contact changes by CEG Dec 2024 */
3/*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
4
5
6	/////////////////////////////////////////////////////////
7	//
8	//  FUNCTION:  Show_Div
9	//
10	/////////////////////////////////////////////////////////
11	
12 		function Show_Div (div_id) {
13
14			document.getElementById(div_id).style.display = 'block';			
15		}
16 
17
18	/////////////////////////////////////////////////////////
19	//
20	//  FUNCTION:  Hide_Div
21	//
22	/////////////////////////////////////////////////////////
23	
24 		function Hide_Div (div_id) {
25
26			document.getElementById(div_id).style.display = 'none';			
27		}
28 
29/*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
30/*  end Constant Contact changes  */
31/*  - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
32
33
34	jQuery(document).ready( function(){
35	jQuery('[data-toggle="tooltip"]').tooltip();
36	jQuery('[data-toggle="popover"]').popover() 
37
38	jQuery(window).scroll(function() {
39		if (jQuery(this).scrollTop() > 1){ 
40			jQuery('#tempMenu').addClass("header-fixed");
41		}
42		else{
43			jQuery('#tempMenu').removeClass("header-fixed");
44		}
45	});
46
47	//Materialise Initilisation
48	 jQuery('select').formSelect();
49	 jQuery('textarea').characterCounter();
50	
51	jQuery('#mainNav').stellarNav({
52		theme: 'plain',
53		breakpoint: 991,
54		menuLabel: '<i>Menu</i>',
55		sticky: false,
56		position: 'static',
57		openingSpeed: 250,
58		closingDelay: 250,
59		showArrows: true,
60		phoneBtn: '',
61		locationBtn: '',
62		closeBtn: false,
63		scrollbarFix: true
64	});
65
66	jQuery('.tempTab ul li').click(function(){
67		var tab_id = jQuery(this).attr('data-tab');
68
69		jQuery('.tempTab ul li').removeClass('current');
70		jQuery('.tempTab .tabContent').removeClass('current');
71
72		jQuery(this).addClass('current');
73		jQuery("#"+tab_id).addClass('current');
74	});
75
76	
77
78// 	if(jQuery(window).width() < 991){
79// 		jQuery('.moreTextMob').ellipsis({
80// 		  type: 'lines',
81// 		  count: 3
82// 		});
83// 	};
84		 
85});
86
87/* -------------- Knowledge BAR -------------- */
88
89jQuery(document).ready(function(){
90
91	var fontAwesomeIconRight = "fa fa-chevron-circle-right";
92	var fontAwesomeIconDown = "fa fa-chevron-circle-down";
93	var glossaryHeadings = jQuery("#knowledgebar h3[id^='letter-']");
94
95	addOnClickEventToGlossaryHyperlinks(fontAwesomeIconRight, fontAwesomeIconDown);
96	addOnClickEventToHeadings(glossaryHeadings, fontAwesomeIconRight, fontAwesomeIconDown);
97	navigateToBookmark();
98	
99});
100
101function navigateToBookmark(){
102	return;
103}
104
105function addOnClickEventToGlossaryHyperlinks(fontAwesomeIconRight, fontAwesomeIconDown){
106	//Get list of alphabet <a> tags along top of glossary page
107	var anchors = jQuery('#knowledgebar .basGlossary-alphabet a');
108
109	//Add onclick event to all alphabet tags (such that the 'sectionToggle()' function will be executed onclick.)
110	jQuery(anchors).on("click", function(){
111		var currentLetter = jQuery(this).text();
112		hideAllContentSections();
113		closeAllHeadings(fontAwesomeIconRight);
114		contentSectionToggle(currentLetter);
115		iconToggle(currentLetter, fontAwesomeIconRight, fontAwesomeIconDown);
116		scrollToSection(this);
117	});
118}
119
120function contentSectionToggle(currentLetter){
121	//Show the content section for the letter that was clicked
122	var currentContentSection = jQuery('#knowledgebar #content-' + currentLetter);
123	jQuery(currentContentSection).is(":visible") 
124		? jQuery(currentContentSection).slideUp("slow") 
125	    : jQuery(currentContentSection).slideDown("slow");
126}
127
128function hideAllContentSections(){
129	jQuery("#knowledgebar [id^='content-']").hide();
130}
131
132function closeAllHeadings(closedIconClass){
133	var spanElements = jQuery("#knowledgebar h3[id^='letter-'] span");
134	jQuery("#knowledgebar h3[id^='letter-'] span").attr('class', closedIconClass);
135}
136
137function scrollToSection(currentAnchor){
138	//SCROLL SMOOTHLY TO THE LOCATION SPECIFIED IN THE currentAnchor HREF'S BOOKMARK PORTION (begins with '#')
139
140	// Get the ID of the target section from the link's href attribute
141    // or a data attribute, and remove the '#' prefix.
142    var targetId = jQuery(currentAnchor).attr('href').substring(1); 
143
144	// Calculate the offset of the target element from the top of the document
145    var targetOffset = jQuery('#' + targetId).offset().top;
146
147    // Animate the scrolling of the html and body elements
148    jQuery('html, body').animate({
149        scrollTop: targetOffset
150    }, 1000); // 1000 milliseconds for a smooth scroll duration
151}
152
153function addOnClickEventToHeadings(glossaryHeadings, fontAwesomeIconRight, fontAwesomeIconDown){
154    addIconToHeadings(glossaryHeadings, fontAwesomeIconDown);
155	addOpenCloseFunctionalityToHeadingIcons(glossaryHeadings, fontAwesomeIconRight, fontAwesomeIconDown);
156}
157
158function addIconToHeadings(glossaryHeadings, fontAwesomeIcon){
159	jQuery(glossaryHeadings).prepend('<span class="' + fontAwesomeIcon + '" style="font-size:0.9em;padding-right:0.5em; cursor:pointer;" aria-hidden="true" />');
160}
161
162function addOpenCloseFunctionalityToHeadingIcons(glossaryHeadings, fontAwesomeIconRight, fontAwesomeIconDown){
163	
164	var glossaryHeadingIcons = jQuery("#knowledgebar h3[id^='letter-']");
165
166	glossaryHeadingIcons.on("click", function(){
167		var currentLetter = jQuery(this).text();
168		iconToggle(currentLetter, fontAwesomeIconRight, fontAwesomeIconDown);
169		contentSectionToggle(currentLetter);
170	});
171}
172
173function iconToggle(currentLetter, fontAwesomeIconRight, fontAwesomeIconDown){
174	
175	var currentHeading = jQuery("div#knowledgebar h3#letter-" + currentLetter + " span");
176	
177	//Remove "fa " from the start of the class name so we only toggle the icon class.
178	var faRight = fontAwesomeIconRight.substring(3);
179	var faDown = fontAwesomeIconDown.substring(3);
180	
181	if (jQuery(currentHeading).hasClass(faRight) || jQuery(currentHeading).hasClass(faDown))
182        jQuery(currentHeading).toggleClass(faRight).toggleClass(faDown);
183};
184
185/* -------------- /Knowledge BAR -------------- */

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.