PageSourceSearch

https://nantucket-ma.gov/Assets/Scripts/InappropriateWords.js

js nantucket-ma.gov collected 2026-09-24 09:02:16 UTC 1,843 bytes, 70 lines download raw bytes

1// Returns true if the provided text contains a word that matches the inappropriate word
2// blacklist.
3function HasInappropriateWords(text) {
4	var result = true;
5	$.ajax({
6		url: '/SiteProperties/InappropriateWords',
7		type: 'post',
8		async: false,
9		data: { text: text },
10		success: function (response) {
11			if (response.Result == true) {
12				result = true;
13			}
14			else {
15				result = false;
16			}
17		},
18		error: function (xhr, textStatus, exception) {
19			alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status);
20		}
21	});
22
23	return result;
24}
25
26function HasInappropriateWordsMultiple(data) {
27	var result = {};
28	$.ajax({
29		url: '/SiteProperties/InappropriateWordsMultiple',
30		type: 'post',
31		async: false,
32		data: JSON.stringify(data),
33		contentType: 'application/json',
34		dataType: 'json',
35		success: function (response) {
36			result = response.Result;
37		},
38		error: function (xhr, textStatus, exception) {
39			alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status);
40		}
41	});
42
43	return result;
44}
45
46// Sets the error text for the input contained by the specified $liElement.
47function SetError($liElement, errorText) {
48	if ($liElement == null) {
49		alert(errorText);
50		return;
51	}
52
53	$liElement.addClass('error');
54	var errorElement = $('.inputErrorDescription', $liElement);
55	if (errorElement.length == 0) {
56		$errorElement = $('<p class="explanation title inputErrorDescription">' + errorText + '</p>');
57		$liElement.append($errorElement);
58	} else {
59		$errorElement.html(errorText);
60	}
61}
62
63// Clears the error text for the input contained by the specified $liElement.
64function ClearError($liElement, errorText) {
65	if ($liElement == null)
66		return;
67	var $errorElement = $('.inputErrorDescription', $liElement);
68	$liElement.removeClass('error');
69	$errorElement.remove();
70}

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.