Skip to content

Instantly share code, notes, and snippets.

@JiLiZART
Created October 18, 2016 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiLiZART/d720a440a7b6139ae17ab738dce39e3f to your computer and use it in GitHub Desktop.
Save JiLiZART/d720a440a7b6139ae17ab738dce39e3f to your computer and use it in GitHub Desktop.
/**
* @module input_type_tel
*/
modules.define(
'input',
['i-bem__dom', 'jquery'],
function (provide, BEMDOM, jQuery, Input) {
/* borschik:include:../../libs/intl-tel-input/build/js/intlTelInput.js */
/**
* @exports
* @class input_type_tel
* @bem
*
*/
provide(Input.decl({modName: 'type', modVal: 'tel'}, /** @lends input_type_tel.prototype */{
getDefaultParams: function () {
var params = this.__base.apply(this, arguments);
return jQuery.extend({}, params, {
options: {
preferredCountries: ['us', 'gb', 'ru', 'fr', 'sp', 'tr', 'de', 'cn', 'pt', 'jp', 'ae'],
nationalMode: false,
autoHideDialCode: true,
autoPlaceholder: true
}
});
},
onSetMod: {
'js': {
'inited': function () {
this.__base.apply(this, arguments);
this.elem('control').intlTelInput(this.params.options);
}
}
}
}, {}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment