PageSourceSearch

https://www.lancasterbaptist.org/sites/all/themes/material_design/js/custom.js?titbqh

js lancasterbaptist.org collected 2026-10-02 05:17:39 UTC 22,456 bytes, 575 lines download raw bytes

1(function($) {
2
3    $(document).ready(function() {
4        //         This command is used to initialize some elements and make them work properly
5        //         $.material.init();
6
7        //         $("#static-navbar").sticky({ topSpacing: 63 });
8				
9        $("#static-navbar ul.fixed.bullets li a").append('<i class="fa fa-circle-thin fa-lg" />');
10
11        // Nursery Classes
12        if (document.getElementById('block-views-937f6230adbb54209a25fe904109ebbc')) {
13            // document.getElementById('block-views-937f6230adbb54209a25fe904109ebbc').style.display = 'none';
14        }
15        // Preschool Classes
16        if (document.getElementById('block-views-01c0ff62262d456a02251536be64d540')) {
17            // document.getElementById('block-views-01c0ff62262d456a02251536be64d540').style.display = 'none';
18        }
19        // Elementary Classes
20        if (document.getElementById('block-views-6c2115a48470050b567c552303b03525')) {
21            // document.getElementById('block-views-6c2115a48470050b567c552303b03525').style.display = 'none';
22        }
23        // Teen Classes
24        if (document.getElementById('block-views-teen-classes-block-1')) {
25            // document.getElementById('block-views-teen-classes-block-1').style.display = 'none';
26        }
27        
28        // Sermons Exposed Filter
29        if (document.getElementById('views-exposed-form-sermons-page')) {
30        	$('#views-exposed-form-sermons-page .views-widget-filter-title').addClass('col-sm-12').find('input').attr('placeholder', 'Search for a sermon');
31        	$('#views-exposed-form-sermons-page .views-widget-filter-sermon_date_value').addClass('col-sm-6').find('input').attr('placeholder', 'Date');
32        	$('#views-exposed-form-sermons-page .views-widget-filter-bible_reference_book_name').addClass('col-sm-6').find('select').attr('placeholder', 'Book');
33        	$('#views-exposed-form-sermons-page .views-widget-filter-title_1').addClass('col-sm-12').find('input').attr('placeholder', 'Search for a series');
34        }
35
36        $('.overlay ul li.dropdown a').removeClass('disabled');
37        
38        // Add column class to quantity field
39				$('.form-item-quantity').addClass('col-sm-12');
40
41        $("#block-menu-menu-pastors-menu a.fa").mouseover(function() {
42            $(this).parent().find("i").addClass("fa-hover");
43        }).mouseout(function() {
44            $(this).parent().find("i").removeClass("fa-hover");
45        });
46
47        $(document).scroll(function() {
48            var y = $(this).scrollTop();
49            if (y > 150) {
50                $('.topMenu').fadeIn();
51            } else {
52                $('.topMenu').fadeOut();
53            }
54        });
55        
56        // Fix Sermons
57        if (document.getElementById('fix-sermons')) {
58        
59					var books_of_bible = {
60					"0": "none",
61					"1": "matthew",
62					"2": "mark",
63					"3": "luke",
64					"4": "john",
65					"5": "acts",
66					"6": "romans",
67					"7": "1_corinthians",
68					"8": "2_corinthians",
69					"9": "galatians",
70					"10": "ephesians",
71					"11": "philippians",
72					"12": "colossians",
73					"13": "1_thessalonians",
74					"14": "2_thessalonians",
75					"15": "1_timothy",
76					"16": "2_timothy",
77					"17": "titus",
78					"18": "philemon",
79					"19": "hebrews",
80					"20": "james",
81					"21": "1_peter",
82					"22": "2_peter",
83					"23": "1_john",
84					"24": "2_john",
85					"25": "3_john",
86					"26": "jude",
87					"27": "revelation",
88					"28": "genesis",
89					"29": "exodus",
90					"30": "leviticus",
91					"31": "numbers",
92					"32": "deuteronomy",
93					"33": "joshua",
94					"34": "judges",
95					"35": "ruth",
96					"36": "1_samuel",
97					"37": "2_samuel",
98					"38": "1_kings",
99					"39": "2_kings",
100					"40": "1_chronicles",
101					"41": "2_chronicles",
102					"42": "ezra",
103					"43": "nehemiah",
104					"44": "esther",
105					"45": "job",
106					"46": "psalm",
107					"47": "proverbs",
108					"48": "ecclesiastes",
109					"49": "song_of_songs",
110					"50": "isaiah",
111					"51": "jeremiah",
112					"52": "lamentations",
113					"53": "ezekiel",
114					"54": "daniel",
115					"55": "hosea",
116					"56": "joel",
117					"57": "amos",
118					"58": "obadiah",
119					"59": "jonah",
120					"60": "micah",
121					"61": "nahum",
122					"62": "habakkuk",
123					"63": "zepheniah",
124					"64": "haggai",
125					"65": "zechariah",
126					"66": "malachi"
127					};
128        
129        
130        	$('#fix-sermons').on('click', function() {
131//         		$('td.views-field-fix-audio').each(function() {
132//         			var audio = $(this).parent().find('.views-field-sermon-audio input');
133//         			var x = $(this)[0]['innerText'];
134//         			if (x !== "") {
135// 								audio[0]['value'] = x;
136// 								$(this).parent().find('.views-field-sermon-audio input').trigger("change");
137//         			}
138//         		});
139        		$('form table tbody tr').each(function() {
140        			var book_id = $(this).find('.views-field-book-id')[0]['innerText'];
141        			var chapter_start = $(this).find('.views-field-chapter-start')[0]['innerText'];
142        			var chapter_end = $(this).find('.views-field-chapter-end')[0]['innerText'];
143        			var verse_start = $(this).find('.views-field-verse-start')[0]['innerText'];
144        			var verse_end = $(this).find('.views-field-verse-end')[0]['innerText'];
145        			
146        			var new_book_id = $(this).find('.views-field-bible-reference .biblefield-book-input');
147        			var new_chapter_start = $(this).find('.views-field-bible-reference .biblefield-chapter-start-input');
148        			var new_chapter_end = $(this).find('.views-field-bible-reference .biblefield-chapter-end-input');
149        			var new_verse_start = $(this).find('.views-field-bible-reference .biblefield-verse-start-input');
150        			var new_verse_end = $(this).find('.views-field-bible-reference .biblefield-verse-end-input');
151        			var save_button = $(this).find('.views-field-bible-reference .form-actions button');
152        			
153        			var key = getKeyByValue(books_of_bible, book_id);
154        			
155        			new_book_id.val(key);
156        			new_chapter_start.val(chapter_start);
157        			new_chapter_end.val(chapter_end);
158        			new_verse_start.val(verse_start);
159        			new_verse_end.val(verse_end);
160        			
161        			save_button.click();
162        			
163        		});
164        	});
165        }
166        
167        
168        // Set the slot timing
169        if (document.getElementById('block-views-c3722482369bface0b8be32b942c7783')) {
170					$('.view-available-slots-for-signup-form .panel .views-field-nid span').removeClass('field-content');
171        	$('.view-available-slots-for-signup-form .panel').on('click', function() {
172        		$(this).parent().parent().parent().parent().find('.active').removeClass('active');
173        		$(this).addClass('active');
174        		var classList = $(this).find('.views-field-nid span').attr('class').split(/\s+/);
175						$.each(classList, function(index, item) {
176								var newItem = item.replace(/"/g, '');
177								if (index === 0) {
178									document.getElementById('edit-slot-day-und').value = newItem;
179								}
180								if (index === 1) {
181									document.getElementById('edit-slot-time-und').value = newItem;
182								}								
183						});  
184        	});
185        	var slot = document.getElementById('block-views-c3722482369bface0b8be32b942c7783');
186        	$('#edit-actions').prepend(slot);
187        	$('#edit-submit').addClass('btn-lg m-y-5');
188        }
189        
190        // Check the available slots
191        if (document.getElementById('edit-showcase-names-text')) {
192        	$('.field-name-slot-day').addClass('hidden');
193        	$('.field-name-slot-time').addClass('hidden');
194					var currentCount = 0;
195        	$('#edit-showcase-names-text').on('focus', 'input', function() {
196						currentCount = parseInt($('.field-name-showcase-names table.field-multiple-table')[0]['id'].replace('showcase-names-values--', ''));
197						if (isNaN(currentCount)) {
198							currentCount = 1;
199						}
200						$('.view-available-slots-for-signup-form .panel').filter(function() {
201							var slot = parseInt($(this).find('.views-field-nid span').text());
202							if (currentCount > slot) {
203								$(this).hide();
204							}      	
205						});
206        	});
207        }
208        if (document.getElementById('edit-spanish-showcase-and-banquet-und')) {
209        	var slot = $('#block-views-c3722482369bface0b8be32b942c7783');
210        	$('#edit-spanish-showcase-and-banquet-und').on('click', function() {
211						if ($('#edit-spanish-showcase-and-banquet-und').prop('checked')) {
212							slot.hide();
213						} else {
214							slot.show();
215						}
216        	});
217        }
218        
219        // Highlight split registrations for showcase
220        if (document.getElementById('slots-for-showcase')) {
221					$('form table tbody tr').each(function() {
222						var seat = $(this).find('.views-field-slot-seat')[0]['innerText'];
223						var registration = $(this).find('.views-field-showcase-registration select').val();
224						if (seat === '7') {
225							var next_seat = $(this).next().next().find('.views-field-slot-seat')[0]['innerText'];
226							var next_registration = $(this).next().next().find('.views-field-showcase-registration select').val();
227							var next_row = $(this).next().next();
228							if (registration === next_registration) {
229								$(this).addClass('warning');
230								next_row.addClass('warning');
231							}
232						}
233					});					
234        }
235        		
236        if ($('body.page-sms .view-sms-messages .view-person-for-sms')) {
237			$('.view-person-for-sms .view-empty').each(function() {
238				$(this).parent().parent().parent().addClass('warning');
239			});
240		}
241		
242
243		// Happiness Is Topics
244        if ($('body').hasClass("page-happiness-is-topics")) {
245            $('.hero-section h1')[0]['innerHTML'] = '<img src="/sites/default/files/happiness-is-identity.svg" class="img img-responsive img-md inline-block identity">Topics';
246            $('.hero-section h1').after('<a class="btn btn-primary b-rad-30" href="/happiness">Learn about Happiness Is...</a>');
247        }
248
249        // Add redirect link on 404 page
250        if ($('body').hasClass("page-node-496")) {
251            path = window.location.pathname.replace('/', '');
252            href = "/admin/config/search/redirect/add?source=" + path + "&destination=" + path;
253            $('a.add-redirect').attr("href", href);
254        }
255
256
257        $('div.error a.close').on('click', function() {
258            $('div.error-inner').addClass('hidden');
259            $('#popup').addClass('hidden');
260        });
261
262        if (document.getElementById('kid-city-registration-entityform-edit-form')) {
263            if ($('div.messages.error')) {
264                $('div.messages.error').prepend('<svg class="svg-error" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52"><circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"></circle><rect transform="rotate(-45)" height="1.5" width="25" y="36" x="-13" class="error__x"></rect><rect transform="rotate(45)" height="1.5" width="25" y="0" x="24" class="error__x"></rect></svg>');
265                $('div.messages.error').append('<h3>Please Touch Anywhere on the Screen to Continue.</h3></div>');
266                $('div.messages.error').wrap('<div class="error-inner"></div>');
267            }
268        }
269
270        // Checkout SVG Animation
271        $('#popup').on('click', function() {
272            $(this).addClass('hidden');
273        });
274        $('#popup-dismiss').on('click', function() {
275            $(this).parent().parent().find('#popup').addClass('hidden');
276        });
277        $('#popup-dismiss').on('click', function() {
278            $(this).parent().parent().parent().find('#popup').addClass('hidden');
279        });
280        if (document.getElementById('svg-check')) {
281            var popup_check = document.getElementById('svg-check');
282            popup_check.innerHTML += '<svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52"><circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/><path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/></svg>';
283        }
284
285        // Cache selectors
286        var lastId,
287            topMenu = $("#static-navbar"),
288            topMenuHeight = topMenu.outerHeight() + 50,
289            // All list items
290            menuItems = topMenu.find("a"),
291            // Anchors corresponding to menu items
292            scrollItems = menuItems.map(function() {
293                var item = $($(this).attr("href"));
294                if (item.length) { return item; }
295            });
296
297        // Bind to scroll
298        $(window).scroll(function() {
299            // Get container scroll position
300            var fromTop = $(this).scrollTop() + topMenuHeight;
301
302            // Get id of current scroll item
303            var cur = scrollItems.map(function() {
304                if ($(this).offset().top < fromTop)
305                    return this;
306            });
307            // Get the id of the current element
308            cur = cur[cur.length - 1];
309            var id = cur && cur.length ? cur[0].id : "";
310
311            if (lastId !== id) {
312                lastId = id;
313                // Set/remove active class
314                menuItems
315                    .parent().removeClass("active")
316                    .end().filter("[href='#" + id + "']").parent().addClass("active");
317            }
318        });
319
320        $(".show-next").click(function() {
321            $(this).next().slideToggle();
322        });
323
324        $('#overlay ul li.dropdown').click(function() {
325            $(this).find('ul.dropdown-menu').toggleClass('open');
326        });
327
328        // Google Analytics Track submission events
329        $('#edit-webform-ajax-submit-698').click(function() {
330            // New GTAG Method
331            // gtag('event', 'Webform', { submitted: 'Happiness Is Form' });
332
333            // Older GA method
334            ga('send', {
335                hitType: 'event',
336                eventCategory: 'Webforms',
337                eventAction: 'submitted',
338                eventLabel: 'Happiness Is'
339            });
340
341        });
342        
343        
344    		if ($('.transcription')) {
345    			$('.transcription').attr('id', 'transcription');
346    			$('.transcription').attr('name', 'transcription');
347    		}
348        if (!document.getElementById('transcription')) {
349    			$('.transcript-button').addClass('hidden');
350    		}
351    		
352    		if ($('.transcript-button')) {
353    		
354					var clicked = false;
355					
356    			$('.transcript-button').click(function() {
357						$(this).toggleClass('in');
358						$(".transcription").fadeToggle("fast", function() {
359							$(this).toggleClass("in");
360						});						
361					});
362    		}
363    		
364    		// Google Analytics Tracking buttons
365    		if ($('.ga-track')) {
366					var clicked = false;
367					$('.ga-track').click(function() {
368						if (!clicked) {
369							// New GTAG Method
370            	// gtag('event', 'Transcriptions', { submitted: 'Transcription' });
371							ga('send', {
372								hitType: $(this).attr('ga-type'),
373								eventCategory: $(this).attr('ga-category'),
374								eventAction: $(this).attr('ga-action'),
375								eventLabel: $(this).attr('ga-label')
376							});
377							clicked = true;
378							console.log('tracking');
379						} else {
380							console.log('not tracking');
381						}
382					});
383    		}
384    
385    
386    // Submit Kids Blast to Google Form
387		if (document.getElementById('kids-blast-registration-entityform-edit-form')) {
388			console.log('Ready for Google Form');
389			
390// 			$('.form-submit').click(function() {
391// 				var parentFirstName = document.getElementById('edit-kids-blast-parent-first-name-und-0-value').value;
392// 				var parentLastName = document.getElementById('edit-kids-blast-parent-last-name-und-0-value').value;
393// 				var phone = document.getElementById('edit-kids-blast-phone-und-0-value').value;
394// 				var email = document.getElementById('edit-kids-blast-email-und-0-email').value;
395// 				var address = document.getElementById('edit-kids-blast-address-und-0-thoroughfare').value;
396// 				
397// 				var childFirst = document.getElementById('edit-kids-blast-child-information-und-0-kids-blast-child-first-name-und-0-value').value;
398// 				var childLast = document.getElementById('edit-kids-blast-child-information-und-0-kids-blast-child-last-name-und-0-value').value;
399// 				
400// 				var gender = document.getElementById('edit-kids-blast-child-information-und-0-kids-blast-gender-und');
401// 				var childGender = gender.options[gender.selectedIndex].text;
402// 				console.log(childGender);
403// 				
404// 				var grade = document.getElementById('edit-kids-blast-child-information-und-0-kids-blast-grade-entering-und');
405// 				var childGrade = grade.options[grade.selectedIndex].text;
406// 				console.log(childGrade);
407// 				
408// 				var googleForm = 'https://docs.google.com/forms/d/e/1FAIpQLSf_wHLwSU_gxQyxukLijg4XmxjVTPBiWgMSizljgG04b31f2Q/formResponse?entry.1718322912=' + parentFirstName + '&entry.812242012=' + parentLastName + '&entry.1045781291=' + email + '&entry.1065046570=' + address + '&entry.1166974658=' + phone + '&entry.2005620554=' + childFirst + '&entry.556611348=' + childLast + '&entry.863053751=' + childGender + '&entry.1593424908=' + childGrade;
409// 				console.log(googleForm);
410// 				window.open(googleForm);
411// 			});
412    }
413    
414    
415// 			$('.submit-to-google').on('click', function(){
416// 				console.log('clicked the button');
417// 				$('.google-form').each(function() {
418// 					console.log(this);
419// 					this.click();
420// 				});
421// 			});    
422    		
423    // Scan QR Code
424		if (document.getElementById('scan-qr-code')) {
425
426// 				$('#edit-entityform-id-wrapper').addClass('hidden');
427
428				console.log('ready');
429				var input_container = document.getElementById('scan-qr-code-container');
430				var scan_icon = document.getElementById('scan-icon');
431				var scan_button = document.getElementById('scan-qr-code');
432
433				input_container.innerHTML += '<input type="text" id="qr-code-input" name="title_1" value="" size="30" maxlength="128" class="pull-right form-text">';
434
435				scan_button.addEventListener("click", function() {
436						if (scan_button.classList.contains('btn-accent')) {
437								scan_button.setAttribute('class', 'btn btn-primary pull-right text-white btn-lg');
438								scan_icon.setAttribute('class', 'fa-qrcode fas');
439						} else {
440								document.getElementById('qr-code-input').focus();
441								scan_button.setAttribute('class', 'btn btn-accent pull-right text-white btn-lg');
442								scan_icon.setAttribute('class', 'fa-spinner fa-spin fas');
443						}
444				});
445
446				var input_text = document.getElementById('qr-code-input');
447				input_text.addEventListener("keydown", function(e) {
448						if (e.which == 13) {
449							// var showcase_check_in = 'https://www.lancasterbaptist.org/node/' + input_text.value + '?checkin=1';
450							// var kids_blast_check_in = 'https://www.lancasterbaptist.org/kids-blast/check-in/' + input_text.value + '?checkin=1';
451							// window.location.href = showcase_check_in;
452							// window.location.href = kids_blast_check_in;
453							window.location.href = input_text.value;
454						}
455				});
456
457		}
458		
459		$('.copy-text').click(function() {
460			var data = $(this).attr('data-clipboard-text');
461			var action = $(this).attr('data-clipboard-action');
462			var message = $(this).attr('data-clipboard-message');
463			copyDataToClipboard(data, action);
464			setTooltip($(this), message);
465			hideTooltip($(this));			
466		});
467					
468		$('.navbar-toggle').click(function() {
469			 $(this).toggleClass('active');
470			 $('#overlay').toggleClass('open');
471		});
472
473		$('#toggle').click(function() {
474			$(this).toggleClass('active');
475			$('#sidenav').toggleClass('open');
476			$('.swipe-container').toggleClass('open');
477		});
478		$('.toggleNav').click(function() {
479			$('#sidenav').toggleClass('open');
480			$('.swipe-container').toggleClass('open');
481			$('#toggle').toggleClass('active');
482		});
483		
484		
485		// Swipe to hide side menu
486// 		document.querySelector('.sidenav').addEventListener('touchstart', handleTouch, false)
487// 		document.querySelector('.sidenav').addEventListener('touchmove', handleTouch, false)
488// 		document.querySelector('.sidenav').addEventListener('touchend', handleTouchEnd, false)
489    		    		
490    });
491    
492    if (document.getElementById('user-login')) {
493        var referrer = document.referrer;
494        var url = window.location.href;
495        $("#edit-name").val(getParameterByName('username'));
496        $("#edit-pass").val(getParameterByName('pass'));
497        var login = getParameterByName('login');
498        if (url != referrer) {
499            if (login == 'true') {
500                $('#edit-submit').click();
501            } else {
502                console.log('login is invalid');
503            }
504        }
505    }
506    
507		function getKeyByValue(object, value) { 
508				return Object.keys(object).find(key => object[key] === value); 
509		} 
510		
511		function copyToClipboard(element) {
512			var $temp = $("<input>");
513			$("body").append($temp);
514			$temp.val($(element).text()).select();
515			document.execCommand("copy");
516			$temp.remove();
517		}	
518
519		function copyDataToClipboard(data, action) {
520			var $temp = $("<input>");
521			$("body").append($temp);
522			$temp.val(data).select();
523			document.execCommand(action);
524			$temp.remove();
525		}
526		
527		function setTooltip(btn, message) {
528			$(btn).tooltip('hide')
529				.attr('data-original-title', message)
530				.tooltip('show');
531		}		
532		function hideTooltip(btn) {
533			setTimeout(function() {
534				$(btn).tooltip('hide');
535			}, 1000);
536		}
537
538
539    function getParameterByName(name) {
540        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
541        var regexS = "[\\?&]" + name + "=([^&#]*)";
542        var regex = new RegExp(regexS);
543        var results = regex.exec(window.location.search);
544        if (results == null)
545            return "";
546        else
547            return decodeURIComponent(results[1].replace(/\+/g, " "));
548    }
549    
550		function initialHash() {
551			'use strict';
552			window.location.href = "#";
553		}
554
555		function handleTouch(e) {
556			var sidenav = document.getElementById('sidenav');
557			var x = e.changedTouches[0].clientX;
558			var total = this.clientWidth;
559			var position = x - total;
560			if ( position < 0 ) sidenav.style.width = (x-total) + 'px'
561// 			if ( position < 0 ) $('.toggleNav').click()
562			// else if (position >= 0) sidenav.style.width = 0 + 'px'
563			else if (position >= 0) $('.toggleNav').click();
564		}
565		function handleTouchEnd(e) {
566			var sidenav = document.getElementById('sidenav');
567			var x = e.changedTouches[0].clientX;
568			var total = this.clientWidth;
569			var position = x - total;
570			// if ( position >= -total*0.5 ) initialHash();
571			if ( position <= -total*0.5 ) $('.toggleNav').click();
572		}
573
574
575})(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.