PageSourceSearch

https://web.hypothes.is/wp-content/themes/hypothesis_new/assets/js/scripts.js

js hypothes.is collected 2026-09-24 07:19:54 UTC 7,866 bytes, 302 lines download raw bytes

1jQuery(document).ready(function ($) {
2	/* Main Nav */
3	//Main Nav - dropdown arrows
4	$(".navbar-wrap .menu-item ul")
5		.parent()
6		.append(
7			'<i class="fas fa-caret-down" role="button" aria-label="nav dropdown"></i>'
8		)
9	$(".navbar-wrap .menu-item .fas").click(function () {
10		$(this).siblings("ul").slideToggle()
11	})
12
13	//Main Nav - mobile Nav toggle and resize
14	$(".navbar-toggler").click(function () {
15		$(this).toggleClass("js-active")
16		$(".global-header").toggleClass("js-open")
17		$(".navbar").toggleClass("js-open")
18		$("body").toggleClass("js-locked")
19	})
20
21	//Main nav - reset mobile functionality if the page scales back up
22	$(window)
23		.bind("resize", function () {
24			if ($(this).width() > 992) {
25				$(".navbar-toggler").removeClass("js-active")
26				$(".global-header").removeClass("js-open")
27				$(".navbar").removeClass("js-open")
28				$("body").removeClass("js-locked")
29				$(".navbar-wrap .menu-item ul").show()
30			}
31		})
32		.trigger("resize")
33
34	//Main nav - Make the last item on the right a button
35	$(".navbar-wrap--user li:last-of-type a").addClass("btn btn--filled")
36
37	/* Anchor Links */
38	//Add an id to each body section so that they can be anchor linked to if necessary.
39	var sections = $(".global-main").children("div:not([id])")
40	sections.each(function (i) {
41		$(this).attr("id", `anchor-${i}`)
42	})
43
44	/* Sales form anchors */
45	const urlParams = new URLSearchParams(window.location.search)
46	const selectedOption = urlParams.get("selected")
47
48	console.log(selectedOption)
49
50	if (selectedOption) {
51		// Select the radio button based on the query parameter
52		$("#choice_9004111222025937_12_" + selectedOption).prop("checked", true)
53	}
54
55	/* Nav Ticker */
56	$(".js-ticker-close").click(function () {
57		$(".ticker").hide()
58	})
59
60	/* Slick Sliders */
61	//Slick Sliders - Testimonial Slider
62	if ($(".js-slick-test")) {
63		$(".js-slick-test").slick({
64			slidesToShow: 3,
65			slidesToScroll: 1,
66			adaptiveHeight: true,
67			arrows: false,
68			dots: true,
69			responsive: [
70				{
71					breakpoint: 1200,
72					settings: {
73						slidesToShow: 2,
74					},
75				},
76				{
77					breakpoint: 992,
78					settings: {
79						slidesToShow: 1,
80					},
81				},
82			],
83		})
84	}
85
86	//Slick Sliders - Post Slider
87	if ($(".js-slick-posts")) {
88		$(".js-slick-posts").slick({
89			slidesToShow: 1,
90			slidesToScroll: 1,
91			arrows: false,
92			dots: true,
93			autoplay: true,
94			autoplaySpeed: 5000,
95			responsive: [
96				{
97					breakpoint: 768,
98					settings: {
99						adaptiveHeight: true,
100					},
101				},
102			],
103		})
104	}
105
106	if ($(".js-slick-logos")) {
107		$(".js-slick-logos").slick({
108			arrows: false,
109			slidesToShow: 5,
110			slidesToScroll: 1,
111			autoplay: true,
112			autoplaySpeed: 0,
113			speed: 10000,
114			pauseOnHover: false,
115			cssEase: "linear",
116			responsive: [
117				{
118					breakpoint: 992,
119					settings: {
120						slidesToShow: 3,
121					},
122				},
123				{
124					breakpoint: 768,
125					settings: {
126						slidesToShow: 2,
127					},
128				},
129			],
130		})
131	}
132
133	/* Tabs */
134	$(".tab-pane:first-of-type").addClass("show active")
135	$(".nav-tabs .nav-item:first-of-type button").addClass("active")
136	$(".nav-tabs .nav-item:first-of-type button").attr("aria-selected", true)
137
138	/* Under Tabs Auto-Cycle */
139	const tabContainer = document.getElementById("underTab")
140
141	if (tabContainer) {
142		const interval = 10000 // 10 seconds
143		const tabCount = tabContainer.getElementsByTagName("li").length
144		let currentTab = 0
145
146		function switchTab() {
147			const nextTab = (currentTab + 1) % tabCount
148			const nextTabLink =
149				tabContainer.getElementsByTagName("button")[nextTab]
150			const tabId = nextTabLink.getAttribute("data-bs-target")
151
152			const tab = new bootstrap.Tab(nextTabLink)
153			tab.show()
154
155			currentTab = nextTab
156		}
157		const tabInterval = setInterval(switchTab, interval)
158	}
159
160	/* Modal Grid Module */
161	var gridModal = document.getElementById("gridModal")
162	if (gridModal) {
163		gridModal.addEventListener("show.bs.modal", function (event) {
164			var button = event.relatedTarget
165			//Field attributes
166			var imageSrc = button.getAttribute("data-bs-img")
167			var heading = button.getAttribute("data-bs-heading")
168			var subHeading = button.getAttribute("data-bs-subheading")
169			var content = button.querySelector(
170				".modal-grid__hidden-content"
171			).innerHTML
172			var twitter = button.getAttribute("data-bs-twitter")
173			var flag = button.getAttribute("data-bs-flag")
174			//Modal containers
175			var modalImg = document.querySelector("#gridModal img")
176			var modalHeading = document.querySelector("#gridModal h2")
177			var modalSubhead = document.querySelector("#gridModal .subhead")
178			var modalContent = document.querySelector("#gridModal .desc")
179			var modalTwitter = document.querySelector("#gridModal .social")
180			var modalFlag = document.querySelector("#gridModal .flag")
181
182			//Slot field data into modal markup
183			modalImg.setAttribute("src", imageSrc)
184			modalImg.setAttribute("alt", heading)
185			modalHeading.textContent = heading
186			modalSubhead.textContent = subHeading
187			modalContent.innerHTML = content
188			modalFlag.innerHTML = flag
189			if (twitter) {
190				modalTwitter.innerHTML = `
191                <li><a href="https://twitter.com/${twitter}" target="_blank"><i class="fab fa-twitter"></i></a></li>
192            `
193			}
194		})
195	}
196
197	/* Scroll Animation */
198	var section = $(".js-gsap-animate")
199	if (section.length) {
200		gsap.registerPlugin(ScrollTrigger)
201
202		var heading = $(".js-gsap-heading")
203		var copy = $(".js-gsap-copy")
204		var img1 = $(".js-gsap-img1")
205		var img2 = $(".js-gsap-img2")
206
207		//Text scrubs in on scroll - desktop and mobile
208		var tl = gsap.timeline({
209			scrollTrigger: {
210				trigger: section,
211				start: "top 60%",
212				end: "top 20%",
213				scrub: true,
214				//markers: true,
215			},
216		})
217		tl.to(heading, {
218			opacity: 1,
219		})
220		tl.to(copy, {
221			opacity: 1,
222			y: 0,
223		})
224
225		//Images need separate timelines for desktop v. mobile
226		ScrollTrigger.matchMedia({
227			//On desktop, pin the section and scrub the animation. Long image scrolls up before the pin releases.
228			"(min-width: 768px)": function () {
229				var tlPin = gsap.timeline({
230					scrollTrigger: {
231						trigger: section,
232						pin: true,
233						start: "top 10%",
234						end: "bottom top",
235						scrub: true,
236						//markers: true,
237					},
238				})
239				tlPin.to(img1, {
240					opacity: 1,
241					x: 0,
242				})
243				tlPin.to(img2, {
244					opacity: 1,
245					x: 0,
246				})
247				tlPin.to(img2, {
248					y: "-300",
249				})
250			},
251
252			//On mobile, pinning and scrubbing is removed. New timeline has an adjusted end parameter to account for lack of pinning. Toggle actions reverse out the animation when the user scrolls back up to account for lack of scrubbing. Long image no longer scrolls up but slides in all at once at full height.
253			"(max-width: 768px)": function () {
254				var tlPin = gsap.timeline({
255					scrollTrigger: {
256						trigger: section,
257						start: "top 10%",
258						end: "bottom 90%",
259						scrub: false,
260						toggleActions: "play none reverse none",
261						//markers: true,
262					},
263				})
264				tlPin.to(img1, {
265					opacity: 1,
266					x: 0,
267				})
268				tlPin.to(img2, {
269					opacity: 1,
270					x: 0,
271				})
272			},
273		})
274	}
275
276	/* Responsive tables */
277	$("#js-responsive-table").ReStable({
278		rowHeaders: true,
279		maxWidth: 768,
280		keepHtml: false,
281	})
282
283	/* Modal js for single post page */
284	$('#authorModal').on('show.bs.modal', function (event) {
285		var $button = $(event.relatedTarget)
286		if (!$button.length) return
287
288		var img = $button.attr('data-bs-img') || ''
289		var heading = $button.attr('data-bs-heading') || ''
290		var title = $button.attr('data-bs-title') || ''
291		var flag = $button.attr('data-bs-flag') || ''
292		var bio = $button.attr('data-bs-bio') || ''
293
294		var $modal = $(this)
295		$modal.find('.modal-grid__headshot img').attr('src', img).attr('alt', heading)
296		$modal.find('.modal-grid__bio h2').text(heading)
297		$modal.find('.modal-grid__bio .subhead').text(title)
298		$modal.find('.modal-grid__bio .flag').html(flag)
299		$modal.find('.modal-grid__bio .desc').html(bio)
300	})
301
302})

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.