PageSourceSearch

https://www.thischurch.org/mod/admin/common.js

js thischurch.org collected 2026-09-24 09:41:12 UTC 3,269 bytes, 121 lines download raw bytes

1// addLoadEvent(funcname);
2// addLoadEvent( function() { alert('something'); } );
3function addLoadEvent(func) {
4	var oldonload = window.onload;
5	if (typeof window.onload != 'function') {
6		window.onload = func;
7	} else {
8		window.onload = function() {
9			if (oldonload) {
10				oldonload();
11			}
12			func();
13		}
14	}
15}
16
17// Stripe tables with odd/even
18function recacheOddEven() {
19	$('table.etable').each(function() {
20		$(this).find('tr').removeClass('odd');
21		$(this).find('tr:even').addClass('odd');
22	});
23}
24
25function eLog(msg) {
26	try {
27		console.log(arguments.callee.caller.name + ": " + msg);
28	} catch(e) {}
29}
30
31$(document).ready(function() {
32	$('ul.menu').children().filter('LI').each(function() {
33		$(this).mouseover(function() {
34			$(this).addClass('over');
35		}).mouseout(function() {
36			$(this).removeClass('over');
37		});
38	});
39
40	// Prevent PayPal etc from being framed
41	$('form[action^="http"], a[href^="http"][target!="_blank"]').attr('target', '_parent'); 
42
43	// Highlight current link
44	var path = document.location.href.replace(/http:..(.+?)\//, '/');
45	$('ul.menu a[href="' + path + '"]').parent().addClass('current');
46	$('#breadcrumb a').each(function() { // now look through breadcrumbs
47		if( $('#linkbar-1>li.page_item.current').length > 0 || $(this).attr('href') == '/' ) 
48			return;
49
50		
51		$('ul.menu a[href="' + $(this).attr('href') + '"]').parent().addClass('current');
52	});
53
54	$('table.etable:not(.nohover) TR:not(.nohover)').hover(function() {
55		$(this).find('td').addClass('etableHover');
56	}, function() {
57		$(this).find('td').removeClass('etableHover');
58	})
59		.addClass('etableLineBetweenRows')
60		.filter(':first')
61		.removeClass('eTableLineBetweenRows');
62	recacheOddEven();
63
64	// Also in mobile!!
65	$('span.eEmail').each(function() { // <span class='eEmail'>yahoo.com@user</span>
66		var $span = $(this);
67		$span.text( $span.text().replace( /(.+)@(.+)/, "$2@$1" ) );
68		$span.wrap('<a href="mailto:' + $span.text() + '">');
69	});
70
71	eLinkbarWrap(true);
72	$(window).resize(eLinkbarWrap);
73});
74
75
76// Runs once to see if any links have wrapped on the linkbar. 
77function eLinkbarWrap(val) {
78	$('ul.menu').each(function() {
79		var $menu = $(this);
80		if( $menu.parent().hasClass('vertical') ||
81		    $menu.parent().parent().hasClass('vertical') )
82			return;
83
84		if( $menu.find('li').length == 0 )
85			return;
86
87		$menu.find('li.more').remove();
88		var $lis = $menu.find(">li").show();
89
90		// The first link is the benchmark. 
91		var expectedOffset = $($lis.get(0)).offset().top;
92		
93		if( $lis.last().offset().top == expectedOffset )
94			return;
95
96		//eLog($lis.last().offset().top + '!==' + expectedOffset );
97
98		// We now have a wrapping situation
99
100		var $extras = $('<li class="page_item hasChildren more"><a href="#">More</a></li>');
101		$extras.appendTo($menu);
102		var w = $extras.outerWidth(true);
103		$extras.detach();
104		//eLog(w + 'px');
105
106		$lis = $menu.css('padding-right', w + 'px').find(">li").show();
107
108		var $ul = $('<ul></ul>');
109		$($lis.get().reverse()).each(function() {
110			if( $(this).hasClass('more') || $(this).offset().top <= expectedOffset ) 
111				return;
112				
113			$(this).clone().appendTo($ul);
114			$(this).addClass('hideme');
115		});
116		$('.hideme').hide().removeClass('hideme');
117		$menu.css('padding-right', '0');
118		$ul.appendTo($extras);
119		$extras.appendTo($menu);
120	});
121}

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.