JSFiddle - React, Tailwind, and code Playground

by Egor Makarenko

JavaScript

function _uFocus(a) {
    if (!a) {
        a = {}
    }
    this.constructor = _uFocus;
    this._tp = a.type || 0;
    this._thispar = a.thispar || null;
    this._param = a.param || null;
    this._parent = a.parent || null;
    delete a.type;
    delete a.thispar;
    delete a.param;
    delete a.parent;
    this.owner = null;
    $.extend(this, a || {});
    this.destroyed = 0;
    if (!_uFocus.globalset) {
        _uFocus.globalset = true;
        $(document).bind("keydown keyup keypress", _uFocus._onkey)
        }
    if (this._tp == 2) {
        _uFocus.glisteners.push(this)
        }
}
_uFocus.current = null;
_uFocus.last_fixed = null;
_uFocus.glisteners = [];
_uFocus.globalset = false;
_uFocus.inprocess = 0;
_uFocus.delayedactivate = null;
_uFocus._onkey = function(f) {
    var d = "on" + f.type,
    c;
    if (f.type == "keypress") {
        if (((f.keyCode == 37 || f.keyCode == 38 || f.keyCode == 39 || f.keyCode == 40 || (f.keyCode == 0 && $.browser.opera)) && f.target && f.target.tagName.toLowerCase() != "input" && f.target.tagName.toLowerCase() != "textarea") || (f.keyCode == 32 && f.ctrlKey)) {
            if (_uFocus.current) {
                f.preventDefault()
                }
        }
    }
    if (f.type == "keydown" && $.browser.opera && f.keyCode == 0) {
        f.keyCode = 93
    }
    for (var b = 0; b < _uFocus.glisteners.length; b++) {
        c = _uFocus.glisteners[b];
        if (!c[d]) {
            continue
        }
        if (c[d].call(c._thispar, f, c._param, _uFocus.current)) {
            return
        }
    }
    c = _uFocus.current;
    if (!c) {
        return
    }
    var a = [];
    while (c) {
        a.unshift(c);
        c = c._parent
    }
    for (var b = 0; b < a.length; b++) {
        if (!a[b][d]) {
            continue
        }
        if (a[b][d].call(a[b]._thispar, f, a[b]._param, _uFocus.current)) {
            return
        }
    }
};
_uFocus.prototype = {
    activate: function() {
        if...