PageSourceSearch

https://www.tarleton.edu/wp-content/mu-plugins/tarleton-shared-footer/assets/js/footer.js?ver=1790826022

js tarleton.edu collected 2026-10-01 10:43:07 UTC 2,007 bytes, 88 lines download raw bytes

1/**
2 * Tarleton shared footer behavior.
3 */
4(function () {
5	'use strict';
6
7	/**
8	 * Get a simple browser label.
9	 * 
10	 * Keeps the original behavior intentionally simple because downstream reporting
11	 * may already expect these broad values.
12	 * 
13	 * @returns {string}
14	 */
15	function getBrowserName() {
16		const ua = navigator.userAgent || '';
17
18		if (ua.includes('Firefox')) {
19			return 'Firefox';
20		}
21
22		if (ua.includes('Edg')) {
23			return 'Edge';
24		}
25
26		if (ua.includes('Chrome') && !ua.includes('Edg')) {
27			return 'Chrome';
28		}
29
30		if (ua.includes('Safari') && !ua.includes('Chrome')) {
31			return 'Safari';
32		}
33
34		return 'Unknown';
35	}
36
37	/**
38	 * Get a simple operating system/platform label.
39	 * 
40	 * @returns {string}
41	 */
42	function getPlatformName() {
43		return navigator.platform || 'Unknown';
44	}
45
46	/**
47	 * Preserve the current page URL when sending users to the website problem form.
48	 *
49	 * This intentionally remains on window because the footer markup calls it from
50	 * an inline onclick handler for portability across older themes.
51	 *
52	 * @param {MouseEvent} event Click event.
53	 * @param {HTMLAnchorElement} link The clicked link.
54	 */
55	window.passOriginUrl = function passOriginUrl(event, link) {
56		if (event && typeof event.preventDefault === 'function') {
57			event.preventDefault();
58		}
59
60		if (!link) {
61			return;
62		}
63
64		const rawHref = link.getAttribute('href');
65
66		if (!rawHref) {
67			return;
68		}
69
70		try {
71			const url = new URL(rawHref, window.location.href);
72
73			const originUrl = window.location.href;
74			const browserOs = getBrowserName() + ' on ' + getPlatformName();
75
76			url.searchParams.set('originUrl', originUrl);
77			url.searchParams.set('browserOs', browserOs);
78
79			window.location.href = url.toString();
80		} catch (error) {
81			/**
82			 * Fail open. If URL parsing fails for any reason, preserve the user's
83			 * ability to reach the form.
84			 */
85			window.location.href = rawHref;
86		}
87	};
88}());

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.