PageSourceSearch

https://www.reviewofoptometry.com/Scripts/footnotes.js

js reviewofoptometry.com collected 2026-10-02 03:37:24 UTC 2,395 bytes, 62 lines download raw bytes

1function showFootnotes() {
2	$(".footnotes").show();
3	$(".footnotes_toggle").attr("href", "javascript:hideFootnotes();").html('Hide Footnotes');
4}
5
6function hideFootnotes() {
7	$(".footnotes").hide();
8	$(".footnotes_toggle").attr("href", "javascript:showFootnotes();").html('View Footnotes');
9}
10
11function scrollToHash() {
12	if (location.hash === "#footnotes") {
13		$("#footnotes").removeClass("hidden"); // Enables browser to obtain appropriate top offset of footnotes section
14		showFootnotes();
15		var topoffset = $(".navbar-fixed-top").height();
16		var speed = 500;
17		var easing = 'swing';
18		var target = $(this).attr('href');
19		var destination = $(location.hash).offset().top - topoffset;
20		$('html,body').stop(true).animate({ scrollTop: destination }, speed, easing);
21		$("#footnotes").addClass("hidden"); // Prevents browser from jumping directly to anchor when footnote link clicked
22	}
23}
24
25$(function () {
26
27	if ($('.footnotes').length) {
28
29		// Turn each footnote reference into links to footnotes section.
30		$(".article .footnote").html(function () {
31			return "<a class='footnotelink' href='#footnotes'>" + $(this).html() + "</a>";
32		});
33
34		$(".article").find("sup").not(".aside sup").filter(function () {
35			var footnote_regex = /([0-9]{1,3}[-,][0-9]{1,3})|(^[0-9]{1,3})/g;
36			return (this.textContent || this.innerText).match(footnote_regex);
37		}).html(function () {
38			return "<a class='footnotelink' href='#footnotes'>" + $(this).html() + "</a>";
39		});
40
41		// Initially hide the footnotes section. Add link to view footnotes and add an anchor tag before footnotes section.
42		$(".footnotes").before("<a id='footnotes' name='footnotes' class='hidden'></a>").after("<a class='footnotes_toggle' href='javascript:showFootnotes();'>View Footnotes</a>");
43
44		// When page loads, scroll to footnotes section if proper hashtag is set
45		scrollToHash();
46
47		// When a footnote link is clicked initially, scroll to footnotes section. Needed to override default behavior
48		$(window).on('hashchange', function (e) {
49			scrollToHash();
50		});
51
52		// Make each footnote link scroll to footnotes section when clicked when hashtag is aleady in current url
53		$(".footnotelink").on('click', function (e) {
54			if (location.hash !== "") { //Needed to prevent two jumps on initial click when no hash tag is in url
55				scrollToHash();
56			}
57		});
58
59	}
60	
61
62});

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.