PageSourceSearch

https://costumedesignersguild.com/wp-content/themes/cdg/assets/js/…put-mask-phone-number.min.js?ver=1790242170

js costumedesignersguild.com collected 2026-09-24 18:56:54 UTC 6,348 bytes, 176 lines download raw bytes

1// ==================================================
2// 
3// jquery-input-mask-phone-number 1.0.14
4//
5// Licensed (The MIT License)
6// 
7// Copyright © Raja Rama Mohan Thavalam <[email protected]>
8//
9// Last Updated On: 22/Aug/2020 IST  12:05 AM 
10//
11// ==================================================
12
13(function ($) {
14	$.fn.usPhoneFormat = function (options) {
15		var params = $.extend({
16			format: 'xxx-xxx-xxxx',
17			international: false,
18
19		}, options);
20
21		if (params.format === 'xxx-xxx-xxxx') {
22			$(this).bind('paste', function (e) {
23
24				e.preventDefault();
25				var inputValue = e.originalEvent && e.originalEvent.clipboardData.getData('Text');
26				inputValue = inputValue.replace(/\D/g, '');
27				if (!$.isNumeric(inputValue)) {
28					return false;
29				} else {
30					if (inputValue.length > 9) {
31						inputValue = String(inputValue.replace(/(\d{3})(\d{3})(\d{4})/, "$1-$2-$3"));
32					} else {
33						inputValue = String(inputValue.replace(/(\d{3})(?=\d)/g, '$1-'));
34					}
35					$(this).val(inputValue);
36					$(this).val('');
37					inputValue = inputValue.substring(0, 12);
38					$(this).val(inputValue);
39				}
40			});
41			$(this).on('keydown touchend', function (e) {
42
43				e = e || window.event;
44                var key = e.which || e.keyCode; // keyCode detection
45                var ctrl = e.ctrlKey || e.metaKey || key === 17; // ctrl detection
46                if (key == 86 && ctrl) { // Ctrl + V Pressed !
47
48                } else if (key == 67 && ctrl) { // Ctrl + C Pressed !
49
50                } else if (key == 88 && ctrl) { // Ctrl + x Pressed !
51
52                } else if (key == 65 && ctrl) { // Ctrl + a Pressed !
53                	$(this).trigger("paste");
54                } else if (key != 9 && e.which != 8 && e.which != 0 && !(e.keyCode >= 96 && e.keyCode <= 105) && !(e.keyCode >= 48 && e.keyCode <= 57)) {
55                	return false;
56                }
57                var curchr = this.value.length;
58                var curval = $(this).val();
59                if (curchr == 3 && e.which != 8 && e.which != 0) {
60                	$(this).val(curval + "-");
61                } else if (curchr == 7 && e.which != 8 && e.which != 0) {
62                	$(this).val(curval + "-");
63                }
64                $(this).attr('maxlength', '12');
65            });
66
67		} else if (params.format === '(xxx) xxx-xxxx') {
68			$(this).on('keydown touchend', function (e) {
69
70				e = e || window.event;
71                var key = e.which || e.keyCode; // keyCode detection
72                var ctrl = e.ctrlKey || e.metaKey || key === 17; // ctrl detection
73                if (key == 86 && ctrl) { // Ctrl + V Pressed !
74
75                } else if (key == 67 && ctrl) { // Ctrl + C Pressed !
76
77                } else if (key == 88 && ctrl) { //Ctrl + x Pressed
78
79                } else if (key == 65 && ctrl) { //Ctrl + a Pressed !
80                	$(this).trigger("paste");
81                } else if (key != 9 && e.which != 8 && e.which != 0 && !(e.keyCode >= 96 && e.keyCode <= 105) && !(e.keyCode >= 48 && e.keyCode <= 57)) {
82                	return false;
83                }
84                var curchr = this.value.length;
85                var curval = $(this).val();
86                if (curchr == 3 && e.which != 8 && e.which != 0) {
87                	$(this).val('(' + curval + ')' + " ");
88                } else if (curchr == 9 && e.which != 8 && e.which != 0) {
89                	$(this).val(curval + "-");
90                }
91                $(this).attr('maxlength', '14');
92
93            });
94			$(this).bind('paste', function (e) {
95
96				e.preventDefault();
97				var inputValue = e.originalEvent && e.originalEvent.clipboardData.getData('Text');
98				inputValue = inputValue.replace(/\D/g, '');
99
100				if (!$.isNumeric(inputValue)) {
101					return false;
102				} else {
103
104					if (inputValue.length > 9) {
105						inputValue = String(inputValue.replace(/(\d{3})(\d{3})(\d{4})/, "($1) $2-$3"));
106					} else if (inputValue.length > 6) {
107						inputValue = String(inputValue.replace(/(\d{3})(\d{3})(?=\d)/g, '($1) $2-'));
108					} else if (inputValue.length > 3) {
109						inputValue = String(inputValue.replace(/(\d{3})(?=\d)/g, '($1) '));
110					}
111
112					$(this).val(inputValue);
113					$(this).val('');
114					inputValue = inputValue.substring(0, 14);
115					$(this).val(inputValue);
116				}
117			});
118
119		} else if (params.format === 'xxxxx-xxx-xxx-xxxx') {
120
121			$(this).on('keydown touchend', function (e) {
122
123				e = e || window.event;
124                var key = e.which || e.keyCode; // keyCode detection
125                var ctrl = e.ctrlKey || e.metaKey || key === 17; // ctrl detection
126                if (key == 86 && ctrl) { // Ctrl + V Pressed !
127
128                } else if (key == 67 && ctrl) { // Ctrl + C Pressed !
129
130                } else if (key == 88 && ctrl) { // Ctrl + x Pressed !
131
132                } else if (key == 65 && ctrl) { // Ctrl + a Pressed !
133                	$(this).trigger("paste");
134                } else if (key != 9 && e.which != 8 && e.which != 0 && !(e.keyCode >= 96 && e.keyCode <= 105) && !(e.keyCode >= 48 && e.keyCode <= 57)) {
135                	return false;
136                }
137                var curchr = this.value.length;
138                var curval = $(this).val();
139
140                console.log(curchr);
141                console.log(curval);
142
143                 if (curchr == 5 && e.which != 8 && e.which != 0) {
144                	$(this).val(curval + "-");
145                } else if (curchr == 9 && e.which != 8 && e.which != 0) {
146                	$(this).val(curval + "-");
147                } else if (curchr == 13 && e.which != 8 && e.which != 0) {
148                	$(this).val(curval + "-");
149                }
150                $(this).attr('maxlength', '18');
151            });
152			$(this).bind('paste', function (e) {
153
154				e.preventDefault();
155				var inputValue = e.originalEvent && e.originalEvent.clipboardData.getData('Text');
156				inputValue = inputValue.replace(/\D/g, '');
157				if (!$.isNumeric(inputValue)) {
158					return false;
159				} else {
160					if (inputValue.length > 9) {
161						inputValue = String(inputValue.replace(/(\d{5})(\d{3})(\d{3})(\d{4})/, "$1-$2-$3-$4"));
162						
163					} else {
164						inputValue = String(inputValue.replace(/(\d{3})(?=\d)/g, '$1-'));
165					}
166					$(this).val(inputValue);
167					$(this).val('');
168					inputValue = inputValue.substring(0, 18);
169					$(this).val(inputValue);
170				}
171			});
172
173		}
174
175	}
176}(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.