mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2026-04-29 15:37:48 +00:00
66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
var Plugins
|
|
;(function (n) {
|
|
var t = (function () {
|
|
function n(n) {
|
|
typeof n == 'undefined' && (n = 30)
|
|
this.space = n
|
|
}
|
|
return n
|
|
})(),
|
|
i
|
|
n.AutosizeInputOptions = t
|
|
i = (function () {
|
|
function n(t, i) {
|
|
var r = this
|
|
this._input = $(t)
|
|
this._options = $.extend({}, n.getDefaultOptions(), i)
|
|
this._mirror = $('<span style="position:absolute; top:-999px; left:0; white-space:pre;"/>')
|
|
$.each(['fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'letterSpacing', 'textTransform', 'wordSpacing', 'textIndent'], function (n, t) {
|
|
r._mirror[0].style[t] = r._input.css(t)
|
|
})
|
|
$('body').append(this._mirror)
|
|
this._input.on('keydown keyup input propertychange change', function () {
|
|
r.update()
|
|
})
|
|
;(function () {
|
|
r.update()
|
|
})()
|
|
}
|
|
return (
|
|
(n.prototype.getOptions = function () {
|
|
return this._options
|
|
}),
|
|
(n.prototype.update = function () {
|
|
var n = this._input.val() || '',
|
|
t
|
|
n !== this._mirror.text() && (this._mirror.text(n), (t = this._mirror.width() + this._options.space), this._input.width(t))
|
|
}),
|
|
(n.getDefaultOptions = function () {
|
|
return this._defaultOptions
|
|
}),
|
|
(n.getInstanceKey = function () {
|
|
return 'autosizeInputInstance'
|
|
}),
|
|
(n._defaultOptions = new t()),
|
|
n
|
|
)
|
|
})()
|
|
;((n.AutosizeInput = i),
|
|
(function (t) {
|
|
var i = 'autosize-input',
|
|
r = ['text', 'password', 'search', 'url', 'tel', 'email', 'number']
|
|
t.fn.autosizeInput = function (u) {
|
|
return this.each(function () {
|
|
if (this.tagName == 'INPUT' && t.inArray(this.type, r) > -1) {
|
|
var f = t(this)
|
|
f.data(n.AutosizeInput.getInstanceKey()) ||
|
|
(u == undefined && (u = f.data(i)), f.data(n.AutosizeInput.getInstanceKey(), new n.AutosizeInput(this, u)))
|
|
}
|
|
})
|
|
}
|
|
t(function () {
|
|
t('input[data-' + i + ']').autosizeInput()
|
|
})
|
|
})(jQuery))
|
|
})(Plugins || (Plugins = {}))
|