PageSourceSearch

https://www.wycliffe.org/wp-content/themes/wycliffe/assets/js/utils/validate-input.js?ver=1.0.108

js wycliffe.org collected 2026-10-01 10:23:30 UTC 2,101 bytes, 71 lines download raw bytes

1(function ($) {
2  "use strict";
3
4  class ValidateInput {
5    constructor() {
6      this.showErrorMessage = this.showErrorMessage.bind(this);
7      this.clearError = this.clearError.bind(this);
8      this.isEmail = this.isEmail.bind(this);
9      this.isUSZip = this.isUSZip.bind(this);
10      this.isPhone = this.isPhone.bind(this);
11      this.maskZip = this.maskZip.bind(this);
12      this.maskPhone = this.maskPhone.bind(this);
13    }
14
15    showErrorMessage(message, $input) {
16      $input.siblings(".validate-input-error-message").remove();
17
18      $input.addClass("validate-input-error");
19
20      const $messageEl = $(`<div class="validate-input-error-message">${message}</div>`);
21
22      $messageEl.appendTo($input.parent());
23
24      setTimeout(() => {
25        $messageEl.fadeOut(300, function () {
26          $(this).remove();
27        });
28      }, 3000);
29    }
30
31    clearError($input) {
32      $input.removeClass("validate-input-error");
33      $input.siblings(".validate-input-error-message").remove();
34    }
35
36    isEmail(value) {
37      if (!value) return false;
38      const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/i;
39      return emailRegex.test(String(value).trim());
40    }
41
42    isUSZip(value) {
43      if (!value) return false;
44      const cleaned = String(value).trim();
45      return /^\d{5}(-\d{4})?$/.test(cleaned);
46    }
47
48    isPhone(value) {
49      if (!value) return false;
50      const digits = String(value).replace(/\D/g, "");
51      return digits.length === 10;
52    }
53
54    maskZip(value) {
55      if (!value) return "";
56      const digits = String(value).replace(/\D/g, "").slice(0, 9);
57      if (digits.length <= 5) return digits;
58      return `${digits.slice(0, 5)}-${digits.slice(5)}`;
59    }
60
61    maskPhone(value) {
62      if (!value) return "";
63      const digits = String(value).replace(/\D/g, "").slice(0, 10);
64      if (digits.length <= 3) return digits;
65      if (digits.length <= 6) return `(${digits.slice(0, 3)}) ${digits.slice(3)}`;
66      return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6)}`;
67    }
68  }
69
70  window.ValidateInput = new ValidateInput();
71})(jQuery);

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.