PageSourceSearch

https://maketecheasier.com/wp-content/themes/make-tech-easier-theme/assets/js/main.js?ver=1790234086

js maketecheasier.com collected 2026-09-24 07:30:30 UTC 3,336 bytes, 122 lines download raw bytes

1(() => {
2	const menuButton = document.querySelector('.mte-top__burger, .mte-mast__burger');
3
4	if (menuButton) {
5		menuButton.addEventListener('click', () => {
6			const isOpen = document.body.classList.toggle('mte--menu-open');
7			menuButton.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
8		});
9	}
10})();
11
12(() => {
13	document.querySelectorAll('[data-mte-copy]').forEach((btn) => {
14		btn.addEventListener('click', async () => {
15			const url = btn.getAttribute('data-mte-copy');
16			if (!url) return;
17			try {
18				await navigator.clipboard.writeText(url);
19				btn.classList.add('is-copied');
20				setTimeout(() => btn.classList.remove('is-copied'), 1600);
21			} catch (err) {
22				window.prompt('Copy this link:', url);
23			}
24		});
25	});
26})();
27
28(() => {
29	const forms = document.querySelectorAll('[data-newsletter-form]');
30
31	if (!forms.length) {
32		return;
33	}
34
35	forms.forEach((form) => {
36		const endpoint = form.dataset.endpoint;
37		const message = form.parentNode.querySelector('.mtenl__msg');
38		const button = form.querySelector('.mtenl__btn');
39
40		if (!endpoint || !message || !button) {
41			return;
42		}
43
44		form.addEventListener('submit', (event) => {
45			event.preventDefault();
46
47			const formData = new FormData(form);
48			const email = String(formData.get('email_address') || '').trim();
49			const company = String(formData.get('company') || '').trim();
50			const originalLabel = button.textContent;
51
52			message.className = 'mtenl__msg';
53
54			if (!email || !email.includes('@')) {
55				message.textContent = 'Please enter a valid email address.';
56				message.className = 'mtenl__msg mtenl__msg--err';
57				return;
58			}
59
60			button.disabled = true;
61			button.textContent = 'Subscribing...';
62
63			fetch(endpoint, {
64				method: 'POST',
65				headers: {
66					'Content-Type': 'application/json',
67				},
68				body: JSON.stringify({
69					email_address: email,
70					company,
71					source: form.dataset.source || 'theme',
72				}),
73			})
74				.then((response) => response.json())
75				.then((data) => {
76					if (data && data.success) {
77						form.hidden = true;
78						message.textContent = data.message || "You're in. Welcome to The MTE Letter.";
79						message.className = 'mtenl__msg mtenl__msg--ok';
80						return;
81					}
82
83					message.textContent =
84						(data && data.message) || 'Something went wrong. Please try again.';
85					message.className = 'mtenl__msg mtenl__msg--err';
86					button.disabled = false;
87					button.textContent = originalLabel;
88				})
89				.catch(() => {
90					message.textContent =
91						'Something went wrong. Please try again in a moment.';
92					message.className = 'mtenl__msg mtenl__msg--err';
93					button.disabled = false;
94					button.textContent = originalLabel;
95				});
96		});
97	});
98})();
99
100(() => {
101	// Promo / pitch nodes sometimes land inside .bbm-disclaimer — pull them out.
102	const untangle = () => {
103		document.querySelectorAll('.bbm-disclaimer').forEach((box) => {
104			const trapped = box.querySelectorAll(
105				'[data-ep-type], .bbm-ep-pitch, [class*="editors"], [class*="Editor"]'
106			);
107			trapped.forEach((node) => {
108				if (box.contains(node)) {
109					box.parentNode.insertBefore(node, box.nextSibling);
110				}
111			});
112		});
113	};
114
115	untangle();
116	document.addEventListener('DOMContentLoaded', untangle);
117	window.addEventListener('load', () => {
118		untangle();
119		setTimeout(untangle, 1200);
120		setTimeout(untangle, 3500);
121	});
122})();

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.