PageSourceSearch

https://ewhachurch.com/Scripts/autolink.js

js ewhachurch.com collected 2026-10-08 23:08:21 UTC 1,823 bytes, 34 lines download raw bytes

1/* autolink.js */
2var re = /(?:(?=(?:http|https):)([a-zA-Z][-+.a-zA-Z\d]*):(?:((?:[-_.!~*'()a-zA-Z\d;?:@&=+$,]|%[a-fA-F\d]{2})(?:[-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]|%[a-fA-F\d]{2})*)|(?:(?:\/\/(?:(?:(?:((?:[-_.!~*'()a-zA-Z\d;:&=+$,]|%[a-fA-F\d]{2})*)@)?(?:((?:(?:(?:[a-zA-Z\d](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:(?:[a-fA-F\d]{1,4}:)*[a-fA-F\d]{1,4})?::(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))?)\]))(?::(\d*))?))?|((?:[-_.!~*'()a-zA-Z\d$,;:@&=+]|%[a-fA-F\d]{2})+))|(?!\/\/))(\/(?:[-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*(?:;(?:[-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*)*(?:\/(?:[-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*(?:;(?:[-_.!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*)*)*)?)(?:\?((?:[-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]|%[a-fA-F\d]{2})*))?)(?:\#((?:[-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]|%[a-fA-F\d]{2})*))?)/img;
3
4function _makeHTML(textNode) {
5	var source = textNode.data;
6	return source.replace(re, function() {
7		var url = arguments[0];
8		var a = $('<a></a>').attr({'href': url, 'target': '_blank'}).text(url);
9		return url.match(/^https?:\/\/$/) ? url : $('<div></div>').append(a).html();
10	});
11};
12
13function _eachText(node, callback) {
14	$.each(node.childNodes, function() {
15		if (this.nodeType != 8 && this.nodeName != 'A') {
16			this.nodeType != 1 ? callback(this) : _eachText(this, callback);
17		}
18	});
19};
20
21function autolink(obj){
22	return obj.each(function() {
23		var queue = [];
24		_eachText(this, function(e) {
25			var html = _makeHTML(e);
26			if (html != e.data) {
27				queue.push([e, _makeHTML(e)]);
28			}
29		});
30		$.each(queue, function(i, x) {
31			$(x[0]).replaceWith(x[1]);
32		});
33	});
34};

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.