PageSourceSearch

https://hub.farthinghalearms.com/view/js/mod_help.js?v=11.4.1

js farthinghalearms.com collected 2026-10-07 21:29:51 UTC 2,498 bytes, 61 lines download raw bytes

1toc = {};
2// Generate the table of contents in the side nav menu (see view/tpl/help.tpl)
3$(document).ready(function () {
4	// Generate the table of contents in the side nav menu (see view/tpl/help.tpl)
5	$('#doco-top-toc').toc({content: "#doco-content", headings: "h3,h4,h5,h6"});
6
7	$(".doco-section").find('a').each(function () {
8		var url = document.createElement('a');
9		url.href = window.location;
10		var pageName = url.href.split('/').pop().split('#').shift().split('?').shift();
11		var linkName = $(this).attr('href').split('/').pop();
12		if (pageName === linkName) {
13			var tocUl = $(this).closest('a').after('<ul>').next('ul');
14			tocUl.removeClass();  // Classes are automatically added to <ul> elements by something else
15			tocUl.toc({content: "#doco-content", headings: "h3"});
16			tocUl.addClass('toc-content');
17			tocUl.addClass('list-unstyled');
18			tocUl.attr('id', 'doco-side-toc');
19
20		}
21	});
22
23	toc.contentTop = [];
24	toc.edgeMargin = 20;   // margin above the top or margin from the end of the page
25	toc.topRange = 200;  // measure from the top of the viewport to X pixels down
26	// Set up content an array of locations
27	$('#doco-side-toc').find('a').each(function () {
28		toc.contentTop.push($('#' + $(this).attr('href').split('#').pop()).offset().top);
29	});
30
31
32	// adjust side menu
33	$(window).scroll(function () {
34		var winTop = $(window).scrollTop(),
35				bodyHt = $(document).height(),
36				vpHt = $(window).height() + toc.edgeMargin;  // viewport height + margin
37		$.each(toc.contentTop, function (i, loc) {
38			if ((loc > winTop - toc.edgeMargin && (loc < winTop + toc.topRange || (winTop + vpHt) >= bodyHt))) {
39				$('#doco-side-toc li')
40						.removeClass('selected-doco-nav')
41						.eq(i).addClass('selected-doco-nav');
42				if (typeof ($('#doco-side-toc li').eq(i).find('a').attr('href').split('#')[1]) !== 'undefined') {
43					window.history.replaceState({}, '', location.href.split('#')[0] + '#' + $('#doco-side-toc li').eq(i).find('a').attr('href').split('#')[1]);
44				}
45			}
46		});
47	});
48
49	// When the page loads, it does not scroll to the section specified in the URL because it
50	// has not been constructed yet by the script. This will reload the URL
51	if (typeof (location.href.split('#')[1]) !== 'undefined') {
52		var p = document.createElement('a');
53		p.href = location.href;
54		var portstr = '';
55		if (p.port !== '') {
56			portstr = ':' + p.port;
57		}
58		var newref = p.protocol + '//' + p.hostname + portstr + p.pathname + p.hash.split('?').shift();
59		location.replace(newref)
60	}
61});

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.