MCPcopy
hub / github.com/ampproject/amphtml / factory

Function factory

third_party/inputmask/inputmask.js:9–2792  ·  view source on GitHub ↗
($, window, document, undefined)

Source from the content-addressed store, hash-verified

7*/
8
9export function factory($, window, document, undefined) {
10 var ua = navigator.userAgent, ie = ua.indexOf("MSIE ") > 0 || ua.indexOf("Trident/") > 0, mobile = isInputEventSupported("touchstart"), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile;
11 function Inputmask(alias, options, internal) {
12 if (!(this instanceof Inputmask)) {
13 return new Inputmask(alias, options, internal);
14 }
15 this.el = undefined;
16 this.events = {};
17 this.maskset = undefined;
18 this.refreshValue = false;
19 if (internal !== true) {
20 if ($.isPlainObject(alias)) {
21 options = alias;
22 } else {
23 options = options || {};
24 if (alias) options.alias = alias;
25 }
26 this.opts = $.extend(true, {}, this.defaults, options);
27 this.noMasksCache = options && options.definitions !== undefined;
28 this.userOptions = options || {};
29 this.isRTL = this.opts.numericInput;
30 resolveAlias(this.opts.alias, options, this.opts);
31 }
32 }
33 Inputmask.prototype = {
34 dataAttribute: "data-inputmask",
35 defaults: {
36 placeholder: "_",
37 optionalmarker: [ "[", "]" ],
38 quantifiermarker: [ "{", "}" ],
39 groupmarker: [ "(", ")" ],
40 alternatormarker: "|",
41 escapeChar: "\\",
42 mask: null,
43 regex: null,
44 oncomplete: $.noop,
45 onincomplete: $.noop,
46 oncleared: $.noop,
47 repeat: 0,
48 greedy: false,
49 autoUnmask: false,
50 removeMaskOnSubmit: false,
51 clearMaskOnLostFocus: true,
52 insertMode: true,
53 clearIncomplete: false,
54 alias: null,
55 onKeyDown: $.noop,
56 onBeforeMask: null,
57 onBeforePaste: function(pastedValue, opts) {
58 return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(this, pastedValue, opts) : pastedValue;
59 },
60 onBeforeWrite: null,
61 onUnMask: null,
62 showMaskOnFocus: true,
63 showMaskOnHover: true,
64 onKeyValidation: $.noop,
65 skipOptionalPartCharacter: " ",
66 numericInput: false,

Callers

nothing calls this directly

Calls 15

isInputEventSupportedFunction · 0.85
importAttributeOptionsFunction · 0.85
generateMaskSetFunction · 0.85
defaultCaseFunction · 0.85
groupifyFunction · 0.85
groupQuantifierFunction · 0.85
verifyGroupMarkerFunction · 0.85
reverseTokensFunction · 0.85
InputmaskFunction · 0.85
$Function · 0.70
testMethod · 0.45
getElementByIdMethod · 0.45

Tested by

no test coverage detected