PageSourceSearch

https://everymum.ie/_static/??/wp-includes/js/wp-tooltip.js,/wp-co…/static/js/login.js?m=1790088692j

js everymum.ie collected 2026-09-24 18:23:37 UTC 6,651 bytes, 222 lines download raw bytes

1/**
2 * @output wp-admin/js/wp-tooltip.js
3 */
4
5/**
6 * Add focus and hover support for the 'tooltip' type in `wp_tooltip()`.
7 * This script can be made obsolete when support is available for Interest Invokers.
8 */
9(() => {
10
11	const supportsPopover = /** @type {boolean} */ ( Object.prototype.hasOwnProperty.call( HTMLElement.prototype, 'popover' ) );
12	let hidePopover = false;
13	if ( ! supportsPopover ) {
14		hidePopover = true;
15	}
16
17	const popovers = /** @type {NodeListOf<HTMLSpanElement>} */ ( document.querySelectorAll( '.wp-is-tooltip' ) );
18
19	popovers.forEach( function( popover ) {
20		const trigger = /** @type {HTMLButtonElement|HTMLAnchorElement|null} */ ( popover.querySelector( '.wp-tooltip__toggle' ) );
21		const panel   = /** @type {HTMLSpanElement|null} */ ( popover.querySelector( 'span.wp-tooltip__bubble' ) );
22		if ( hidePopover && panel ) {
23			panel.classList.add( 'hidden' );
24
25			return;
26		}
27		if ( ! trigger || ! panel ) {
28			return;
29		}
30
31		/** @type {ReturnType<typeof setTimeout>} */
32		let openTimeout;
33
34		// Show Tooltip Function (with delay to prevent flickering).
35		const showTooltip = () => {
36			clearTimeout( openTimeout );
37			openTimeout = setTimeout( () => {
38				// Only show if it's not already open.
39				if ( ! panel.matches( ':popover-open' ) ) {
40					// pass the triggering element so implicit position anchors work.
41					panel.showPopover( { source: trigger } );
42				}
43			}, 300 );
44		};
45		// Hide Tooltip Function.
46		const hideTooltip = () => {
47			clearTimeout( openTimeout );
48			if ( panel.matches( ':popover-open' ) ) {
49				panel.hidePopover();
50			}
51		};
52
53		// Bind Hover and Focus Events.
54		trigger.addEventListener( 'mouseenter', showTooltip );
55		trigger.addEventListener( 'focus', showTooltip );
56
57		trigger.addEventListener( 'mouseleave', hideTooltip );
58		trigger.addEventListener( 'blur', hideTooltip );
59	});
60})();
61;
62/**
63 * Login Page SSO Button JavaScript
64 *
65 * @package miniorange-saml-20-single-sign-on
66 */
67
68window.onload = function () {
69	var buttons = document.getElementsByName("mo_saml_button");
70	var loginForm = document.getElementById("loginform");
71	if (!buttons.length || !loginForm) return;
72
73	var above = [], below = [];
74	Array.from(buttons).forEach(function (btn) {
75		(btn.getAttribute('data-position') === 'below' ? below : above).push(btn);
76	});
77
78	var firstP = loginForm.querySelector("p");
79	if (firstP && above.length) {
80		above.forEach(function (btn) { firstP.before(btn); });
81	}
82
83	var submitBtn = loginForm.querySelector("p.submit");
84	submitBtn = submitBtn ? submitBtn : firstP;
85	if (below.length) {
86		below.forEach(function (btn) {
87			submitBtn ? submitBtn.parentNode.insertBefore(btn, submitBtn.nextSibling) : loginForm.parentNode.insertBefore(btn, loginForm.nextSibling);
88		});
89	}
90};
91
92document.addEventListener('DOMContentLoaded', function () {
93	document.querySelectorAll('[id^="mo_saml_login_sso_button_"]').forEach(function (btn) {
94		btn.addEventListener('click', function () {
95			var container = this.closest('[name="mo_saml_button"]');
96			var input = document.getElementById('saml_user_login_input_' + (container ? container.getAttribute('data-idp-id') : ''));
97			var form = document.getElementById('loginform');
98			var idpId = container ? container.getAttribute('data-idp-id') : '';
99			var base = container ? (container.getAttribute('data-sso-base') || '') : '';
100			if (!base) {
101				base = (window.location && window.location.origin) ? (window.location.origin + '/') : '/';
102			}
103			var targetUrl = base.replace(/\/+$/, '/') + '?option=saml_user_login' + '&idp=' + encodeURIComponent(idpId);
104			var redirectToParam = null;
105			try {
106				var params = new URLSearchParams(window.location.search || '');
107				if (params.has('redirect_to')) {
108					redirectToParam = params.get('redirect_to');
109					targetUrl += '&redirect_to=' + encodeURIComponent(redirectToParam);
110				}
111			} catch (e) { }
112
113			window.location.href = targetUrl;
114		});
115	});
116});
117
118jQuery(document).ready(function ($) {
119	let loginUserViaForm = false;
120	if (moSamlLoginData.isBackdoorLogin) {
121		return;
122	}
123	if (moSamlLoginData.domainMappingEnabled && moSamlLoginData.domainMappingEnabled === 'checked') {
124		hideElements();
125		$('#loginform').on('submit', function (e) {
126			handleLoginFormSubmission(e);
127		});
128	}
129
130	function hideElements() {
131		const hideElements = [
132			'#user_pass',
133			'label[for="user_pass"]',
134			'#rememberme',
135			'label[for="rememberme"]',
136			'button[aria-label="Show password"]',
137			'#nav',
138		];
139
140		hideElements.forEach(function (selector) {
141			$(selector).hide();
142		});
143		$('label[for="user_login"]').text('Email Address');
144		$('#user_pass').removeAttr('required').attr('disabled', 'disabled');
145	}
146
147	function handleLoginFormSubmission(e) {
148		if (loginUserViaForm) {
149			return;
150		}
151		e.preventDefault();
152		const userEmail = $('#user_login').val();
153		if (!userEmail || userEmail.length === 0) {
154			showError('Please enter your email address.');
155			return;
156		}
157		if (!checkEmail(userEmail)) {
158			showError('Please enter a valid email address.');
159			return;
160		}
161		fetchDomainMappingResponse(userEmail);
162	}
163
164	function fetchDomainMappingResponse(userEmail) {
165		$.ajax({
166			url: moSamlLoginData.ajaxUrl,
167			method: "GET",
168			data: {
169				action: "mosaml_fetch_domain_mapping",
170				userEmail: userEmail,
171				_ajax_nonce: moSamlLoginData.nonce
172			},
173			success: function (response) {
174				if (response.data.status === 'redirect') {
175					window.location.href = response.data.url;
176				} else if (response.data.status === 'wp_login') {
177					loginUserViaForm = true;
178					showElements();
179				}
180			},
181			error: function (error) {
182				loginUserViaForm = true;
183				showElements();
184			}
185		});
186	}
187
188	function showElements() {
189		const showElements = [
190			'#user_pass',
191			'label[for="user_pass"]',
192			'#rememberme',
193			'label[for="rememberme"]',
194			'button[aria-label="Show password"]',
195			'#nav',
196		];
197		showElements.forEach(function (selector) {
198			$(selector).show();
199		});
200		$('#user_pass').removeAttr('disabled').attr('required', 'required');
201		$('#login_error').hide();
202	}
203
204	function checkEmail(email) {
205		if (!email || typeof email !== "string") {
206			return null;
207		}
208		const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
209		return emailRegex.test(email.trim());
210	}
211
212	function showError(message) {
213		const errorDiv = $('#login_error');
214		if (errorDiv.length > 0) {
215			errorDiv.html(`<p><strong>Error:</strong> ${message}</p>`);
216		} else {
217			$('#loginform').before(`<div id="login_error" class="notice notice-error"><p><strong>Error:</strong> ${message}</p></div>`);
218		}
219	}
220});
221
222;

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.