PageSourceSearch

https://cityofmesquite.com/Areas/Layout/Assets/Scripts/Search.js

js cityofmesquite.com collected 2026-09-24 09:36:27 UTC 2,040 bytes, 84 lines download raw bytes

1
2function doWidgetSearch(searchPhrase, deptId) {
3	if (searchPhrase != '') {
4		if (deptId > 0) {
5			window.location.href = "/Search?searchPhrase=" + encodeURIComponent(searchPhrase) + "&departmentId=" + encodeURIComponent(deptId);
6		} else {
7			window.location.href = '/Search?searchPhrase=' + encodeURIComponent(searchPhrase);
8		}
9	}
10}
11
12function createDebouncedAutoCompleteSource(options) {
13	var currentRequest = null;
14	var debounceTimer = null;
15	var pendingResponse = null;
16	var delay = options.delay || 500;
17	var timeout = options.timeout || 10000;
18
19	return function (request, response) {
20		if (pendingResponse != null) {
21			pendingResponse([]);
22			pendingResponse = null;
23		}
24
25		clearTimeout(debounceTimer);
26		if (currentRequest != null) {
27			currentRequest.abort();
28			currentRequest = null;
29		}
30
31		if (!options.shouldSearch(request.term)) {
32			response([]);
33			return;
34		}
35
36		pendingResponse = response;
37		debounceTimer = setTimeout(function () {
38			currentRequest = $.ajax({
39				url: options.url(),
40				dataType: "json",
41				timeout: timeout,
42				data:
43				{
44					term: request.term,
45				},
46				success: function (data) {
47					if (pendingResponse === response) {
48						pendingResponse = null;
49						response(data);
50						if (options.success) {
51							options.success(data);
52						}
53					}
54				},
55				error: function (xmlhttprequest, textstatus, message) {
56					if (textstatus === "abort") {
57						return;
58					}
59
60					if (options.error) {
61						options.error(xmlhttprequest, textstatus, message);
62					}
63
64					if (pendingResponse === response) {
65						pendingResponse = null;
66						response([]);
67					}
68				},
69				complete: function (xmlhttprequest) {
70					if (currentRequest === xmlhttprequest) {
71						currentRequest = null;
72					}
73				}
74			});
75		}, delay);
76	};
77}
78
79//Prevents issue that happens on ios devices where search icon will not load after searching and hitting back button
80if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
81    $( document ).ready(function() {
82		$('.imageHover').removeClass('imageHover');
83	});
84}

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.