HEX
Server: Apache
System: Linux webm006.cluster111.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: perditaeyz (838589)
PHP: 7.3.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/p/e/r/perditaeyz/www/wp-content/plugins/my-calendar/js/locations-autocomplete.js
(function( $ ) { 'use strict';
	/* https://autocomplete.trevoreyre.com/#/javascript-component?id=getresultvalue */
	new Autocomplete( '#mc-locations-autocomplete', {
		search: input => {
			const url = mclocations.ajaxurl;
			return new Promise( resolve => {
				if (input.length < 3) {
					return resolve([])
				}

				var data = new FormData();
				data.append( 'action', mclocations.action );
				data.append( 'security', mclocations.security );
				data.append( 'data', input );
				const response = fetch(url, {
					method: 'POST',
					credentials: 'same-origin',
					body: data
				}).then(response => response.json())
				.then(data => {
					resolve(data.response)
				})
			})
		},
		onSubmit: result => {
			var location_field = document.getElementById( 'mc_event_location_value' );

			location_field.value = result.location_id;
			$( location_field ).trigger( 'change' );
		},
		getResultValue: result => result.location_label
	});

}(jQuery));