PageSourceSearch

https://www.prepbaseballreport.com/js/customer-phone.js?cache=utadi8m2XN

js prepbaseballreport.com collected 2026-09-24 09:40:30 UTC 2,280 bytes, 77 lines download raw bytes

1(function(window, $) {
2    function digitsOnly(value) {
3        return String(value || '').replace(/\D/g, '');
4    }
5
6    function nationalDigits(value) {
7        var digits = digitsOnly(value);
8        if (digits.length === 11 && digits.charAt(0) === '1') {
9            return digits.substring(1);
10        }
11        return digits.substring(0, 10);
12    }
13
14    function formatNational(value) {
15        var digits = nationalDigits(value);
16        if (digits.length <= 3) {
17            return digits;
18        }
19        if (digits.length <= 6) {
20            return digits.substring(0, 3) + '-' + digits.substring(3);
21        }
22        return digits.substring(0, 3) + '-' + digits.substring(3, 6) + '-' + digits.substring(6, 10);
23    }
24
25    function normalizeE164(value) {
26        var digits = digitsOnly(value);
27        if (digits.length === 10) {
28            return '+1' + digits;
29        }
30        if (digits.length === 11 && digits.charAt(0) === '1') {
31            return '+' + digits;
32        }
33        return String(value || '').trim();
34    }
35
36    function bindPhoneOrEmail(selector) {
37        $(document).on('input', selector, function() {
38            var value = $(this).val();
39            if (!/^[+\d\s().-]*$/.test(value)) {
40                return;
41            }
42            $(this).val(formatNational(value));
43        });
44    }
45
46    function bindCustomerPhone(selector) {
47        $(document).on('input', selector, function() {
48            var value = $(this).val();
49            if (value.indexOf('@') !== -1) {
50                return;
51            }
52            $(this).val(formatNational(value));
53        });
54
55        $(document).on('blur', selector, function() {
56            $(this).val(formatNational($(this).val()));
57        });
58    }
59
60    function normalizeFields(selector) {
61        $(selector).each(function() {
62            var value = $(this).val();
63            if (value.indexOf('@') !== -1) {
64                return;
65            }
66            $(this).val(normalizeE164(value));
67        });
68    }
69
70    window.PbrCustomerPhone = {
71        bindPhoneOrEmail: bindPhoneOrEmail,
72        bindCustomerPhone: bindCustomerPhone,
73        formatNational: formatNational,
74        normalizeE164: normalizeE164,
75        normalizeFields: normalizeFields
76    };
77})(window, 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.